2025-03-18 3:37 PM
We have a custom stm32mp25 board. On Mickledore we were able to create a/b partitions in our machine conf doing the following:
PARTITIONS_IMAGES += "tc-appfs-a tc-appfs-b"
STM32MP_TCFS_IMAGE ?= "ti-tc-appfs"
STM32MP_TCFS_LABEL_A ?= "tc-appfs-a"
STM32MP_TCFS_LABEL_B ?= "tc-appfs-b"
STM32MP_TCFS_MOUNTPOINT ?= "/tc-apps"
# Proposed value for tc-appfs is 150MB
STM32MP_TCFS_SIZE ?= "153600"
PARTITIONS_IMAGES[tc-appfs-a] ?= "${STM32MP_TCFS_IMAGE},${STM32MP_TCFS_LABEL_A},${STM32MP_TCFS_MOUNTPOINT},${STM32MP_TCFS_SIZE},FileSystem"
PARTITIONS_IMAGES[tc-appfs-b] ?= "${STM32MP_TCFS_IMAGE},${STM32MP_TCFS_LABEL_B},${STM32MP_TCFS_MOUNTPOINT},${STM32MP_TCFS_SIZE},FileSystem"
PARTITIONS_LIST += "tc-appfs-a tc-appfs-b"
However, in scarthgap this no longer works. We are getting the following error:
Cannot generate FlashLayout_emmc_stm32mp257f-m670-optee.tsv file: the ti-tc-appfs-ti-linux-stm32mp25-m670.tc-appfs-a.ext4 binary for tc-appfs-a partition is missing in deploy folder.
What we observe is that the relevant file is being renamed as
ti-tc-appfs-ti-linux-stm32mp25-m670.tc-appfs-bfs.ext4
Is this a bug, or do we need to proceed in a different way when using scarthgap.
Thanks
P.S I have seen mentioned an meta-st-ota layer on the board. I have, however, been unable to find it. So if someone could point out it's location I would be grateful.
2025-03-19 2:20 AM
Hello @BGurnett,
So, according to your logs, it seems a "fs" suffix is appent to the filename.
In st-machine-image-partition-stm32mp.inc, It seems the generated filename doesn't contain the "fs" suffix:
bin_name = items[0] + bin_suffix + '.' + items[1] + '.' + fstype
Where bin_suffix = '-${DISTRO}-${MACHINE}'
Nevertheless, the image filename has change between Mickledore and Scrathgap, here is an example for bootfs partition:
Mickledore: st-image-bootfs-openstlinux-weston-stm32mp2.ext4
Scrathgap: st-image-bootfs-openstlinux-weston-stm32mp2.bootfs.ext4
Is "fs" suffix added on all your partitions ? Or only ext4 ones ?
BR,
Christophe
PS: I asked to give you the permission to access to meta-st-ota.
2025-03-19 2:36 AM
Hi
The addition of fs, and the change of the image name seems to occur on all partitions and all files (manifest, spdx etc), with the exception of tar.xz which keeps the original name, but no link is generated for it when trying to make A/B partitions.
2025-03-31 3:23 AM
Hello
Is there any more info or tests I can perform in order to get things moving along. Also I have managed to get rauc to update partitions. However, for some reason, on reboot the partitions are not switching. After the update, and before reboot, i run rauc status and both A and B partitions are good, so everything looks ok, with the exception that no switching occurs.
kind regards
2025-03-31 4:17 AM
Hi @BGurnett,
I wrote a wiki page on that topic, but it is not yet published because still under review.
First of all, I would recommand to read the Secure Firmware Update wiki page.
Then, the best way to update metadata partition is to use mkfwumdata tool, with an extra patch which will be integrated by default in the next v6.1.0 Ecosystem Release : link.
So here are steps:
UUID_LIST="8a7a84a0-8387-40f6-ab41-a8b9a5a60d23,19d5df83-11b0-457b-be2c-7559c13142a5,4fd84c93-54ef-463f-a7ef-ae25ff887087,09c54952-d5bf-45af-acee-335303766fb3"
OPTIONS="-g -i 1 -b 2 -v 2" bank_state="A,V"
mkfwumdata ${OPTIONS} -s ${bank_state} -a 1 -p 0 ${UUID_LIST} /dev/disk/by-partlabel/metadata1
mkfwumdata ${OPTIONS} -s ${bank_state} -a 1 -p 0 ${UUID_LIST} /dev/disk/by-partlabel/metadata2
Don't forget to update /dev/disk/by-partlabel/metadata2 which is the backup of metadata1, and will be used by TF-A in case of CRC error of metadata1 partition.
UUID_LIST="8a7a84a0-8387-40f6-ab41-a8b9a5a60d23,19d5df83-11b0-457b-be2c-7559c13142a5,4fd84c93-54ef-463f-a7ef-ae25ff887087,09c54952-d5bf-45af-acee-335303766fb3"
OPTIONS="-g -i 1 -b 2 -v 2" bank_state="A,A"
mkfwumdata ${OPTIONS} -s ${bank_state} -a 1 -p 0 ${UUID_LIST} /dev/disk/by-partlabel/metadata1
mkfwumdata ${OPTIONS} -s ${bank_state} -a 1 -p 0 ${UUID_LIST} /dev/disk/by-partlabel/metadata2
BR,
Christophe Guibout
2025-03-31 5:11 AM
Aren't these steps mentioned above already being performed by the post-install.sh st-boot-script.sh st-status-mark-good.sh in conjunction with update_metadata.sh. These are all being run, but do not seem to affect the switching.
current_boot_slot=A
rootfs-b PARTUUID updated: 83e1fd5c-45cd-43f9-a888-be9bd503ce1d
[ 1327.086624] EXT4-fs (mmcblk0p7): mounted filesystem 6a717db6-1964-4756-bef1-1a7435c4f5ad r/w with ordered data mode. Quota mode: none.
Updating: /tmp/boot_B/mmc0_extlinux/extlinux.conf
Updating: /tmp/boot_B/mmc1_extlinux/extlinux.conf
umount to /tmp/boot_B
[ 1327.142304] EXT4-fs (mmcblk0p7): unmounting filesystem 6a717db6-1964-4756-bef1-1a7435c4f5ad.
[ 1327.176997] EXT4-fs (mmcblk0p11): mounted filesystem 2b2bc479-748a-42e0-baff-7e4fe7727532 r/w with ordered data mode. Quota mode: none.
umount to /tmp/rootfs_B
[ 1327.227210] EXT4-fs (mmcblk0p11): unmounting filesystem 2b2bc479-748a-42e0-baff-7e4fe7727532.
writing metadata partitions....
mkfwumdata -g -i 1 -b 2 -v 2 -s A,V -a 1 -p 0 8a7a84a0-8387-40f6-ab41-a8b9a5a60d23,19d5df83-11b0-457b-be2c-7559c13142a5,4fd84c93-54ef-463f-a7ef-ae25ff887087,09c54952-d5bf-45af-acee-335303766fb3
active boot is B
boot count is enabled
so atleast according from above, we should be booting into B, or am I missing something fundamental?
2025-04-01 12:11 AM
Hello @BGurnett,
Yes, You should boot into B.
Could you please share TF-A and U-boot logs on reboot ?
You should be able to see that the bootcount is enabled, and then in U-boot, altbootcmd should be used instead of bootcmd which will lead the kernel from bootfs-b.
BR,
Christophe
2025-04-01 6:23 AM
U-Boot 2023.10-stm32mp-r1.2 (Oct 02 2023 - 14:39:59 +0000)
CPU: STM32MP257FAK Rev.?
Model: ME M670
Board: stm32mp2 (st,stm32mp257f-m670)
DRAM: 2 GiB
optee optee: OP-TEE: revision 4.0 (2a5b1d12)
I/TC: Reserved shared memory is disabled
I/TC: Dynamic shared memory is enabled
I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are enabled
Core: 416 devices, 34 uclasses, devicetree: board
WDT: Started watchdog with servicing every 1000ms (32s timeout)
NAND: 0 MiB
MMC: STM32 SD/MMC: 0, STM32 SD/MMC: 1
Loading Environment from MMC... OK
In: serial
Out: serial
Err: serial
invalid MAC address 0 in OTP 00:00:00:00:00:00
Net:
Error: eth1@482c0000 address not set.
No ethernet found.
MMC: no card present
No EFI system partition
No EFI system partition
Failed to persist EFI variables
Error: eth1@482c0000 address not set.
Hit any key to stop autoboot: 0
Boot A
Boot over mmc1!
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:6...
Found /mmc1_extlinux/extlinux.conf
Retrieving file: /mmc1_extlinux/extlinux.conf
Retrieving file: /splash_landscape.bmp
1: OpenSTLinux
Enter choice: 1: OpenSTLinux
Retrieving file: /Image.gz
Retrieving file: /st-image-resize-initrd
append: root=PARTUUID=491f6117-415d-4f53-88c9-6e0de54deac6 rootwait rw earlycon rauc.slot=A console=ttySTM0,115200
Retrieving file: /stm32mp257f-m670.dtb
Uncompressing Kernel Image
## Flattened Device Tree blob at 90000000
Booting using the fdt blob at 0x90000000
Working FDT set to 90000000
Loading Ramdisk to 8f800000, end 8ffff9bb ... OK
Loading Device Tree to 000000008f7e4000, end 000000008f7ff401 ... OK
Working FDT set to 8f7e4000
INFO: PSCI Power Domain Map:
INFO: Domain Node : Level 4, parent_node 4294967295, State ON (0x0)
INFO: Domain Node : Level 3, parent_node 0, State ON (0x0)
INFO: Domain Node : Level 2, parent_node 1, State ON (0x0)
INFO: Domain Node : Level 1, parent_node 2, State ON (0x0)
INFO: CPU Node : MPID 0x0, parent_node 3, State ON (0x0)
INFO: CPU Node : MPID 0x1, parent_node 3, State ON (0x0)
NOTICE: CPU: STM32MP257FAK Rev.?
NOTICE: Model: ME M670
NOTICE: Reset reason: System reset (SYSRST) (0x2074)
INFO: PMIC2 version = 0x11
INFO: PMIC2 product ID = 0x21
INFO: FCONF: Reading TB_FW firmware configuration file from: 0xe011000
INFO: FCONF: Reading firmware configuration information for: stm32mp_fuse
INFO: FCONF: Reading firmware configuration information for: stm32mp_io
INFO: Using EMMC
INFO: Instance 2
INFO: Boot used partition fsbl1
NOTICE: BL2: v2.10-stm32mp2-r1.0(debug):lts-v2.10.5-dirty(7c229848)
NOTICE: BL2: Built : 16:19:31, Jun 28 2024
NOTICE: !!CGU : active index: 1, bank state: 254
NOTICE: !!CGU : fwu bootcount 4
NOTICE: !! CGU: bank is in trial mode, bootcount=4
NOTICE: Selecting to boot from bank 1
INFO: BL2: Loading image id 26
INFO: Loading image id=26 at address 0xe041000
INFO: Image id=26 loaded: 0xe041000 - 0xe048524
INFO: BL2: Doing platform setup
INFO: RAM: DDR4 1x16Gbits 1200MHz
INFO: Memory size = 0x80000000 (2048 MB)
INFO: BL2: Loading image id 1
INFO: Loading image id=1 at address 0xe000000
INFO: Image id=1 loaded: 0xe000000 - 0xe000326
INFO: FCONF: Reading FW_CONFIG firmware configuration file from: 0xe000000
INFO: FCONF: Reading firmware configuration information for: risaf_config
INFO: RISAF2: No configuration in DT, use default
INFO: FCONF: Reading firmware configuration information for: dyn_cfg
INFO: BL31 max size = 0x17000 (94208B)
INFO: BL2: Loading image id 3
INFO: Loading image id=3 at address 0xe000000
INFO: Image id=3 loaded: 0xe000000 - 0xe0144c4
INFO: BL2: Loading image id 19
INFO: Loading image id=19 at address 0x81fc0000
INFO: Image id=19 loaded: 0x81fc0000 - 0x81fc39a0
INFO: BL2: Loading image id 4
INFO: Loading image id=4 at address 0x82000000
INFO: Image id=4 loaded: 0x82000000 - 0x8200001c
INFO: OPTEE ep=0x82000000
INFO: OPTEE header info:
INFO: magic=0x4554504f
INFO: version=0x2
INFO: arch=0x1
INFO: flags=0x0
INFO: nb_images=0x1
INFO: BL2: Loading image id 8
INFO: Loading image id=8 at address 0x82000000
INFO: Image id=8 loaded: 0x82000000 - 0x820fd628
INFO: BL2: Loading image id 2
INFO: Loading image id=2 at address 0x84400000
INFO: Image id=2 loaded: 0x84400000 - 0x8441a5b0
INFO: BL2: Loading image id 5
INFO: Loading image id=5 at address 0x84000000
INFO: Image id=5 loaded: 0x84000000 - 0x841c49b8
NOTICE: BL2: Booting BL31
INFO: Entry point address = 0xe000000
INFO: SPSR = 0x3cd
INFO: ARM GICv2 driver initialized
NOTICE: BL31: v2.10-stm32mp2-r1.0(debug):lts-v2.10.5-dirty(7c229848)
NOTICE: BL31: Built : 16:19:31, Jun 28 2024
INFO: BL31: Initializing runtime services
INFO: BL31: Initializing BL32
I/TC: Early console on UART#2
I/TC:
I/TC: Embedded DTB found
I/TC: OP-TEE version: 4.0.0-dev (gcc version 13.3.0 (GCC)) #1 Fri Oct 20 18:29:31 UTC 2023 aarch64
I/TC: WARNING: This OP-TEE configuration might be insecure!
I/TC: WARNING: Please check https://optee.readthedocs.io/en/latest/architecture/porting_guidelines.html
I/TC: Primary CPU initializing
I/TC: WARNING: All debug access are allowed
I/TC: Override the OTP 124: 0 to 0x18db6
I/TC: WARNING: Embeds insecure stm32mp_provisioning driver
I/TC: UART console (non-secure)
I/TC: PMIC STPMIC REFID:2.A V1.1
I/TC: Platform stm32mp2: flavor PLATFORM_FLAVOR - DT stm32mp257f-m670.dts
I/TC: OP-TEE ST profile: secure_and_system_services
[ 0.000000] SCP-firmware 2.13.0-intree-optee-os-4.0.0-dev
[ 0.000000]
[ 0.000000] [FWK] Module initialization complete!
I/TC: Primary CPU switching to normal world boot
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0x84000000
INFO: SPSR = 0x3c5
I/TC: Reserved shared memory is disabled
I/TC: Dynamic shared memory is enabled
I/TC: Normal World virtualization support is disabled
I/TC: Asynchronous notifications are enabled
Is this what you needed?
2025-04-02 6:18 AM
Hi @BGurnett,
The logs show tf-a switched to bootB : "NOTICE: Selecting to boot from bank 1": Good !
The log from u-boot show that BootA is still selected : I guess understanding why altbootcmd is not called in u-boot will help to understand the problem.
BR,
Christophe
2025-04-07 6:44 AM
Is there something in particular we can check on our side as to where the problem lies