cancel
Showing results for 
Search instead for 
Did you mean: 

Booting linux kernel with different device tree?

albertr
Associate III

So it looks like Uboot supports /boot/extlinux/extlinux.conf boot menu file on STM32MP157-DK2 board? But does it support FDT entry used to specify device tree file to use? Or I have to rebuild the kernel anytime when I want to make small changes to device tree?

-albertr

1 ACCEPTED SOLUTION

Accepted Solutions

Found the problem - /extlinux/extlinux.conf file had some whitespaces after name of the kernel image file, like:

"KERNEL /uImage "

Doh! It's all good and working after removing these whitespaces ;)

Still not sure why it complies about power adapter, if anyone has any ideas, let me know.

-albertr

View solution in original post

8 REPLIES 8
Olivier GALLIEN
ST Employee

Hi @albertr​ 

No need to rebuild full kernel just for a Device Tree update.

Please refer to https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Developer_Package

Once built, you copy dtb on the target with scp and you can manage to call it by editing /boot/extlinux/extlinux.conf, creating your own boot entry in menu or overidding existing one.

Hope it help,

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
albertr
Associate III

Oliver, thanks! So according to this page FDT is supported, that's what I was looking for, thanks again!

-albertr

Hi @Community member​ 

I have a little problem here... Re-compiled the kernel from the latest 1.2.0 source (2020-02-19), but for some reason having a problem with reading it off SDCARD, please see below:

U-Boot SPL 2018.11-stm32mp-r3 (Oct 10 2019 - 11:26:18 -0400)

Model: STMicroelectronics STM32MP157C-DK2 Discovery Board

RAM: DDR3-1066/888 bin G 1x4Gb 533MHz v1.45

Trying to boot from MMC1

U-Boot 2018.11-stm32mp-r3 (Oct 10 2019 - 11:26:18 -0400)

CPU: STM32MP157CAC Rev.B

Model: STMicroelectronics STM32MP157C-DK2 Discovery Board

Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)

Board: MB1272 Var2 Rev.C-01

DRAM: 512 MiB

Clocks:

- MPU : 650 MHz

- MCU : 208.878 MHz

- AXI : 266.500 MHz

- PER : 24 MHz

- DDR : 533 MHz

****************************************************

*      WARNING 1.5mA power supply detected       *

*    Current too low, use a 3A power supply!     *

****************************************************

NAND: 0 MiB

MMC:  STM32 SDMMC2: 0, STM32 SDMMC2: 1

Loading Environment from EXT4... ** File not found /uboot.env **

** Unable to read "/uboot.env" from mmc0:4 **

In:   serial

Out:  serial

Err:  serial

Net:  eth0: ethernet@5800a000

Hit any key to stop autoboot: 0

Boot over mmc0!

Saving Environment to EXT4... File System is consistent

Unsupported feature metadata_csum found, not writing.

** Unable to write "/uboot.env" from mmc0:4 **

Failed (1)

switch to partitions #0, OK

mmc0 is current device

Scanning mmc 0:4...

Found /extlinux/extlinux.conf

Retrieving file: /extlinux/extlinux.conf

1092 bytes read in 1 ms (1 MiB/s)

Select the boot mode

1:     CubeMX

2:     stm32mp157c-dk2-m4-examples-sdcard

3:     stm32mp157c-dk2-sdcard

4:     stm32mp157c-dk2-a7-examples-sdcard

Enter choice: 1:       CubeMX

Retrieving file: /uImage

** File not found /uImage      **

Skipping CubeMX for failure retrieving kernel

2:     stm32mp157c-dk2-m4-examples-sdcard

Retrieving file: /uImage.old

** File not found /uImage.old                                                                       **

Skipping stm32mp157c-dk2-m4-examples-sdcard                                                         for failure retrieving kernel

3:     stm32mp157c-dk2-sdcard

Retrieving file: /uImage.old

6598512 bytes read in 287 ms (21.9 MiB/s)

append: root=/dev/mmcblk0p6 rootwait rw console=ttySTM0,115200 console=tty0 fbcon=rotate:3

Retrieving file: /stm32mp157c-dk2.dtb

68852 bytes read in 4 ms (16.4 MiB/s)

## Booting kernel from Legacy Image at c2000000 ...

