cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP25F7-EV1 boot loop after flashing OpenSTDroid Distribution

ozi
Associate II
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
1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

7 REPLIES 7
Nicolas L
ST Employee

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

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.

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

Thanks Nicolas. I ran build_kernel --verbose=2 defaultconfig. There are still quite a few differences between my new config file and your expected config file. I attached updated config file.

Here's what my mergeconfig.log says

./scripts/kconfig/merge_config.sh: 82: [[: not found
The base file 'CONFIG_LSM' does not exist.  Exit.

 

Here's the output of build_kernel mrproper && build_kernel --verbose=2 defaultconfig

  [1/2]: Generate .config for stm32mp2
make: Entering directory '/home/ozi/Workspace_STM32/OpenSTDroid/Distribution/device/stm/stm32mp2-kernel/linux-stm32mp2'
make[1]: Entering directory '/home/ozi/Workspace_STM32/OpenSTDroid/Distribution/out-bsp/stm32mp2/KERNEL_OBJ'
  GEN     Makefile
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
make[1]: Leaving directory '/home/ozi/Workspace_STM32/OpenSTDroid/Distribution/out-bsp/stm32mp2/KERNEL_OBJ'
make: Leaving directory '/home/ozi/Workspace_STM32/OpenSTDroid/Distribution/device/stm/stm32mp2-kernel/linux-stm32mp2'
  => mergeconfig logs added in /home/ozi/Workspace_STM32/OpenSTDroid/Distribution/out-bsp/stm32mp2/KERNEL_OBJ/mergeconfig.log
  [2/2]: Generate corresponding defconfig.default for stm32mp2
make: Entering directory '/home/ozi/Workspace_STM32/OpenSTDroid/Distribution/device/stm/stm32mp2-kernel/linux-stm32mp2'
make[1]: Entering directory '/home/ozi/Workspace_STM32/OpenSTDroid/Distribution/out-bsp/stm32mp2/KERNEL_OBJ'
  GEN     Makefile
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTLD  scripts/kconfig/conf
make[1]: Leaving directory '/home/ozi/Workspace_STM32/OpenSTDroid/Distribution/out-bsp/stm32mp2/KERNEL_OBJ'
make: Leaving directory '/home/ozi/Workspace_STM32/OpenSTDroid/Distribution/device/stm/stm32mp2-kernel/linux-stm32mp2'
ozi
Associate II

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.

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

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