Difference between revisions of "Jetson/L4T/Boot From External Device"

From eLinux.org
< Jetson‎ | L4T
Jump to: navigation, search
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
* Flash device with rootfs on external devices (USB, SATA, NVMe) or internal device (emmc, sd).
+
* This page is only for release <= L4T 32.5.1.  For rel-32.6.1, please refer to [https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3261/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/flashing.html#wwpID0E0QN0HA [Flashing to an nvme drive<nowiki>]</nowiki>]
* With new releases >= rel-32, external  is being used as identification is solely on UUID based and not type of media.
+
* This method will tell the system to mount the rootfs on external devices (USB, SATA, NVMe).
 +
* You can use either the device node (e.g. mmcblk1p1/sda1/nvme0n1p1...etc) or the UUID based method.
  
 
== Steps ==
 
== Steps ==
Line 22: Line 23:
 
   $ sudo mount /dev/sd'''x'''1 /mnt
 
   $ sudo mount /dev/sd'''x'''1 /mnt
 
   // go to rootfs directory
 
   // go to rootfs directory
   $ cd rootfs/
+
   $ cd Linux_for_Tegra/rootfs/   //this is prepared by sdkmanager
 
   // copy rootfs
 
   // copy rootfs
 
   $ sudo tar -cpf - * | ( cd /mnt/ ; sudo tar -xpf - )
 
   $ sudo tar -cpf - * | ( cd /mnt/ ; sudo tar -xpf - )
 
   $ sudo umount /mnt
 
   $ 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)
+
4. Plugin the device to Jetson platform. Let Jetson platform enter recovery mode and connect to host PC
5. Flash the board with rootfs device (external is for nvme, usb, sata) and internal is for sdcard/emmc:
+
 
 +
5.1 (release >= r32.5) For uuid method, you need to create file bootloader/l4t-rootfs-uuid.txt_'''ext''' and put your PARTUUID inside this file.
 +
Then, use command:
 +
  $ sudo./flash.sh jetson-tx2 external
 +
 
 +
For device node method, it is easier that you can just give the device name to flash.sh.
 +
  examples:
 +
  $ sudo ./flash.sh jetson-tx2 nvme0n1p1
 +
 
 +
5.2 (release < r32.5) On host PC, create and copy PARTUUID to bootloader/l4t-rootfs-uuid.txt for external device, and flash the board with rootfs device.
 
   $ sudo ./flash.sh jetson-tx2 external
 
   $ sudo ./flash.sh jetson-tx2 external
  $ sudo ./flash.sh jetson-tx2 internal
+
 
 +
For device node method, it is same as previous case.
 +
 
 
6. Done
 
6. Done
  
Line 62: Line 74:
 
3 Get partition UUID and copy rootfs to the device:
 
3 Get partition UUID and copy rootfs to the device:
 
   $ sudo mkfs.ext4 /dev/nvme0n1p1
 
   $ sudo mkfs.ext4 /dev/nvme0n1p1
   // get partition UUID for step 4
+
   // on r32.4.4, get partition UUID for step 4; no need for r32.5
 
   $ sudo blkid /dev/nvme0n1p1
 
   $ sudo blkid /dev/nvme0n1p1
 
   $ sudo mount /dev/nvme0n1p1 /mnt
 
   $ sudo mount /dev/nvme0n1p1 /mnt
Line 71: Line 83:
 
   $ sudo umount /mnt
 
   $ sudo umount /mnt
  
4. On host Linux PC, copy PARTUUID to bootloader/l4t-rootfs-uuid.txt
+
4. Let Xavier NX enter recovery mode and connect to host PC
 +
 
 +
5. 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:
+
6. Flash the board with rootfs device:
 +
  // r32.4.4
 
   $ sudo ./flash.sh jetson-xavier-nx-devkit-emmc external
 
   $ sudo ./flash.sh jetson-xavier-nx-devkit-emmc external
 
+
  // r32.5
6. Done
+
  $ sudo ./flash.sh jetson-xavier-nx-devkit-emmc nvme0n1p1
 +
7. Done
  
 
== Check ==
 
== Check ==

Latest revision as of 22:41, 16 May 2022

Introduction

  • This page is only for release <= L4T 32.5.1. For rel-32.6.1, please refer to [Flashing to an nvme drive]
  • This method will tell the system to mount the rootfs on external devices (USB, SATA, NVMe).
  • You can use either the device node (e.g. mmcblk1p1/sda1/nvme0n1p1...etc) or the UUID based method.

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 Linux_for_Tegra/rootfs/   //this is prepared by sdkmanager
  // copy rootfs
  $ sudo tar -cpf - * | ( cd /mnt/ ; sudo tar -xpf - )
  $ sudo umount /mnt

4. Plugin the device to Jetson platform. Let Jetson platform enter recovery mode and connect to host PC

5.1 (release >= r32.5) For uuid method, you need to create file bootloader/l4t-rootfs-uuid.txt_ext and put your PARTUUID inside this file. Then, use command:

  $ sudo./flash.sh jetson-tx2 external

For device node method, it is easier that you can just give the device name to flash.sh.

  examples:
  $ sudo ./flash.sh jetson-tx2 nvme0n1p1

5.2 (release < r32.5) On host PC, create and copy PARTUUID to bootloader/l4t-rootfs-uuid.txt for external device, and flash the board with rootfs device.

  $ sudo ./flash.sh jetson-tx2 external

For device node method, it is same as previous case.

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. Let Xavier NX enter recovery mode and connect to host PC

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

6. 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

7. 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