Device tree building for custom board

I must be doing something wrong here, but i cant seem to find the issue.
I try to recreate a custom device tree however to get things working i first want to be able to use the the default ones and have them working so i can compare.

Im using the step by step way of custom OS creation with the following commands:

mkdir -p ~/tcbdir/ && cd ~/tcbdir/
wget https://raw.githubusercontent.com/toradex/tcb-env-setup/master/tcb-env-setup.sh
source tcb-env-setup.sh
wget https://docs.toradex.com/108979-docker-compose-example-arm64.yml
mv 108979-docker-compose-example-arm64.yml docker-compose.yml
torizoncore-builder bundle --platform=linux/arm64 docker-compose.yml --bundle-directory bundle 
torizoncore-builder images download --remote-host 192.168.1.96 --remote-username torizon --remote-password torizon123  
git clone https://github.com/toradex/device-trees.git
torizoncore-builder dt apply device-trees/dts-arm64/imx8mp-verdin-wifi-dev.dts
torizoncore-builder union custom-branch
torizoncore-builder deploy custom-branch --output-directory torizon-core-docker-verdin-imx8mp-Tezi_6.4.0+build.5.CUSTOM
torizoncore-builder combine torizon-core-docker-verdin-imx8mp-Tezi_6.4.0+build.5.CUSTOM/ --bundle-directory bundle torizon-core-docker-verdin-imx8mp-Tezi_6.4.0+build.5.CUSTOM-WITH-CONTAINERS/
torizoncore-builder deploy custom-branch --remote-host 192.168.1.96 --remote-username torizon --remote-password torizon123 --reboot

Using the above commands results into a non booting OS with the following output on console (after some times it reverts to its known good state):

U-Boot SPL 2020.04-5.7.2+git.33bb8e968332 (Jan 01 1970 - 00:00:00 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
Training FAILED
Quad die, dual rank failed, attempting dual die, single rank configuration.
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from BOOTROM
Find FIT header 0x4803a600, size 969
Need continue download 1024
Download 840704, total fit 842192
NOTICE:  BL31: v2.2(release):toradex_imx_5.4.70_2.3.0-g2fa8c6349e
NOTICE:  BL31: Built : 00:00:00, Jan  1 1970


U-Boot 2020.04-5.7.2+git.33bb8e968332 (Jan 01 1970 - 00:00:00 +0000)

CPU:   i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 39C
Reset cause: POR
DRAM:  4 GiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Model: Toradex Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT V1.1A, Serial# 15036630
get_tdx_eeprom: cannot find EEPROM by node
MISSING TORADEX CARRIER CONFIG BLOCKS
get_tdx_eeprom: cannot find EEPROM by node

 BuildInfo:
  - ATF 2fa8c63
  - U-Boot 2020.04-5.7.2+git.33bb8e968332

flash target is MMC:2
Net:   eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME]
Fastboot: Normal
Saving Environment to MMC... Writing to MMC(2)... OK
Normal Boot
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc2(part 0) is current device
Scanning mmc 2:1...
Found U-Boot script /boot.scr
973 bytes read in 6 ms (158.2 KiB/s)
## Executing script at 47000000
5243 bytes read in 11 ms (464.8 KiB/s)
82603 bytes read in 15 ms (5.3 MiB/s)
14 bytes read in 13 ms (1000 Bytes/s)
12197548 bytes read in 50 ms (232.6 MiB/s)
Uncompressed size: 30724608 = 0x1D4D200
9311633 bytes read in 41 ms (216.6 MiB/s)
## Flattened Device Tree blob at 44000000
   Booting using the fdt blob at 0x44000000
   Loading Device Tree to 00000000fdbbc000, end 00000000fdbf3fff ... OK

Starting kernel ...

switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
unable to select a mode
device_remove: Device 'mmc@30b60000.blk' failed to remove, but children are gone




U-Boot SPL 2020.04-5.7.2+git.33bb8e968332 (Jan 01 1970 - 00:00:00 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
Training FAILED
Quad die, dual rank failed, attempting dual die, single rank configuration.
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from BOOTROM
Find FIT header 0x4803a600, size 969
Need continue download 1024
Download 840704, total fit 842192
NOTICE:  BL31: v2.2(release):toradex_imx_5.4.70_2.3.0-g2fa8c6349e
NOTICE:  BL31: Built : 00:00:00, Jan  1 1970


U-Boot 2020.04-5.7.2+git.33bb8e968332 (Jan 01 1970 - 00:00:00 +0000)

CPU:   i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 39C
Reset cause: POR
DRAM:  4 GiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Model: Toradex Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT V1.1A, Serial# 15036630
get_tdx_eeprom: cannot find EEPROM by node
MISSING TORADEX CARRIER CONFIG BLOCKS
get_tdx_eeprom: cannot find EEPROM by node

 BuildInfo:
  - ATF 2fa8c63
  - U-Boot 2020.04-5.7.2+git.33bb8e968332

flash target is MMC:2
Net:   eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME]
Fastboot: Normal
Saving Environment to MMC... Writing to MMC(2)... OK
Normal Boot
Warning: Bootlimit (3) exceeded. Using altbootcmd.
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc2(part 0) is current device
Scanning mmc 2:1...
Found U-Boot script /boot.scr
973 bytes read in 6 ms (158.2 KiB/s)
## Executing script at 47000000
Saving Environment to MMC... Writing to MMC(2)... OK
5243 bytes read in 11 ms (464.8 KiB/s)
Rollback enabled. Booting previously deployed version.
88891 bytes read in 14 ms (6.1 MiB/s)
86 bytes read in 12 ms (6.8 KiB/s)
Applying Overlay: verdin-imx8mp_native-hdmi_overlay.dtbo
1860 bytes read in 16 ms (113.3 KiB/s)
Applying Overlay: verdin-imx8mp_lt8912_overlay.dtbo
1987 bytes read in 16 ms (121.1 KiB/s)
12197548 bytes read in 53 ms (219.5 MiB/s)
Uncompressed size: 30724608 = 0x1D4D200
9171560 bytes read in 43 ms (203.4 MiB/s)
## Flattened Device Tree blob at 44000000
   Booting using the fdt blob at 0x44000000
   Loading Device Tree to 00000000fdbba000, end 00000000fdbf2fff ... OK

