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!
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