TS-4100 U-Boot USB boot: Difference between revisions

From embeddedTS Manuals
(Update for TS-4100, matches current scripts there)
 
m (Links auto-updated for 2022 re-branding ( https://files.embeddedarm.com/ts-socket-macrocontrollers/ts-4100-linux/distributions/debian/ts4100-armhf-stretch-latest.tar.xz →‎ https://files.embeddedTS.com/ts-socket-macrocontrollers/ts-4100-linux/distributions/debian/ts4100-armhf-stretch-latest.tar.xz))
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The one addition is to create the tsinit.scr file in the root of the USB drive.  In order to do this, a U-Boot script must be created and then converted to the .scr format. This process requires a set of U-Boot specific tools. These are available on most every l=Linux distribution, the instructions below are for Debian, either run on a host PC or on the device itself. See the package installation documentation for other respective distributions.
By default, U-Boot will attempt to read a U-Boot script from a USB drive on every bootup. This process copies <source inline>/tsinit.scr</source> from the first partition of the USB drive into memory and jumps in to the script. If the drive or script do not exist, then this process is bypassed and U-Boot will continue its boot flow.
 
This process is attempted on every boot unless it is disabled. It can be disabled by modifying the [[#U-Boot Environment|U-Boot environment variable]] <source inline>usbboot</source>. If <source inline>usbboot</source> is set to 0 then this step will be bypassed on normal boot cycles. It is enabled by default to allow for a custom [[#Production Mechanism|production process]] to be used.
 
If the [[#Entering_U-Boot_Shell|U-Boot shell is entered]] by holding the push switch or using the U-Boot jumper (on baseboards with either a push switch or U-Boot jumper), this process will always run before dropping to the U-Boot shell regardless of the state of the <source inline>usbboot</source> variable. If the U-Boot shell is entered by pressing <source inline>ctrl+c</source> (on boaseboards without a U-Boot jumper or TS-4100 standalone), then this process is never run since autoboot is aborted and the shell is immediately entered. In this state, the USB boot process can always be manually started with the command <source inline>run usbprod</source>.
 
For information on creating a USB drive to write existing images to either SD and/or eMMC, see the section on our custom [[#Production Mechanism|production process]] for more details on the process.
 
To make a bootable USB drive that boots in to the same environment as SD or eMMC, create a single ext3 partition on a USB drive and unpack the rootfs tarball located [https://files.embeddedTS.com/ts-socket-macrocontrollers/ts-4100-linux/distributions/debian/ts4100-armhf-stretch-latest.tar.xz here].
 
Additionally, a U-Boot script file, <source inline>/tsinit.scr</source>, must be created and placed in the root folder of this partition.  In order to do this, a script must be created and converted to the U-Boot <source inline>.scr</source> format. This process requires a set of U-Boot specific tools. These tools are available on most every Linux distribution, the instructions below are for Debian, either on a host PC or on the device itself. See the package installation documentation for other respective distributions.


Install U-Boot tools in Debian
Install U-Boot tools in Debian
Line 6: Line 16:
</source>
</source>


Create the file tsinit.source in the root of the USB drive with the Linux filesystem:
Create the file "tsinit.source" in the root of the USB drive with the Linux filesystem:
<source lang=bash>
<source lang=bash>
# Prepare with:
# Prepare with:
Line 19: Line 29:
if load usb 0:1 ${fdtaddr} /boot/imx6ul-ts${model}-${baseboardid}.dtb;
if load usb 0:1 ${fdtaddr} /boot/imx6ul-ts${model}-${baseboardid}.dtb;
         then echo "${baseboardid} detected;"
         then echo "${baseboardid} detected;"
else
else echo "Booting default device tree";
        echo "Booting default device tree";
         load usb 0:1 ${fdtaddr} /boot/imx6ul-ts${model}.dtb;
         load usb 0:1 ${fdtaddr} /boot/imx6ul-ts${model}.dtb;
fi
fi;


if load usb 0:1 ${loadaddr} /boot/zImage;
load usb 0:1 ${loadaddr} /boot/zImage;
        setenv bootargs root=/dev/sda1 rootwait rw ${cmdline_append} bbid=0x{$baseboardid} bbrev=0x${baseboardrev};
setenv bootargs root=/dev/sda1 rootwait rw ${cmdline_append} bbid=0x${baseboardid} bbrev=0x${baseboardrev};
        run silowaitcharge;
run silowaitcharge;
        bootz ${loadaddr} - ${fdtaddr};
bootz ${loadaddr} - ${fdtaddr};
else
fi;
        echo "Failed to load kernel from USB";
fi


</source>
</source>

Latest revision as of 16:44, 17 January 2022

By default, U-Boot will attempt to read a U-Boot script from a USB drive on every bootup. This process copies /tsinit.scr from the first partition of the USB drive into memory and jumps in to the script. If the drive or script do not exist, then this process is bypassed and U-Boot will continue its boot flow.

This process is attempted on every boot unless it is disabled. It can be disabled by modifying the U-Boot environment variable usbboot. If usbboot is set to 0 then this step will be bypassed on normal boot cycles. It is enabled by default to allow for a custom production process to be used.

If the U-Boot shell is entered by holding the push switch or using the U-Boot jumper (on baseboards with either a push switch or U-Boot jumper), this process will always run before dropping to the U-Boot shell regardless of the state of the usbboot variable. If the U-Boot shell is entered by pressing ctrl+c (on boaseboards without a U-Boot jumper or TS-4100 standalone), then this process is never run since autoboot is aborted and the shell is immediately entered. In this state, the USB boot process can always be manually started with the command run usbprod.

For information on creating a USB drive to write existing images to either SD and/or eMMC, see the section on our custom production process for more details on the process.

To make a bootable USB drive that boots in to the same environment as SD or eMMC, create a single ext3 partition on a USB drive and unpack the rootfs tarball located here.

Additionally, a U-Boot script file, /tsinit.scr, must be created and placed in the root folder of this partition. In order to do this, a script must be created and converted to the U-Boot .scr format. This process requires a set of U-Boot specific tools. These tools are available on most every Linux distribution, the instructions below are for Debian, either on a host PC or on the device itself. See the package installation documentation for other respective distributions.

Install U-Boot tools in Debian

apt-get update && apt-get install u-boot-tools -y

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

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

# DO NOT MANUALLY EDIT THE .scr FILE

if load usb 0:1 ${loadaddr} /boot/ts${model}-fpga.vme;
        then fpga load 0 ${loadaddr} ${filesize};
fi;

if load usb 0:1 ${fdtaddr} /boot/imx6ul-ts${model}-${baseboardid}.dtb;
        then echo "${baseboardid} detected;"
else echo "Booting default device tree";
        load usb 0:1 ${fdtaddr} /boot/imx6ul-ts${model}.dtb;
fi;

load usb 0:1 ${loadaddr} /boot/zImage;
setenv bootargs root=/dev/sda1 rootwait rw ${cmdline_append} bbid=0x${baseboardid} bbrev=0x${baseboardrev};
run silowaitcharge;
bootz ${loadaddr} - ${fdtaddr};
fi;

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

mkimage -A arm -T script -C none -n 'imx6ul usb' -d tsinit.source tsinit.scr