Jetson/L4T/Boot From External Device

Introduction

 * Flash device with rootfs on external devices (USB, SATA, NVMe) or internal device (emmc, sd).
 * With new releases >= rel-32, external is being used as identification is solely on UUID based and not type of media.

Steps
1. Connect the external device to host Linux PC

2. Create GPT and partiton using gdisk on the device: $sudo gdisk /dev/sdx "o" -> clear all current partition data "n" -> create new partition "1" -> partition number /dev/sdx1 "40M"first sectors -> Press enter or "+32G" last sectors "Linux filsystem" -> using default type "c" -> partition's name "PARTLABEL" "w" -> write to disk and exit.

3. Get partition UUID and copy rootfs to the device: $ sudo mkfs.ext4 /dev/sdx1 // get partition UUID for step 4 $ sudo blkid /dev/sdx1 $ sudo mount /dev/sdx1 /mnt // go to rootfs directory $ cd rootfs/ // copy rootfs $ sudo tar -cpf - * | ( cd /mnt/ ; sudo tar -xpf - ) $ sudo umount /mnt

4. Create and copy PARTUUID to bootloader/l4t-rootfs-uuid.txt for internal device. (also for external device if release <32.5) and bootloader/l4t-rootfs-uuid.txt_ext for external device. (for release >= 32.5) 5. Flash the board with rootfs device -> external is for nvme, usb, sata while internal is for sdcard/emmc: $ sudo ./flash.sh jetson-tx2 external $ sudo ./flash.sh jetson-tx2 internal 6. Done

Use NVMe + Xavier NX as example
If you have Xavier NX and the external device is NVMe PCIe M.2 SSD card, you can execute the steps on XNX:

1.1 Plugin the card to M.2 slot on XNX and boot up

1.2 Download packages to XNX and generate rootfs // download L4T Driver Package (BSP) and Sample Root Filesystem https://developer.nvidia.com/embedded/linux-tegra // put the packages in same folder and do  $ sudo tar xpf Tegra186_Linux_R32.4.4_aarch64.tbz2 $ cd Linux_for_Tegra/rootfs/ $ sudo tar xpf ../../Tegra_Linux_Sample-Root-Filesystem_R32.4.4_aarch64.tbz2 $ cd ../ $ sudo ./apply_binaries.sh

2. Create GPT and partiton using gdisk on the device: $sudo gdisk /dev/nvme0 "o" -> clear all current partition data "n" -> create new partition "1" -> partition number /dev/nvme0n1p1 "40M"first sectors -> Press enter "Linux filsystem" -> using default type "c" -> partition's name "PARTLABEL" "w" -> write to disk and exit.

3 Get partition UUID and copy rootfs to the device: $ sudo mkfs.ext4 /dev/nvme0n1p1 // on r32.4.4, get partition UUID for step 4; no need for r32.5 $ sudo blkid /dev/nvme0n1p1 $ sudo mount /dev/nvme0n1p1 /mnt // go to rootfs directory $ cd rootfs/ // copy rootfs $ sudo tar -cpf - * | ( cd /mnt/ ; sudo tar -xpf - ) $ sudo umount /mnt

4. On host Linux PC, copy PARTUUID to bootloader/l4t-rootfs-uuid.txt. This step is not required for r32.5.

5. Flash the board with rootfs device: // r32.4.4 $ sudo ./flash.sh jetson-xavier-nx-devkit-emmc external // r32.5 $ sudo ./flash.sh jetson-xavier-nx-devkit-emmc nvme0n1p1 6. Done

Check
After boot up, the u-boot logs will like below: TEGRA186 Model: NVIDIA P2771-0000-500 DRAM: 7.8 GiB MC:  Tegra SD/MMC: 0, Tegra SD/MMC: 1 *** Warning - bad CRC, using default environment In:   serial Out:  serial Err:  serial Net:  eth0: ethernet@2490000 Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc1 is current device Scanning mmc 1:1... Found /boot/extlinux/extlinux.conf Retrieving file: /boot/extlinux/extlinux.conf 733 bytes read in 127 ms (4.9 KiB/s) L4T boot options 1:	primary kernel Enter choice: 1:	primary kernel Retrieving file: /boot/initrd 5564673 bytes read in 697 ms (7.6 MiB/s) Retrieving file: /boot/Image 34179080 bytes read in 3848 ms (8.5 MiB/s) append: root=PARTUUID=ec27c846-88af-41f6-bd4b-fd46c54bb5ce rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 video=tegrafb no_console_suspend=1 earlycon=uart8250,mmio32,0x3100000 nvdumper_reserved=0x2772e0000 gpt tegra_fbmem2=0x800000@0x9607b000 lut_mem2=0x2008@0x96078000 usbcore.old_scheme_first=1 tegraid=18.1.2.0.0 maxcpus=6 boot.slot_suffix= boot.ratchetvalues=0.2031647.1 bl_prof_dataptr=0x10000@0x275840000 sdhci_tegra.en_boot_part_access=1 quiet