This is a the second in a series of short articles about running the Jetson TX1 from external storage. This article discusses copying the contents of the internal flash memory of a NVIDIA Jetson TX1 over to a USB Drive, and then running the Jetson from the USB Drive itself. Looky here:
The USB Flash Drive in the video is a SanDisk 64GB Ultra Flair.
Background
USB flash drives and other types of USB drives are ubiquitous and inexpensive. When people need larger and faster storage on a Jetson TX1, they will frequently select USB drives as a solution. The method described in the video works with both flash and hard drives. For best results, choose a full speed USB 3.0 drive and make sure if a USB hub is being used that it is also USB 3.0. This will provide the fastest speeds possible.
In general, USB drives can be twice as fast as SD Cards.
You can simply use the USB drive as supplemental storage, or choose to use the drive as the root directory of the operating system. This basically means that the system runs from the USB drive instead of the internal flash (eMMC) memory. The video describes the process to copy the root over from the internal eMMC over to the USB drive, and then modify the boot process to use the USB drive as root.
This method is a mostly GUI solution, there are command line equivalents that others may use and are more sophisticated. Just be forewarned that if you ask for help, others may speak in ‘CLI‘ language.
An embedded system like the Jetson TX1 uses a different boot sequence than a PC. A PC uses system firmware called a BIOS which is able to easily assign different devices to be the boot device. Embedded systems tend to be simpler and more direct. While there are several different strategies used, the Jetson TX1 uses the extlinux boot loader. By modifying the file extlinux.conf in /boot/extlinux, we can directly control which device and partition are set to be the root directory for Linux.
Installation
Note: The installation on the video was done on a Jetson TX1 running L4T 24.2.1, which was flashed from JetPack 2.3.1.
Because the installation demonstration is using mostly GUI tools, please refer to the video for the walk through. Here are the basic steps:
First, format the USB drive with a ext4 format. You will need at least 1 partition. The partition size must be at least 16GB. There are a couple of ways of doing this, an easy way is to use the Disks application which provides a GUI for formatting disks.
Second, mount the USB drive. Double clicking the USB drive icon will mount the USB drive and open a file browser.
Third, copy the contents of the root directory of the internal flash memory to the USB drive. In the video example:
$ sudo cp -ax / ‘/media/ubuntu/USB Root’
copies the root directory to the mounted USB Drive named ‘USB Root’. For a nearly full internal flash memory, this will take about 7 minutes depending on the speed of the USB drive.
The last setup step is to modify the file extlinux.conf file on the eMMC. The system will boot from the internal eMMC, then the kernel will set the root directory to point to the USB drive.
First, switch to the extlinux directory:
$ cd /boot/extlinux
Next, make a backup of the existing extlinux configuration:
$ sudo cp extlinux.conf extlinux.conf.original
Now edit the configuration to set up the USB drive:
$ sudo gedit /boot/extlinux/extlinux.conf
An editor will open on the configuration file. Duplicate the eMMC entry (usually named primary), and change the entries as shown in the video. One of the major changes indicates the device and partition, which is:
Internal eMMC
root=/dev/mmcblk0p1
USB Drive:
root=/dev/sda1
Sample extlinux.conf File
The completed example file shown in the video is:
TIMEOUT 30
DEFAULT usbflashMENU TITLE p2371-2180 eMMC boot options
LABEL usbflash
MENU LABEL USB Flash Drive
LINUX /boot/Image
INITRD /boot/initrd
FDT /boot/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb
APPEND fbcon=map:0 console=tty0 console=ttyS0,115200n8 androidboot.modem=none androidboot.serialno=P2180A00P00940c003fd androidboot.security=non-secure tegraid=21.1.2.0.0 ddr_die=2048M@2048M ddr_die=2048M@4096M section=256M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 debug_uartport=lsport,0 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=${lp0_vec} nvdumper_reserved=${nvdumper_reserved} core_edp_mv=1125 core_edp_ma=4000 gpt android.kerneltype=normal androidboot.touch_vendor_id=0 androidboot.touch_panel_id=63 androidboot.touch_feature=0 androidboot.bootreason=pmc:software_reset,pmic:0x0 net.ifnames=0 root=/dev/sda1 rw rootwaitLABEL emmc
MENU LABEL Internal eMMC
LINUX /boot/Image
INITRD /boot/initrd
FDT /boot/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb
APPEND fbcon=map:0 console=tty0 console=ttyS0,115200n8 androidboot.modem=none androidboot.serialno=P2180A00P00940c003fd androidboot.security=non-secure tegraid=21.1.2.0.0 ddr_die=2048M@2048M ddr_die=2048M@4096M section=256M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 debug_uartport=lsport,0 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=${lp0_vec} nvdumper_reserved=${nvdumper_reserved} core_edp_mv=1125 core_edp_ma=4000 gpt android.kerneltype=normal androidboot.touch_vendor_id=0 androidboot.touch_panel_id=63 androidboot.touch_feature=0 androidboot.bootreason=pmc:software_reset,pmic:0x0 net.ifnames=0 root=/dev/mmcblk0p1 rw rootwait
Make sure to save the file.
Now restart the machine and it will boot to the USB drive.
Note: If the machine does not boot, hook up a serial console to a host and examine the boot sequence. The entries that you have changed should show up in the boot options.
Once the machine boots, you should run some typical programs or compiles to make sure everything works and is installed correctly. There are some things to watch out for, such as checking to make sure that system level settings for things such as swap files are correct. In general, it is a copy of the internal eMMC, so it should all pretty much behave itself.
Things to Watch Out For
Lions, Tigers, and Bears for starters. Badgers are really mean, be careful of those.
Once past the usual suspects, one thing that you need to be aware of is that if the Jetson can’t see the USB drive, it will not boot. You may see error messages on the screen or console that it is hunting through USB devices, looking for a boot drive. If there is another USB drive which is not bootable, then you may see errors that look like the Jetson is flat out broken.
If the bootable USB drive is not available for some reason, you can use the serial console to select the internal eMMC as the boot device. That will allow you to edit the extlinux.conf file to boot from a different device.
The post Run Jetson TX1 from USB Drive appeared first on JetsonHacks.