cancel
Showing results for 
Search instead for 
Did you mean: 

U-boot modifications when using Yocto and meta-st-stm32mp

mmichala
Associate II

Hello,

I am working with STM32MP135F-DK and Yocto (Kirkstone), using poky, meta-openembedded, meta-st-stm32mp layers. I am creating my custom image for the board. I want to implement OTA to my board and I have chosen swupdate package to achive that. I have also chosen to follow the "dual-copy" stategy. And that's where I had to start dealing with U-boot, it's environment, and environment variables. I am certainly a beginner in Yocto and Embedded Linux. I did some research, I have followed U-boot bootcmd all way down through all ST scripts there, and as far as I can understand:

  • configuration (setting CONFIG_...) of U-boot and environment variables is done in .patch files located in meta-st-stm32mp/recipes-bsp/u-boot/u-boot-stm32mp
  • there is a boot.scr.cmd in stm32mp-extlinux folder but it should not be used in production, it's there to handle all availiable dev-boards and types of storage
  • when my board boots it uses mmc0_extlinux/st32mp135f-dk_extlinux.conf file. The content of this file is:

 

 

 

# Generic Distro Configuration file generated by OpenEmbedded
menu title Select the boot mode
MENU BACKGROUND /splash_landscape.bmp
TIMEOUT 20
DEFAULT OpenSTLinux
LABEL OpenSTLinux
	KERNEL /uImage
	FDTDIR /
	APPEND root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw   console=${console},${baudrate}
LABEL stm32mp135f-dk-a7-examples
	KERNEL /uImage
	FDT /stm32mp135f-dk-a7-examples.dtb
	APPEND root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw   console=${console},${baudrate}

 

 

 

and there is this "APPEND root=PARTUUID= (...)" from which U-boot knows where the rootfs is. Those are my conclusions, please correct me if I am wrong somewhere.

I am struggling (don't know how to do it) with:

1. Changing the configuration of U-Boot and changing the environment variables values or adding my own variables. Should I modify the .patch files (doesn't look like a elegant solution to me). How to do it properly?

2. Getting rid of boot.scr.cmd

3. Changing the extlinux.conf file. Here I need to be able to append rootfs to certain partition(like "APPEND root=mmcblk0p9 ...", without this UUID). What is more I will have to be able to change that from user-space, so that after swupdate the board will boot from the other copy (to achive "dual copy" strategy).

I will be gratefull for any help on that!

2 REPLIES 2
Christophe Guibout
ST Employee

Hello @mmichala,

 

I'am not sure to get your point, but, according to my understanding, "dual copy" involves 2 bootfs partitions (A and B for example), and 2 rootfs partitions, so when you create these partitions, you have to set 2 differents UUID (more details related to UUID in the wiki).

After having flashed the new image and before rebooting to this new image, you need to update the PARTUUID number of the new rootfs partition from new extlinux.conf stored in new flashed bootfs partition.

 

Moreover, the recommanded way to implement OTA on STM32MP is to use metadata partition, so that fip partition (which includes op-tee and u-boot) can also be part of OTA update (see wiki link).

 

BR,

Christophe

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

 

Hello @Christophe Guibout ,
thank you for you answer. You are right about "dual copy" strategy, that it should include two copies of bootfs as well. Still, to achive that, I will have to know how to complete tasks 1-3. listed in my orginal post.
Today I managed to change configuration (for tests I changed the CONFIG_BOOTDELAY value) using u-boot-stm32mp_%.bbappend file and patch file that changes that value in tmp/work-shared/stm32mp1/uboot-source/configs/stm32mp13_defconfig. It worked, but that's all I have managed to achive.

I would like to switch to the recommanded way of implementing OTA using metdata partitions (Secure Firmware Update), and I have read the wiki you pointed. Still, is there any more detailed tutorial how to implement that OTA mechanism? For me this wiki gives more like a concept, but implementing it for person without experience (and without any help from more experienced developers) seems to be hard.