U-boot USB boot

From embeddedTS Manuals
Revision as of 17:05, 24 July 2017 by Kris (talk | contribs) (Cleaned up wording, fixed to specify ext3, linked to manual sections.)

Our U-Boot by default will attempt to read a U-Boot script from a USB drive on startup. It copies /tsinit.ub into memory and jumps in to the script. To make a bootable drive, create a single ext3 partition on a USB drive and copy over your preferred rootfs just like you would with an SD card. This is described in the Debian and Yocto sections.

The one addition is to create the tsinit.ub file in the root of the USB drive.

Create the file tsinit.scr in the root of the USB drive with the Linux filesystem:

# Prepare with:
# mkimage -A arm -T script -C none -n 'mx6 usb' -d tsinit.scr tsinit.ub

# DO NOT MANUALLY EDIT THE .UB FILE

if test ${model} = '4900'; 
	then load usb 0:1 ${loadaddr} /boot/ts4900-fpga.bin;
	ice40 ${loadaddr} ${filesize};

	bbdetect;
	if load usb 0:1 ${fdtaddr} /boot/imx6${cpu}-ts4900-${baseboardid}.dtb;
		then echo $baseboardid detected;
	else 
		echo Booting default device tree;
		load usb 0:1 ${fdtaddr} /boot/imx6${cpu}-ts4900.dtb;
	fi;
	load usb 0:1 ${loadaddr} ${uimage};
	setenv bootargs root=/dev/sda1 rootwait rw ${cmdline_append};
	bootm ${loadaddr} - ${fdtaddr};
fi

load usb 0:1 ${loadaddr} ${uimage};
load usb 0:1 ${fdtaddr} /boot/imx6${cpu}-ts${model}.dtb;
setenv bootargs root=/dev/sda1 rootwait rw ${cmdline_append};
bootm ${loadaddr} - ${fdtaddr};

Then in the same directory generate the tsinit.ub file:

mkimage -A arm -T script -C none -n 'mx6 usb' -d tsinit.scr tsinit.ub

You may need to install u-boot-tools or the equivalent package for your distribution.