Not sure what is going on here, the boot partition has bootfs label and is formatted as EXT4 as you can see below:

root@stm32mp1:~# ls -la /dev/disk/by-partlabel | grep boot

lrwxrwxrwx 1 root root 15 Feb 29 22:45 bootfs -> ../../mmcblk0p4

root@stm32mp1:~# mount | grep boot

/dev/mmcblk0p4 on /boot type ext4 (rw,noatime,sync)

Here's the list of files there:

root@stm32mp1:~# ls -la /boot

total 13162

drwxr-xr-x 4 root root   1024 Feb 29 20:29 .

drwxr-xr-x 20 root root   4096 Feb 29 10:45 ..

drwxr-xr-x 2 root root   1024 Nov 20 11:34 extlinux

drwx------ 2 root root  12288 Oct 8 20:24 lost+found

-rw-rw-r-- 1 root root  68900 Nov 22 17:11 stm32mp157c-dk2-a7-examples.dtb

-rw-r--r-- 1 root root  69558 Mar 9 2018 stm32mp157c-dk2-a7-examples.dtb.old

-rw-r--r-- 1 root root  77256 Feb 29 18:50 stm32mp157c-dk2-cubemx.dtb

-rw-r--r-- 1 root root  33472 Feb 29 17:46 stm32mp157c-dk2-cubemx.dts

-rw-r--r-- 1 root root 101035 Feb 29 18:58 stm32mp157c-dk2-cubemx.dtsi

-rw-rw-r-- 1 root root  69823 Nov 22 17:11 stm32mp157c-dk2-m4-examples.dtb

-rw-r--r-- 1 root root  70485 Mar 9 2018 stm32mp157c-dk2-m4-examples.dtb.old

-rw-rw-r-- 1 root root  68852 Nov 22 17:11 stm32mp157c-dk2.dtb

-rw-r--r-- 1 root root  69510 Mar 9 2018 stm32mp157c-dk2.dtb.old

-rw-rw-r-- 1 root root 6227256 Feb 29 14:29 uImage

-rw-rw-r-- 1 root root 6598512 Nov 22 17:00 uImage.old

and here's the content of /boot/extlinux/extlinux.conf menu file:

root@stm32mp1:~# cat /boot/extlinux/extlinux.conf

# Generic Distro Configuration file generated by OpenEmbedded

menu title Select the boot mode

TIMEOUT 5

DEFAULT CubeMX

LABEL CubeMX

       KERNEL /uImage     

       FDT /stm32mp157c-dk2-cubemx.dtb

       APPEND root=/dev/mmcblk0p6 rootwait rw console=ttySTM0,115200 console=tty0 fbcon=rotate:3

LABEL stm32mp157c-dk2-m4-examples-sdcard                                                        

       KERNEL /uImage.old                                                                      

       FDT /stm32mp157c-dk2-m4-examples.dtb                                                    

       APPEND root=/dev/mmcblk0p6 rootwait rw console=ttySTM0,115200 console=tty0 fbcon=rotate:3

LABEL stm32mp157c-dk2-sdcard

       KERNEL /uImage.old

       FDT /stm32mp157c-dk2.dtb

       APPEND root=/dev/mmcblk0p6 rootwait rw console=ttySTM0,115200 console=tty0 fbcon=rotate:3

LABEL stm32mp157c-dk2-a7-examples-sdcard

       KERNEL /uImage.old

       FDT /stm32mp157c-dk2-a7-examples.dtb

       APPEND root=/dev/mmcblk0p6 rootwait rw console=ttySTM0,115200 console=tty0 fbcon=rotate:3

Any ideas?

-albertr

So I have updated u-boot to the latest patched version from 1.2.0 software release (2020-02-19) and disabled metadata_csum on bootfs filesystem, but it's still not finding the kernel file.

I'm also not user what "WARNING 1.5mA power supply detected" means, since I'm using a good quality 10A USB-C power supply. However, I do have a little 3V coin battery attached for backup RTC time, does it measure its power supply?

U-Boot SPL 2018.11-stm32mp-r4 (Feb 29 2020 - 23:11:25 -0500)

Model: STMicroelectronics STM32MP157C-DK2 Discovery Board

RAM: DDR3-1066/888 bin G 1x4Gb 533MHz v1.45

Trying to boot from MMC1

