2024-11-14 02:26 AM
Hello everyone,
I am trying to migrate a project for the STM32MP151C from dunfell to kirkstone.
The versions of the main components I am using are the following:
Component | Version |
tf-a-stm32mp | v2.6-stm32mp-r2.2 |
optee-os-stm32mp | v3.16.0-stm32mp-r2.2 |
u-boot-stm32mp | v2021.10-stm32mp-r2.2 |
linux-stm32mp | v5.15.145-stm32mp-r2.2 |
The project intends to have a custom u-boot environment. For this a patch is applied to modify CONFIG_EXTRA_ENV_SETTINGS in stm32mp15_common.h, like this:
#define FOO_USBFLASH_BOOTFS "foo_usbflash_bootfs=" \
"load usb 0:1 ${loadaddr} foo-image-bootfs-foo-core-stm32mp151c-foo.ext4;" \
"mmc write ${loadaddr} 2400 20000;" \
"mmc write ${loadaddr} 22400 20000;\0"
#define CONFIG_EXTRA_ENV_SETTINGS \
STM32MP_MEM_LAYOUT \
STM32MP_BOOTCMD \
STM32MP_PARTS_DEFAULT \
BOOTENV \
FOO_USBFLASH_BOOTFS \
STM32MP_EXTRA \
STM32MP_BOARD_EXTRA_ENV
This approach worked perfectly fine in the old version of the project, but now when the system boots into u-boot I see that the custom u-boot environment is not present anymore.
I use the following flashlayout:
#Opt Id Name Type IP Offset Binary
- 0x01 fsbl-boot Binary none 0x0 arm-trusted-firmware/tf-a-stm32mp151c-foo-uart.stm32
- 0x03 fip-boot FIP none 0x0 fip/fip-stm32mp151c-foo-optee.bin
P 0x04 fsbl Binary mmc0 boot1 arm-trusted-firmware/tf-a-stm32mp151c-foo-emmc.stm32
P 0x05 fsbl2 Binary mmc0 boot2 arm-trusted-firmware/tf-a-stm32mp151c-foo-emmc.stm32
P 0x06 metadata1 Binary mmc0 0x00080000 arm-trusted-firmware/metadata.bin
P 0x07 metadata2 Binary mmc0 0x00100000 arm-trusted-firmware/metadata.bin
P 0x08 fip-a FIP mmc0 0x00180000 fip/fip-stm32mp151c-foo-optee.bin
P 0x09 fip-b FIP mmc0 0x00580000 fip/fip-stm32mp151c-foo-optee.bin
PED 0x0A u-boot-env Binary mmc0 0x00980000 none
P 0x10 boot1 System mmc0 0x00A00000 pseudo.ext4
P 0x11 boot2 System mmc0 0x04A00000 pseudo.ext4
P 0x12 super1 FileSystem mmc0 0x08A00000 pseudo.ext4
P 0x13 super2 FileSystem mmc0 0x66600000 pseudo.ext4
P 0x14 data FileSystem mmc0 0xC4200000 pseudo.ext4
What additional settings are needed for my custom u-boot environment to work?
Solved! Go to Solution.
2024-11-25 01:02 AM
I managed to figure this out myself.
So the goal was to have a compiled-in (default) u-boot environment.
It was a combination of two things:
1. Modification of CONFIG_EXTRA_ENV_SETTINGS
Apparently in the kirkstone version there are two header files where CONFIG_EXTRA_ENV_SETTINGS is defined:
Whereby in stm32mp15_st_common.h the following can be found:
#ifdef CONFIG_EXTRA_ENV_SETTINGS
//...
#undef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS
I don't get what the purpose is to undefine CONFIG_EXTRA_ENV_SETTINGS here, but the result is that the extra environment variables have to be put into
to take effect.
2. Configuration flags CONFIG_ENV_IN_*
There are multiple configuration flags in stm32mp15_defconfig which relate to where u-boot shall search for the environment. By default all of them are enabled:
To only have the compiled-in (default) environment I applied a patch like this:
CONFIG_ENV_IS_NOWHERE=y
-CONFIG_ENV_IS_IN_MMC=y
-CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_IS_IN_UBI=y
+CONFIG_ENV_IS_IN_MMC=n
+CONFIG_ENV_IS_IN_SPI_FLASH=n
+CONFIG_ENV_IS_IN_UBI=n
Note: This should also be changed in stm32mp15_trusted_defconfig
2024-11-25 01:02 AM
I managed to figure this out myself.
So the goal was to have a compiled-in (default) u-boot environment.
It was a combination of two things:
1. Modification of CONFIG_EXTRA_ENV_SETTINGS
Apparently in the kirkstone version there are two header files where CONFIG_EXTRA_ENV_SETTINGS is defined:
Whereby in stm32mp15_st_common.h the following can be found:
#ifdef CONFIG_EXTRA_ENV_SETTINGS
//...
#undef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS
I don't get what the purpose is to undefine CONFIG_EXTRA_ENV_SETTINGS here, but the result is that the extra environment variables have to be put into
to take effect.
2. Configuration flags CONFIG_ENV_IN_*
There are multiple configuration flags in stm32mp15_defconfig which relate to where u-boot shall search for the environment. By default all of them are enabled:
To only have the compiled-in (default) environment I applied a patch like this:
CONFIG_ENV_IS_NOWHERE=y
-CONFIG_ENV_IS_IN_MMC=y
-CONFIG_ENV_IS_IN_SPI_FLASH=y
-CONFIG_ENV_IS_IN_UBI=y
+CONFIG_ENV_IS_IN_MMC=n
+CONFIG_ENV_IS_IN_SPI_FLASH=n
+CONFIG_ENV_IS_IN_UBI=n
Note: This should also be changed in stm32mp15_trusted_defconfig