Starting kernel ...

switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
unable to select a mode
device_remove: Device 'mmc@30b60000.blk' failed to remove, but children are gone

I am using the Verdin Development board V1.1 but most trivial jumpers (I2C to the board eeprom) are disconnected and the setup is wired like the custom board will be wired.

(I triend with torizon 6 and later in 5 thats why no checkout is used since its not present in 6)

Greetings @Lightscape,

I’m a little confused on what version of things you are using here. The logs from your board are showing 5.7.2 but your commands show 6.4.0. These all need to be the same version. If you use mismatching versions this can cause issues like the OS not booting properly.

Could you clarify what versions of things you are using. Specifically what version of the OS you are running on the board and what version of the device trees you are using.

Best Regards,
Jeremias

Well i tried the 6.4 branch first and documented all the steps. After I found out it gave me a non booting kernel i started creating this topic and copy pasted the commands. my apologies for the bad folder names wich caused . i redid the proces but now with

torizoncore-builder deploy custom-branch --output-directory torizon-core-docker-verdin-imx8mp-Tezi_5.7.2+build.20.CUSTOM

torizoncore-builder combine torizon-core-docker-verdin-imx8mp-Tezi_5.7.2+build.20.CUSTOM/ --bundle-directory bundle torizon-core-docker-verdin-imx8mp-Tezi_5.7.2+build.20.CUSTOM-WITH-CONTAINERS/

however with the same result (expected because it was a output directory name only)

if i do all command except the:

torizoncore-builder dt apply device-trees/dts-arm64/imx8mp-verdin-wifi-dev.dts
it seems to boot like normal, also if i use
torizoncore-builder dt checkout
instead of the git clone command and the above command after that the created image also works like intended

so the device tree adaptation seems to be the culprid it seems and has indeed some mismatches, So what are the proper git repos to clone and work with for both 5.7.2 and the 6.4 branches

Currently im running 5.7.2 build 20 on the board but love to update to 6.4, but since the dt checkout isnt working yet i need some repos (containing not only overlays) to clone for the initial device trees

I just did a test and it seems to work fine. Here’s what I did:

  • Flash a Verdin i.MX8M Plus with Torizon 5.7.2:
  • Run the following TorizonCore Builder commands:
$ torizoncore-builder images download --remote-host 192.168.1.28 --remote-username torizon --remote-password root
$ torizoncore-builder dt checkout
$ torizoncore-builder dt apply device-trees/dts-arm64/imx8
$ torizoncore-builder union test
$ torizoncore-builder deploy test --remote-host 192.168.1.28 --remote-username torizon --remote-password root --reboot

With this the device rebooted with the new device tree and I was able to login.

So what are the proper git repos to clone and work with for both 5.7.2 and the 6.4 branches

If you are on 5.7.2 just use the dt checkout command it will checkout the right version of the device trees and overlays. This is assuming you used images download or images unpack to load the correct base image first. So if you’re device is using 5.7.2 make sure the base image the TorizonCore Builder tool is using is also 5.7.2.

If you’re on Torizon 6.X then you need to manually clone the repositories as instructed here: Device Tree Overlays on Torizon | Toradex Developer Center

But your device needs to be running Torizon 6.X first. You can’t just deploy device trees/overlays for 6.X on a device running 5.7.2.

Currently im running 5.7.2 build 20 on the board but love to update to 6.4,

Just to clarify you can’t use the TorizonCore Builder tool to update a device from 5.7.2 to 6.X. The device needs to have been flashed with that version prior to using TorizonCore Builder. You need to make sure the version that TorizonCore Builder is using as it’s base and what the device is running are the same.

Best Regards,
Jeremias

Ok I get that you have to have the 6.4 installed on the SOM in order to have the 6.4 build properly.
I have the 5.7.2 versionworking with the
torizoncore-builder dt checkout

However if i reflash the unit with easyinstaller to 6.4 and run the commands again and clone the linux and device trees you mention:

git clone -b toradex_5.15-2.1.x-imx git://git.toradex.com/linux-toradex.git linux
git clone -b toradex_5.15-2.1.x-imx git://git.toradex.com/device-tree-overlays.git device-trees

followed by the

torizoncore-builder dt apply linux/arch/arm64/boot/dts/freescale/imx8mp-verd
in-wifi-dev.dts

i get asyntax error of a missing pwm file:

torizoncore-builder dt apply linux/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dts
In file included from linux/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dts:8:
linux/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi:6:10: fatal error: dt-bindings/pwm/pwm.h: No such file or directory
    6 | #include "dt-bindings/pwm/pwm.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Ok after some investigation i found the sollution on this

torizoncore-builder dt apply --include-dir linux/include linux/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dts

Glad I was able to clear things up here. Do you have any other issues or questions related to this topic?

Best Regards,
Jeremias