NVIDIA Jetpack Flashing with initrd

From RidgeRun Developer Connection
Jump to: navigation, search

Introduction

This wiki provides a guide for using NVIDIA's Jetpack 4.6 initrd flashing procedure on both EMMC and SSD.

This is a streamlined way of flashing to internal or external media. The procedure works by first flashing a minimal initrd, which boots up and exposes the internal and external media to the host for flashing. This flashing procedure is much faster compared to other flashing techniques. For instance, in the case of Jetson Xavier NX which needs to flash SPI + EMMC, with initd both can be flashed in parallel. Another advantage of this feature is that it provides one solution to flash internal or external media.

Tools and instructions for flashing with initrd may be found in the directory /Linux_for_Tegra/‌tools/‌kernel_flash/. For more detailed information, see README_initrd_flash.txt in the same directory. Also, we encourage you to read the NVIDIA Jetson Linux Developer Guide for Jetpack 4.6.

Feature support table
Board Flashing with initrd
Jetson TX2 No
Xavier AGX Yes
Xavier NX Yes
Jetson Nano No

Requirements

  • High-quality USB‑C / micro-USB cable. A low-quality cable may make the flashing process fail.
  • NetworkManager is required by the host to configure the network for flashing, not some other network management application.
  • Automount must temporarily be disabled for the new external storage device during flashing.

Procedure

1. Disable automount

systemctl stop udisks2.service

2. Install dependencies

sudo apt install libxml2-utils simg2img network-manager abootimg sshpass device-tree-compiler

3. Put the Jetson Board in recovery mode and plug it into your computer.

4. Please go to the Target HW image folder created by the NVIDIA SDK manager after downloading the required Jetpack. By default it will be located at /home/$USER/nvidia/nvidia_sdk.

cd /home/$USER/nvidia/nvidia_sdk

5. Navigate to the corresponding Jetpack directory.

cd JetPack_4.6_<board>

6. Download the Jetson Platform Fuse Burning and Secure Boot Documentation and Tools package from NVIDIA official site and unpack it.

tar xvjf secureboot_r32.6.1_aarch64.tbz2

7. Navigate to the Linux_for_Tegra directory.

cd Linux_for_Tegra

8. Start the initrd flashing procedure. Here you can choose whether to flash the internal local storage device (eMMC or SD card), or an external SSD disk.

Flashing internal local storage device

sudo ./tools/kernel_flash/l4t_initrd_flash.sh <board-name> mmcblk0p1

Where:

• <board-name> is the value of the environment variable BOARD for the target device. According to the currently supported devices, you can use: jetson-xavier-nx-devkit, jetson-xavier-nx-devkit-emmc or jetson-agx-xavier-devkit.

Flashing external SSD disk

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device <external-device> -c <external-partition-layout> [ --external-only ] [ -S <APP-size> ] <board-name> <rootdev>

Where:

  • <board-name> can be jetson-xavier-nx-devkit, jetson-xavier-nx-devkit-emmc or jetson-agx-xavier-devkit.
  • <rootdev> can be set to "mmcblk0p1" or "internal" for booting from internal device or "external", "sda1" or "nvme0n1p1" for booting from external device. If your external device's external partition layout has "APP" partition, specifying here "nvme0n1p1" will generate the rootfs boot commandline: root=/dev/nvme0n1p1. If <rootdev> is internal or external, the tool will generate rootfs commandline: root=PARTUUID=....
  • <external-partition-layout> is the partition layout for the external storage device in XML format. NVIDIA provides some partition layout examples at Linux_for_Tegra/tools/kernel_flash/, so you can use any of those as starting point. For more information on how to create them visit the official documentation.
  • <external-device> is the name of the external storage device you want to flash as it appears in the '/dev/' folder (i.e nvme0n1, sda).
  • <APP-size> is the size of the partition that contains the operating system in bytes. KiB, MiB, GiB shorthand are allowed, for example, 1GiB means 1024 * 1024 * 1024 bytes. This size cannot be bigger than "num_sectors" * "sector_size" specified in the <external-partition-layout> and must be small enough to fit other partitions in the partition layout.
  • --external-only is a flag to flash only the external storage device, otherwise both internal and external devices will be flashed. Notice, that if you flash only the external device, the Jetson will boot back up to the internal storage and you will have to manually change the root=<rootdev> argument in the /boot/extlinux/extlinux.conf to boot from the external device. If you want to boot again from the internal storage you should mount the partition and change the /boot/extlinux/extlinux.conf of the internal storage filesystem.

So, an example to flash a SSD disk connected to the Xavier NX would be:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1 -c ./tools/kernel_flash/flash_l4t_nvme.xml -S 8GiB  --showlogs jetson-xavier-nx-devkit nvme0n1p1

Flashing external SSD disk with rootfs AB support

This workflow is almost the same as the previous but with the following differences:

  • Use the ROOTFS_AB=1 flag with the flash script.
  • Use a different partition layout that includes also APP_b.
  • Use external for the <rootdev> argument.

So, an example to flash a SSD disk connected to the Xavier NX, with rootfs AB support would be:

sudo ROOTFS_AB=1 ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1 -c ./tools/kernel_flash/flash_l4t_nvme_rootfs_ab.xml -S 8GiB  --showlogs jetson-xavier-nx-devkit external

This command will create two APP partitions (APP and APP_b) of 8GB in the SSD, and set APP (slot A) as the active and current slot.

8. Once the flashing procedure is done, you can enable automount service

systemctl start udisks2.service‏‏