2025-03-24 6:47 AM
Hi everyone,
I'm attempting to optimize the boot process on my STM32MP157F-DK2 board by removing U-Boot and booting the Linux kernel directly via the FIP. I've followed the documented steps for STM32MP1:
TF-A BL2 Modifications:
Updated STM32MP_BL33_BASE and STM32MP_BL33_MAX_SIZE in the STM32MP1 header file.
Increased the SDMMC timeout in stm32_sdmmc2.c to accommodate the larger kernel image.
FIP Creation:
Recompiled TF-A with my modifications.
Created a new FIP where I replaced the U-Boot binary and its DTB with my Linux kernel Image and DTB.
The new FIP (fip.bin) now contains the kernel and DTB.
Flash Layout TSV Modifications:
I updated the TSV file to allocate a larger space for the FIP. Below is the relevant excerpt:
Despite these modifications, every time I execute the process, it fails. My questions are:
What is the purpose of the bootfs partition?
Since my new FIP (fip.bin) already contains the Linux kernel and its DTB, I'm unclear why the flash layout still reserves a bootfs partition. Is it meant for additional boot configurations, an initial ramdisk, or something else?
Why is the u-boot-env partition still present?
If U-Boot is being removed entirely from the boot chain, what role does the U-Boot environment play here? Is it kept for legacy or recovery purposes?
I would really appreciate any insights or suggestions on what might be going wrong or what additional changes I need to consider for a successful direct kernel boot setup on STM32MP157f-dk2.
Thanks in advance for your help!
Solved! Go to Solution.
2025-04-28 8:32 AM
Hello @HZ890 ,
I am really sorry, I was preempted on other activities and I forgot your fip commentary.
I just took a look at it, and something surprised me. By looking at the content with fiptool info command (using SDK), I see this:
fiptool info ./fip-stm32mp157f-dk2-optee-sdcard.bin
Non-Trusted Firmware BL33: offset=0xB0, size=0x15555CC, cmdline="--nt-fw"
FW_CONFIG: offset=0x155567C, size=0x1EA, cmdline="--fw-config"
HW_CONFIG: offset=0x1555866, size=0x20E3F, cmdline="--hw-config"
In a "normal" binary FIP, you have this:
fiptool info fip-stm32mp157f-dk2-optee-sdcard.bin
Secure Payload BL32 (Trusted OS): offset=0x128, size=0x2C, cmdline="--tos-fw"
Secure Payload BL32 Extra1 (Trusted OS Extra1): offset=0x154, size=0x10B48, cmdline="--tos-fw-extra1"
Secure Payload BL32 Extra2 (Trusted OS Extra2): offset=0x10C9C, size=0x72000, cmdline="--tos-fw-extra2"
Non-Trusted Firmware BL33: offset=0x82C9C, size=0x11E500, cmdline="--nt-fw"
FW_CONFIG: offset=0x1A119C, size=0x1EA, cmdline="--fw-config"
HW_CONFIG: offset=0x1A1386, size=0x21600, cmdline="--hw-config"
In fact, I well see your new BL33 (originally U-Boot, now the Linux kernel in your setup). The size looks coherent with a Linux Image.
I well see the U-Boot Linux DTB, that's ok.
I also see the FW config DTB.
What is missing is the OP-TEE part in fact. OP-TEE is mandatory to boot, and it is possible that TF-A raises an issue by knowing that OP-TEE must be present.
There are 2 possibilities, either you created a FIP from scratch and forgot to compile and put OP-TEE inside, or you deleted silently OP-TEE from your FIP. In the context of the wiki article, we start from the original starter FIP binary, and update only the parts that change.
Can you please try to add the missing part and ping me back ?
Kind regards,
Erwan.
(cf: https://wiki.st.com/stm32mpu/wiki/How_to_configure_TF-A_FIP for MP1)
2025-03-28 4:00 AM
Hello @HZ890 ,
Can you please precise a bit the status when you says "everytime I execute the process it fails" ? Do you talk at boot time or during the preparation process ?
Do you have some error logs or anything to share ?
Kind regards,
Erwan.
2025-04-08 5:54 AM
Dear Erwan SZYMANSKI,
I received the following error during the boot time process:
If you have any pointers or an example with those platforms, it would be much appreciated.
Best Regards,
Hassan
2025-04-15 7:48 AM - edited 2025-04-16 4:09 AM
Hello @HZ890 ,
First, concerning the mention of bootfs partition and u-boot-env are no more needed in this setup, the article just wanted to make a parallel with the default components / flashlayout, but you are right I will remove it in the next version of the article.
Then concerning your image load error, can you activate more TF-A debug logs and give an attachment of all the bootlogs ?
Kind regards,
Erwan.
2025-04-16 2:53 AM
Hi Erwan,
I wanted to update you on my progress with the STM32MP157F boot sequence. I've removed U-Boot from the boot sequence and configured the system to boot directly into Linux, as suggested in the guide https://wiki.st.com/stm32mpu/wiki/How_to_optimize_the_boot_time#Optimizing_boot-time_by_removing_U-Boot .
Here are the steps I followed:
TF-A Configuration:
Updated the configuration for STM32MP_BL33_BASE and STM32MP_BL33_MAX_SIZE:
SD Card Timeout Modification:
Changed the SD card timeout in <tf-a_sources>/drivers/st/mmc/stm32_sdmmc2.c:
TF-A Build Process:
Extracted TF-A and applied patches:
The TF-A output files were:
tf-a-stm32mp157f-dk2-optee-sdcard.stm32
stm32mp157f-dk2-fw-config-optee-sdcard.dtb
Kernel Configuration:
$> export OUTPUT_BUILD_DIR=$PWD/../build
$> mkdir -p ${OUTPUT_BUILD_DIR}
$> make O="${OUTPUT_BUILD_DIR}" defconfig fragment*.config
If there are some fragments, apply them
* manually one by one:
$ scripts/kconfig/merge_config.sh -m -r -O ${OUTPUT_BUILD_DIR} ${OUTPUT_BUILD_DIR}/.config ../fragment-01-xxx.config
$ scripts/kconfig/merge_config.sh -m -r -O ${OUTPUT_BUILD_DIR} ${OUTPUT_BUILD_DIR}/.config ../fragment-02-xxx.config
...
$ (yes '' || true) | make oldconfig O="${OUTPUT_BUILD_DIR}"
Used make menuconfig to configure the kernel command line:
(root=PARTUUID=e91c4e10-16e6-4c0e-bd0e-77becf4a3582 rootwait rw earlyprintk earlycon console=ttySTM0,115200)
Selected: Kernel command line type (Always use the default kernel command string)
Built the kernel:
This resulted in the output files:
Image
stm32mp157f-dk2.dtb
FIP Tool Update:
Used fiptool to update the binary files:
The result was the new FIP file: fip-stm32mp157f-dk2-optee-sdcard.bin
Flash Layout Modification:
Modified the tsv file to include the new TF-A and FIP files:
Flashing the Board:
Connected the board using a USB Type-A to Type-C cable for data and a 5V 3A power adapter.
Used the command:
Then powered off the board, switched the boot mode to ON, and powered it on.
Boot Log Output:
Upon powering the board, I received the following output:
Could you please take a look and let me know if I missed anything in the setup or if there is something else that could be causing this issue?
Looking forward to your guidance.
Kind regards,
Hassan
2025-04-18 6:24 AM
Hello @HZ890 ,
Is it possible for you to attach your fip here ? It seems there is something wrong in the FIP content.
Kind regards,
Erwan.
2025-04-18 6:46 AM
2025-04-27 12:10 AM
Hello Erwan,
Kindly let me know if there are any updates or if you need anything further.
Looking forward to your feedback.
Kind regards,
Hassan
2025-04-28 8:32 AM
Hello @HZ890 ,
I am really sorry, I was preempted on other activities and I forgot your fip commentary.
I just took a look at it, and something surprised me. By looking at the content with fiptool info command (using SDK), I see this:
fiptool info ./fip-stm32mp157f-dk2-optee-sdcard.bin
Non-Trusted Firmware BL33: offset=0xB0, size=0x15555CC, cmdline="--nt-fw"
FW_CONFIG: offset=0x155567C, size=0x1EA, cmdline="--fw-config"
HW_CONFIG: offset=0x1555866, size=0x20E3F, cmdline="--hw-config"
In a "normal" binary FIP, you have this:
fiptool info fip-stm32mp157f-dk2-optee-sdcard.bin
Secure Payload BL32 (Trusted OS): offset=0x128, size=0x2C, cmdline="--tos-fw"
Secure Payload BL32 Extra1 (Trusted OS Extra1): offset=0x154, size=0x10B48, cmdline="--tos-fw-extra1"
Secure Payload BL32 Extra2 (Trusted OS Extra2): offset=0x10C9C, size=0x72000, cmdline="--tos-fw-extra2"
Non-Trusted Firmware BL33: offset=0x82C9C, size=0x11E500, cmdline="--nt-fw"
FW_CONFIG: offset=0x1A119C, size=0x1EA, cmdline="--fw-config"
HW_CONFIG: offset=0x1A1386, size=0x21600, cmdline="--hw-config"
In fact, I well see your new BL33 (originally U-Boot, now the Linux kernel in your setup). The size looks coherent with a Linux Image.
I well see the U-Boot Linux DTB, that's ok.
I also see the FW config DTB.
What is missing is the OP-TEE part in fact. OP-TEE is mandatory to boot, and it is possible that TF-A raises an issue by knowing that OP-TEE must be present.
There are 2 possibilities, either you created a FIP from scratch and forgot to compile and put OP-TEE inside, or you deleted silently OP-TEE from your FIP. In the context of the wiki article, we start from the original starter FIP binary, and update only the parts that change.
Can you please try to add the missing part and ping me back ?
Kind regards,
Erwan.
(cf: https://wiki.st.com/stm32mpu/wiki/How_to_configure_TF-A_FIP for MP1)
2025-04-29 1:10 AM
Hello Erwan,
Thank you so much for your detailed analysis and for taking the time to highlight the missing OP-TEE component.
You were absolutely right — the OP-TEE binaries were indeed missing from my custom FIP. After updating the FIP accordingly, everything worked correctly.
I truly appreciate your guidance and effort. It helped me resolve the issue efficiently.
Kind regards,
Hassan