Skip to main content
Explorer II
May 5, 2025
Solved

STM32MP25F7-EV1 boot loop after flashing OpenSTDroid Distribution

  • May 5, 2025
  • 2 replies
  • 1341 views
I figured out how to build and integrate the Android kernel with my updated drivers. Unfortunately, my eval kit hangs at the ST splash screen before restarting after flashing my device. 
 
I run the "flash-device" command mentioned in the wiki: How to populate boards for Android - stm32mpu without any errors.
 
I attached a serial UART log from boot. The system hangs and reboots after the following lines:
 
Starting kernel ...

I/TC: Secondary CPU 1 initializing
I/TC: Secondary CPU 1 switching to normal world boot
 
Any advice? Thanks
    This topic has been closed for replies.
    Best answer by Nicolas L

    Hi

     

    Your .config is not correct. One possible reason is that you have a problem during the mergeconfig treatment.

    Can you execute the command : build_kernel --verbose=2 defaultconfig

     

    Attached, the expected .config file when all is performed correctly. CONFIG_ARCH_STM32 shall not be added manually but performed thanks to this mergeconfig steps.

     

    Regards

    Nicolas

    2 replies

    ST Employee
    May 6, 2025

    Hi

     

    Here, it's first recommended to build once the original kernel, executing:

    1- load_kernel

    2- build_kernel

     

    See for more details the wiki page on kernel build : https://wiki.st.com/stm32mpu/wiki/How_to_build_kernel_for_Android

     

    Then to build an additional driver as module, you have two cases :

     

    1- case with an driver integrated in the kernel sources

     

    Here you have to enable it in your .config using "build_kernel menuconfig". It's recommended to set it as a module (M).

    See for more details the wiki page on customization : https://wiki.st.com/stm32mpu/wiki/How_to_customize_Linux_kernel_for_Android

     

    Then rebuild with install option (build_kernel -i).

     

    2- case with an external driver (not in the kernel source).

     

    You have to build your driver in association with the built kernel.

    You have first to check what are the parameters expected to build your driver. In general, you have to find a parameter for the architecture (ARCH for example) and on to give the path to the kernel build artefacts (KERNEL_DIR for example).

     

    make -C <path to your driver source> O=<realpath to out-bsp/stm32mp2/KERNEL_OBJ> LLVM=1 LLVM_IAS=1 CROSS_COMPILE=aarch64-none-linux-gnu- KERNEL_DIR=<realpath to out-bsp/stm32mp2/KERNEL_OBJ> ARCH=arm64

     

    Then you have to copy the build module (.ko) file in the prebuilt directory (device/stm/stm32mp2-kernel/prebuilt/modules/).

     

    Whatever the option to build your driver :

    First you have to integrate your module installation in the init.stm.sh script (in the directory "device/stm/stm32mp2/eval/".

    Then you have to rebuild your distribution from the root path : make

    And reflash all associated partitions (if you have a doubt, reflash all, using provision-device script).

     

    See for more details the wiki page on flashing :

    https://wiki.st.com/stm32mpu/wiki/How_to_populate_boards_for_Android

     

    It's important to notice that the original kernel has not been changed except potentially adding your driver if included in the kernel sources. In case, can you share your .config file for the kernel (in out-bsp/stm32mp2/KERNEL_OBJ/ directory) ?

    Additionally, if you have more information concerning the driver you have to add in the build ?

     

    Regards

    Nicolas

    oziAuthor
    Explorer II
    May 7, 2025

    Thanks @Nicolas L  I'm trying to enable the Bluetooth USB driver right now (btusb.ko). Eventually, I want to enable the Silicon Labs SiWT917 BLE/WIFI module.

    I reloaded and re-built the kernel without any extra drivers. I did need to run build menuconfig and set CONFIG_ARCH_STM32=y, otherwise my system failed at the dtbs step in the build_kernel script.

    1. load_kernel -f

    2. build_kernel mrproper

    3. build_kernel menuconfig, enabled CONFIG_ARCH_STM32=y

    4. build_kernel

    5. build_kernel -i

    6. make -j$(nproc) in directory root.

    7. flash-device

    Unfortunately, I still get the reboot loop. I attached my .config file.

    Nicolas LAnswer
    ST Employee
    May 12, 2025

    Hi

     

    Your .config is not correct. One possible reason is that you have a problem during the mergeconfig treatment.

    Can you execute the command : build_kernel --verbose=2 defaultconfig

     

    Attached, the expected .config file when all is performed correctly. CONFIG_ARCH_STM32 shall not be added manually but performed thanks to this mergeconfig steps.

     

    Regards

    Nicolas

    oziAuthor
    Explorer II
    May 12, 2025

    Thanks for all your help Nicolas! I used your config_exp.txt file as my .config and I can successfully flash my device! I will try adding a custom driver now.

    Do you know why the build_kernel couldn't merge the config file properly? I followed all the steps, even used the defaultconfig argument. I even re-downloaded the AOSP.

    ST Employee
    May 12, 2025

    Hi

     

    It shall be understood but considering the error, it's may be an error linked to the shell used.

     

    Just to confirm, can you try to replace in the file device/stm/stm32mp2-kernel/linux-stm32mp2/scripts/kconfig/merge_config.sh :

     

    #!/bin/sh

     

    by

     

    #!/bin/bash

     

    And then try again the command : build_kernel --verbose=2 defaultconfig

     

    Regards

    Nicolas

    oziAuthor
    Explorer II
    May 12, 2025

    That fixed it. .config is now identical to your config_exp.txt.