U-Boot 2018.11-stm32mp-r4 (Feb 29 2020 - 23:11:25 -0500)

CPU: STM32MP157CAC Rev.B

Model: STMicroelectronics STM32MP157C-DK2 Discovery Board

Board: stm32mp1 in basic mode (st,stm32mp157c-dk2)

Board: MB1272 Var2 Rev.C-01

DRAM: 512 MiB

Clocks:

- MPU : 650 MHz

- MCU : 208.878 MHz

- AXI : 266.500 MHz

- PER : 24 MHz

- DDR : 533 MHz

****************************************************

*      WARNING 1.5mA power supply detected       *

*    Current too low, use a 3A power supply!     *

****************************************************

NAND: 0 MiB

MMC:  STM32 SDMMC2: 0, STM32 SDMMC2: 1

Loading Environment from EXT4... ** File not found /uboot.env **

** Unable to read "/uboot.env" from mmc0:4 **

In:   serial

Out:  serial

Err:  serial

Net:  eth0: ethernet@5800a000

Hit any key to stop autoboot: 0

Boot over mmc0!

Saving Environment to EXT4... File System is consistent

update journal finished

done

OK

switch to partitions #0, OK

mmc0 is current device

Scanning mmc 0:4...

Found /extlinux/extlinux.conf

Retrieving file: /extlinux/extlinux.conf

1092 bytes read in 1 ms (1 MiB/s)

Select the boot mode

1:     CubeMX

2:     stm32mp157c-dk2-m4-examples-sdcard                                                        

3:     stm32mp157c-dk2-sdcard

4:     stm32mp157c-dk2-a7-examples-sdcard

Enter choice: 1:       CubeMX

Retrieving file: /uImage     

** File not found /uImage      **

Skipping CubeMX for failure retrieving kernel

2:     stm32mp157c-dk2-m4-examples-sdcard                                                        

Retrieving file: /uImage.old                                                                      

** File not found /uImage.old                                                                       **

Skipping stm32mp157c-dk2-m4-examples-sdcard                                                         for failure retrieving kernel

3:     stm32mp157c-dk2-sdcard

Retrieving file: /uImage.old

6598512 bytes read in 289 ms (21.8 MiB/s)

append: root=/dev/mmcblk0p6 rootwait rw console=ttySTM0,115200 console=tty0 fbcon=rotate:3

Retrieving file: /stm32mp157c-dk2.dtb

68852 bytes read in 4 ms (16.4 MiB/s)

## Booting kernel from Legacy Image at c2000000 ...

  Image Name:  Linux-4.19.49

  Created:     2019-11-22 21:41:22 UTC

  Image Type:  ARM Linux Kernel Image (uncompressed)

  Data Size:   6598448 Bytes = 6.3 MiB

  Load Address: c2000040

  Entry Point: c2000040

  Verifying Checksum ... OK

## Flattened Device Tree blob at c4000000

  Booting using the fdt blob at 0xc4000000

  XIP Kernel Image ... OK

  Using Device Tree in place at c4000000, end c4013cf3

Starting kernel ...

-albertr

Found the problem - /extlinux/extlinux.conf file had some whitespaces after name of the kernel image file, like:

"KERNEL /uImage "

Doh! It's all good and working after removing these whitespaces ;)

Still not sure why it complies about power adapter, if anyone has any ideas, let me know.

-albertr

HEl m.1
Associate

Hello !

I'm trying to boot an STM32MP157a-dk1 using an image that i made with build-root but when i boot i got this message :

Unable to write "/uboot.env" from mmc0:4 0693W00000AP51iQAD.png

About the message related to power supply, uBoot is reading the level present on USB Type-C CC1/CC2 lines and check if supply is signaling it self as a 5V/3A (as per USB Type-C standard). There is plenty of charger which are not compliant to the standard (see TA0357 page 8), but if your supply is stated as above 3A, you could ignore the message (could be also removed in uBoot code if you wish).

Btw, with your uBoot version (2018.11), it seems that you are using Ecosystem v1.x, I encourage you to move to latest ecosystem v3.x (https://wiki.st.com/stm32mpu/wiki/Main_Page).

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello!

change buildroot/configs/stm32mp157a_dk1_defconfig file

BR2_TARGET_ROOTFS_EXT2_MKFS_OPTIONS="-O ^metadata_csum"