Booting TEZI from USB storage device - boot.scr failing

Trying to setup hands-free (i.e. not pressing recovery button) loading of TEZI image similar to this post using verdin-imx8mp SOM on an Ivy carrier board.

Following directions located here but having a couple of issues. The contents of the USB drive are setup per the instructions and can verify that boot.scr is accessible by running usb start then fatls usb 0:1.

Verdin iMX8MP # usb start
starting USB…
Bus usb@38200000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@38200000 for devices… 4 USB Device(s) found
scanning usb for storage devices… 1 Storage Device(s) found
Verdin iMX8MP # fatls usb 0:1
recovery/
1842 boot.scr
1503 image.json
1372776 imx-boot-recoverytezi
1375456 imx-boot-sd
118 overlays.txt
491 recovery-linux.README
362 recovery-linux.sh
273 recovery-windows.bat
1464 recovery-windows.README
42213651 tezi.itb
2997 tezi.png
18 wrapup.sh

12 file(s), 1 dir(s)

However, there isn’t a u-boot variable defined as bootcmd_usb0 so defining it manually with setenv bootcmd_usb0 'usb start; load usb 0:1 ${scriptaddr} boot.scr; source ${scriptaddr}' and then running it with run bootcmd_usb0 as below:

Verdin iMX8MP # run bootcmd_usb0
1842 bytes read in 1 ms (1.8 MiB/s)

Executing script at 50280000

** Bad device specification : 0x42e10000 **
Couldn’t find partition : 0x42e10000
Can’t set block device
** Bad device specification : 0x44200000 **
Couldn’t find partition : 0x44200000
Can’t set block device
Bootargs: quiet video=HDMI-A-1:1280x720-16@60D video=HDMI-A-2:1280x720-16@60D initcall_blacklist=vpu_driver_init rootfstype=squashfs root=/dev/ram autoinstall
Wrong Image Type for bootm command
ERROR -91: can’t get kernel image!
Verdin iMX8MP #

Does boot.scr need to be updated? Do other items need to be placed on the USB drive?

I don’t want to use an sdcard as that would require (manually) removing the card after the image is loaded to the eMMC to reboot (sdcard has a higher priority than eMMC).

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hands-Free TEZI Loading via USB on Verdin iMX8MP

The issue you’re encountering is related to the boot.scr script and the predefined boot commands in U-Boot. Let me address your specific problems.

Predefined Boot Commands

The Verdin iMX8MP does include predefined boot commands for USB devices(1). According to the documentation, these commands are:

Command Device with a booting system
bootcmd_mmc0 eMMC
bootcmd_mmc1 SD card
bootcmd_usb0 USB Flash Drive
bootcmd_dhcp TFTP/NFS

To boot from a USB Flash drive, you should use(1):

> run bootcmd_usb0

Boot Script Requirements

The boot.scr file needs to be properly formatted for your specific use case. The documentation provides an example boot script for TEZI loading(1):

setenv bootargs console=ttymxc0,115200 quiet video=mxcfb0:dev=hdmi,640x480@60,if=RGB24 video=mxcfb1:dev=lcd,640x480@60,if=RGB666 rootfstype=squashfs root=/dev/ram autoinstall ${teziargs}

# Reenable 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}

Creating the Correct boot.scr

To create a proper boot.scr file, first create a boot.cmd file with the appropriate U-Boot commands, then use the mkimage utility(1):

$ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Distro Boot Script" -d boot.cmd boot.scr

Boot Sequence Priority

Regarding your concern about SD card priority, the default boot sequence scans devices in this order(1):

  1. External SD card
  2. Internal flash memory (raw NAND or eMMC)
  3. External USB storage
  4. External server (TFTP/NFS)

To ensure USB boot without SD card interference, you can either:

  • Remove the SD card after installation
  • Use the specific bootcmd_usb0 command directly
  • Modify the boot sequence in U-Boot environment variables

Alternative Approach

If you continue having issues with the boot script, you can also use the general distro boot command(1):

> run distro_bootcmd

This will follow the predefined boot sequence and attempt to boot from USB when no SD card is present.

The errors you’re seeing suggest that the boot script is trying to access memory addresses that aren’t properly set in the current context. Make sure your boot.scr uses the proper U-Boot environment variables like ${devtype}, ${devnum}, and ${distro_bootpart} as shown in the example above.

Best regards, Toradex AI Assistant.

We did something similar to facilitate “bricked OS” recovery via a magic keypress combo during boot and didn’t generally have any issues getting it working. Are you using the Torizon OS image or do you have a custom image you are building yourself from e.g. the toradex minimal reference image? That could be one reason your bootloader is missing bootcmd_usb0 in its environment - IIRC distro-boot is a feature that may need to be explicitly enabled during u-boot compilation via a config value.

Hi @bw908

I’m using the latest Torizon OS image (7.3.0+build18).

:thinking: If you open “u-boot-initial-env” from the image you previously flashed with TEZI, do you see the definitions for the various distroboot commands? It’s been a while but I believe we’re also based on the 7.x branches.

e.g.:

bootcmd_usb0=devnum=0; run usb_boot
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi

our “modification” was effectively just adding a check and then the following series of commands to facilitate a USB-boot of tezi.

setenv stdout serial,vidconsole; while sleep 5; do run bootcmd_usb0; usb stop; setcurs 0 0; done

Another thought: Is your device secured with secure boot? This may remove access to certain u-boot commands and could also be the reason those don’t exist for you.

Hopefully the auto-response or a Toradex rep comes back with some additional suggestions for you.

Thanks @bw908 for your response.

The u-boot-initial-env file does not contain the bootcmd_usb0 definition.

However, taking a closer look at the boot.scr script I distilled it down to the basic essential commands and running them from the u-boot command line was able to start TEZI from the USB drive. For reference these commands are:

usb start
env set bootargs quiet video=HDMI-A-1:1280x720-16@60D video=HDMI-A-2:1280x720-16@60D initcall_blacklist=vpu_driver_init rootfstype=squashfs root=/dev/ram autoinstall ${teziargs}
load usb 0:1 0x44200000 tezi.itb
bootm 0x44200000#conf-freescale_imx8mp-verdin-nonwifi-ivy.dtb

Not sure about the bootargs but just copied what was in the boot.scr script.

Now on to trying to boot an image from dhcp/tftp/nfs :slight_smile: