Error booting Toradex Easy Installer from mmcblk0p3

Dear Support Team,

I tried booting Colibri-iMX7_ToradexEasyInstaller_5.4.0+build.4 from partition 3 (mmcblk0p3) of a Colibri imx7d-emmc module and got the following error:

Colibri iMX7 # run bootcmd_tezi
1243 bytes read in 7 ms (172.9 KiB/s)
## Executing script at 87000000
Boot partition needs to be the first partition

The flash of this module has 4 partitions: 1. bootable Linux, 2. bootable Linux, 3. TEZI, 4 non-bootable data
Previously, I had TEZI 1.8 on the 3. partition and could boot it from U-Boot with this set of commands/variables:
bootcmd_tezi=setenv bootm_boot_mode sec; setenv devtype mmc; setenv devnum 0; setenv distro_bootpart 3; setenv bootpart 3 setenv script boot.scr; run boot_a_script
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
scriptaddr=0x87000000

I replaced TEZI 1.8 with TEZI 5.4 on that partition, changed the variables so that script boot-tezi.scr is used. Variables relevant for this script are set as follows:
soc=imx7d
ramdisk_addr_r=0x82100000
variant=-emmc
fdt_board=eval-v3

Is there a change now in TEZI 5.4 that it needs to be on the first partition of the flash? Or am I running into some other error here?

If the former is the case, is there any way to change this behaviour - as I would like to keep my current flash partitioning and allocation of the bootable systems.

Many thanks and best regards.
Otmar Görlitz

Hi @Otmar ,

Thanks for the question.

We got our Linux Team already looking at it. I’ll get back to you as soon as I have news on it.

Best Regards
Kevin

Hi @Otmar

I don’t fully understand where the error message comes from. Can you maybe add the following logs to the thread (in U-Boot):

Colibri iMX7 # env
...
Colibri iMX7 # run bootcmd_tezi
...
Colibri iMX7 # env

Also what is the content of the boot.scr? Can you do a cat on that (it should contain a header followed by text). Please note you need to rename the boot-tzei.scr to boot.scr else it will not find the script.

Regards,
Stefan

Hello Stefan,
I was able to boot TEZI 5.4 from partition 1 and partition 3 successfully after renaming/copying file boot-tezi.scr into boot.scr
Here are my steps:

Colibri iMX7 # setenv bootm_boot_mode sec
Colibri iMX7 # setenv devtype mmc
Colibri iMX7 # setenv devnum 0
Colibri iMX7 # setenv distro_bootpart 3
Colibri iMX7 # setenv bootpart 3
Colibri iMX7 # setenv script boot.scr
Colibri iMX7 # printenv boot_a_script
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
Colibri iMX7 # printenv scriptaddr
scriptaddr=0x87000000
Colibri iMX7 # load mmc 0:3 0x87000000 boot.scr
524 bytes read in 6 ms (85 KiB/s)
Colibri iMX7 # source 0x87000000

Executing script at 87000000

33453256 bytes read in 406 ms (78.6 MiB/s)

Loading kernel from FIT Image at 82100000 …

Using ‘config@imx7d-colibri-emmc-eval-v3.dtb’ configuration
Trying ‘kernel@1’ kernel subimage
Descriptin: Linux kernel
Type: Kernel Image
Compression: uncompressed
Data Start: 0x82100108
Data Size: 6980096 Bytes = 6.7 MiB
Architecture: ARM
OS: Linux
Load Address: 0x81000000
Entry Point: 0x81000000
Hash algo: sha1
Hash value: ab26581a698f3ac1157380d1f521750d49a64dfb
Verifying Hash Integrity … sha1+ OK

Loading ramdisk from FIT Image at 82100000 …

Using ‘config@imx7d-colibri-emmc-eval-v3.dtb’ configuration
Trying ‘ramdisk@1’ ramdisk subimage
Description: tezi-initramfs
Type: RAMDisk Image
Compression: uncompressed
Data Start: 0x827ee5f4
Data Size: 26181632 Bytes = 25 MiB
Architecture: ARM
OS: Linux
Load Address: unavailable
Entry Point: unavailable
Hash algo: sha1
Hash value: 2f0d2d3baa2783d682aa11c760b560a18bc4e373
Verifying Hash Integrity … sha1+ OK

Loading fdt from FIT Image at 82100000 …

Using ‘config@imx7d-colibri-emmc-eval-v3.dtb’ configuration
Trying ‘fdt@imx7d-colibri-emmc-eval-v3.dtb’ fdt subimage
Description: Flattened Devce Tree blob
Type: Flat Device Tree
Compression: uncompressed
Data Start: 0x827c2f28
Data Size: 56238 Bytes = 54.9 KiB
Architecture: ARM
Hash algo: sha1
Hash value: 4584c1a80bb703cecda58686e2e5440295f0dd9f
Verifying Hash Integrity … sha1+ OK
Booting using the fdt blob at 0x827c2f28
Loading Kernel Image … OK
Loading Device Tree to 8ffef000, end 8ffffbad … OK

Starting kernel …

I could have avoided setting the variables, since I eventually run the commands of “boot_a_script” manually with all the necessary values.
So it successfully loaded boot.scr from emmc device 0 partition 3 (also works for 1) to the address and then executed the commands of the script that are now in RAM. Voila, TEZI starts up.

Strangely, trying to load boot-tezi.scr instead of boot.scr results in failure, although the contents of both files is the same:

Colibri iMX7 # setenv bootm_boot_mode sec
Colibri iMX7 # printenv boot_a_script
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
Colibri iMX7 # load mmc 0:3 0x87000000 boot-tezi.scr
524 bytes read in 6 ms (85 KiB/s)
Colibri iMX7 # source 0x87000000

Executing script at 87000000

Wrong Image Format for bootm command
ERROR: can’t get kernel image!

The script is successfully loaded, but the command execution then fails. I had seen this failure before, but assumed that the image file was corrupted when I copied it to the partition. Apparently this is not the case, since in the attempt before with the renamed boot-tezi.scr it booted the image just fine.

I don’t understand why the “source” command would fail because of the script name, when the script contents is now in RAM and the file name is irrelevant. More likely, loading the script to RAM failed when it was named boot-tezi.scr - although I explicitly asked to load the script with this name and got no error from the load command.

Best regards,
Otmar

Hi @Otmar

Could it be that one of the other variables is missing? What if you do:

Colibri iMX7 # setenv bootm_boot_mode sec
Colibri iMX7 # setenv devtype mmc
Colibri iMX7 # setenv devnum 0
Colibri iMX7 # setenv distro_bootpart 3
Colibri iMX7 # setenv bootpart 3
Colibri iMX7 # setenv script boot-tezi.scr

Some of the variables are used also in the boot script. However, I would recommend you to just rename boot-tezi.scr to boot.scr. Basically, this is what the script does:

setenv bootargs console=ttymxc0,115200 quiet video=DPI-1:640x480-16@60D rootfstype=squashfs root=/dev/ram autoinstall ${teziargs}

# Re-enable fdt relocation since in place fdt edits corrupt the ramdisk
# in a FIT image...
setenv fdt_high

# Load FIT image from location as detected by distroboot
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}tezi.itb

bootm ${ramdisk_addr_r}#config@${soc}-colibri${variant}-${fdt_board}.dtb

You can also try to run these steps manually to figure out where it fails in the second case.

Regards,
Stefan

Hello Stefan,
I did not think of the script using some of the U-Boot variables and that was, presumably, the problem.
When I tried all commands by hand, it booted TEZI 5.4:

Colibri iMX7 # printenv boot_a_script
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
Colibri iMX7 # printenv bootcmd_tezi
bootcmd_tezi=setenv bootm_boot_mode sec; setenv devtype mmc; setenv devnum 0; setenv distro_bootpart 3; setenv bootpart 3; setenv script boot.scr; run boot_a_script
Colibri iMX7 # setenv bootm_boot_mode sec
Colibri iMX7 # setenv devtype mmc
Colibri iMX7 # setenv devnum 0
Colibri iMX7 # setenv distro_bootpart 3
Colibri iMX7 # setenv bootpart 3
Colibri iMX7 # setenv script boot-tezi.scr
Colibri iMX7 # printenv scriptaddr
scriptaddr=0x87000000
Colibri iMX7 # printenv ramdisk_addr_r
ramdisk_addr_r=0x82100000
Colibri iMX7 # printenv prefix

Error: “prefix” not defined

Colibri iMX7 # printenv soc
soc=imx7d
Colibri iMX7 # printenv variant
variant=-emmc
Colibri iMX7 # printenv fdt_board
fdt_board=eval-v3
Colibri iMX7 # load mmc 0:3 0x87000000 boot-tezi.scr
524 bytes read in 6 ms (85 KiB/s)
Colibri iMX7 # printenv teziargs

