Boot from USB drive

Hi guys !

I’m trying to achieve a simple behavior with U-Boot :

  1. If a USB is present and bootable (from WIC file with Image.gz and dtb files), boot linux that is in it
  2. If not, boot on emmc.

What I’ve done so far: I modified the to have this:

env set boot_targets usb0 mmc1 mmc2

So that it tries usb0 first, and then mmc1 and 2

However, it does not boot on usb at all.
Any idea how to do that ?

Thanks for your advice !

Hi! I have the same question, however using the SD Card. If SD Card is present, then boots from there, if not, go for emmc. Can you tell how the command will look like?

For an old (non-toradex) board, I have a script that looks like this:

# eMMC boot params
setenv mmcdev 1
setenv mmcroot /dev/mmcblk2p1 rootwait ro

# USB boot params
setenv usbroot /dev/sda2 rootwait rw
setenv usbargs 'setenv bootargs console=${console},${baudrate} ${smp} 
setenv usbload 'usb start; fatload usb 0:1 ${loadaddr} uImage; fatload usb 0:1 ${fdt_addr} imx6.dtb'
setenv usbcustomboot 'run usbargs; bootm ${loadaddr} - ${fdt_addr}'

# Boot sequence: 1. USB, 2. eMMC. Ignore SD card.
if run usbload;
  then run usbcustomboot;
  else if run loaduimage; 
    then run mmcboot; 

However Toradex uses a lot of u-boot env variables and there is no documentation about this.

Hello @luciolis ,

Have you perhaps already checked out our distro boot article here? That explains a lot of U-Boot variables.

BR, Janani