Error: “teziargs” not defined

Colibri iMX7 # setenv bootargs console=ttymxc0,115200 quiet video=DPI-1:640x480-16@60D rootfstype=squashfs root=/dev/ram autoinstall
Colibri iMX7 # setenv fdt_high
Colibri iMX7 # load mmc 0:3 0x82100000 tezi.itb
33453256 bytes read in 405 ms (78.8 MiB/s)
Colibri iMX7 # bootm 0x82100000#config@imx7d-colibri-emmc-eval-v3.dtb

Loading kernel from FIT Image at 82100000 …

Using ‘config@imx7d-colibri-emmc-eval-v3.dtb’ configuration
Trying ‘kernel@1’ kernel subimage
Description: Linux kernel
Type: Kernel Image
Compression: uncompressed
Data Stat: 0x82100108
Data Size: 6980096 Bytes = 6.7 MiB
Architecture: ARM
OS: Linux
Load Address: 0x81000000
Entry Point: 0x81000000
Hash algo: sha1
Hash value: ab26581a698f3ac1157380d1f521750d49a64dfb
Veriying Hash Integrity … sha1+ OK

Loading ramdisk from FIT Image at 82100000 …

Using ‘config@imx7d-colibri-emmc-eval-v3.dtb’ configuration
Trying ‘ramdisk@1’ ramdisk subimage
Description: tezi-initramfs
Type: RAMDisk Image
Compression: uncmpressed
Data Start: 0x827ee5f4
Data Size: 26181632 Bytes = 25 MiB
Architecture: ARM
OS: Linux
Load Address: unavailable
Entry Point: unavailable
Hash algo: sha1
Hash value: 2f0d2d3baa2783d682a11c760b560a18bc4e373
Verifying Hash Integrity … sha1+ OK

Loading fdt from FIT Image at 82100000 …

Using ‘config@imx7d-colibri-emmc-eval-v3.dtb’ configuration
Trying ‘fdt@imx7d-colibri-emmc-eval-v3.dtb’ fdt subimage
Description: Flattened Device Tree blob
Type: Flat Device Tree
ompression: uncompressed
Data Start: 0x827c2f28
Data Size: 56238 Bytes = 54.9 KiB
Architecture: ARM
Hash algo: sha1
Hash value: 4584c1a80bb703cecda58686e2e5440295f0dd9f
Verifying Hash Integrity … sha1+ OK
Booting using the fdt blob at 0x827c2f28
Loading Kernel Image … OK
Loading Device Tree to 8ffef000, end 8ffffbad … OK

Starting kernel …

I assume, the error regarding image type was generated when the address to load tezi.itb was not set (correctly?).

There is a small difference between boot.scr (which I use for TEZI 1.8) and boot-tezi.scr (which comes with TEZI 5.4):

boot.scr:
setenv bootargs console=ttymxc0,115200 quiet rootfstype=squashfs root=/dev/ram autoinstall ${teziargs}
setenv fdt_high
load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} ${prefix}tezi.itb
bootm ${ramdisk_addr_r}#config@${soc}${variant}

boot-tezi.scr:
setenv bootargs console=ttymxc0,115200 quiet video=DPI-1:640x480-16@60D rootfstype=squashfs root=/dev/ram autoinstall ${teziargs}
setenv fdt_high
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}tezi.itb
bootm ${ramdisk_addr_r}#config@${soc}-colibri${variant}-${fdt_board}.dtb

Besides the bootargs, the parameter to bootm is different. boot.scr lacks the extension “-${fdt_board}.dtb” I don’t know if this makes a difference when booting TEZI 5.4

The other error I saw “Boot partition needs to be the first partition” was generated from yet another version of boot.scr, which I had mistakenly copied to the device during my tests instead of the original boot.scr. This version of the script tests:
if test ${distro_bootpart} != 1
then
echo “Boot partition needs to be the first partition”
exit
fi
Which is also wrong for my installation of TEZI 1.8 to partition 3.

So, in conclusion: when all variables are set correctly and the appropriate boot script is executed TEZI 5.4 boots on my device from the partition where I have installed it. In order to upgrade to TEZI 5.4 I only need to adjust the U-Boot variables to hold the values I used in the test above.

Thank you very much for your help and insight! Please consider the issue resolved.

Best regards,
Otmar

Perfect, thanks a lot for the feedback!