Xavier/JetPack 5.0.2/Flashing Board: Difference between revisions

From RidgeRun Developer Wiki
(Created page with "<noinclude> {{Xavier/Head}} </noinclude> Nvidia provides several scripts to help to generate the images and to flash the resulting images. Including if you are going to insta...")
 
mNo edit summary
 
(29 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
{{Xavier/Head}}
{{Xavier/Head|previous=JetPack 5.0.2‎/Compiling_Code|next=JetPack_5.0.2/Performance_Tuning|metakeywords=jetpack,flashing,image,flash,flashing board}}
</noinclude>
</noinclude>


Nvidia provides several scripts to help to generate the images and to flash the resulting images. Including if you are going to install uboot or fastboot. The main script to flash it is $JETPACK_DIR/Xavier/Linux_for_Tegra/flash.sh. What this script will do is to install or flash the image in the desired destination. It is important that the script is controlled by variables defined in the DTB file.
{{DISPLAYTITLE:NVIDIA Jetson Xavier - Flashing Board using JetPack 5.0.2|noerror}}


=Setting Board in Recovery Mode=
__TOC__
This section provides a guide to flashing the Jetson Xavier OS components from the host computer command line. Flashing is the process of copying the files required into the selected storage from which the Xavier is going to boot. In the flashing process, we use the host computer and the Xavier.
 
 
This section assumes that you already have followed through our [[Xavier/JetPack_5.0.2/Getting_Started|Getting Started]] and [[Xavier/JetPack_5.0.2/Getting_Started/Installing_Jetpack|Installing Jetpack]] sections.
 
 
==Assumptions==
 
# You have Jetpack 5.0.2 installed on your host computer in the default path ($HOME/nvidia/nvidia_sdk/JetPack_5.0.2_Linux_JETSON_XAVIER_NX_TARGETS/Linux_for_Tegra). If your Jetpack installation used a different path, make sure to modify accordingly the JETPACK environment variable in Step 1.
 
# The OS components to be installed in the Xavier are stored in the default locations expected by the Jetpack flash script. If you haven't modified your Jetpack directory or if you followed our [[Xavier/JetPack_5.0.2/Compiling_Code|Compiling Code Section]], then the files should be in the default locations. If you have the files stored in a custom location, make sure to use the appropriate flags to indicate to the flash script the paths to the kernel, dtb, and bootloader.
 
==Step 1: Define the Environment Variables==
Make sure to run the following commands in the terminal that you will use to flash the Xavier.
 
 
<syntaxhighlight lang=bash>
export JETPACK=$HOME/nvidia/nvidia_sdk/JetPack_5.0.2_Linux_JETSON_XAVIER_NX_TARGETS/Linux_for_Tegra
</syntaxhighlight>
 
== Step 2: Set Board in Recovery Mode ==
 
In order to flash the Xavier, we must set it in recovery mode so that it can accept the files. The procedure to put the Xavier in recovery mode can be found on the SDK manager, just ignore step 1.
 
[[Image:Recovery_instructions_xavier.png|frameless|center|455px|Start Installation]]
<div style="text-align: center;">'''Figure 1'''. Put Device in Recovery Mode</div>
 
<br>
 
At this point, Xavier should be in recovery mode. To verify, you can run the following command on your host computer:
<pre>
lsusb
</pre>
 
If the Xavier is in recovery mode, you should see a line similar to the following among the command output:
<pre>
Bus 003 Device 015: ID 0955:7e19 NVIDIA Corp.
</pre>
 
<br>
 
== Step 3 (Optional): Create a Default User ==
 
 
The default user/password can be configured after flashing if you can connect a display, keyboard, and mouse to the Xavier to complete the OEM configuration during the first boot. If you wish to save time and create a default user/password for your Xavier before flashing, you can execute the commands below, make sure to replace <user_name> and <password> for a username and password of your choice.
 
 
<syntaxhighlight lang=bash>
cd $JETPACK/tools
sudo ./l4t_create_default_user.sh -u <user_name> -p <password>
</syntaxhighlight>
 
== Step 4: Execute the Flash Script ==
 
NVIDIA provides a script for flashing the Xavier in the Jetpack directory. This script takes two arguments, the '''target board''', and the '''root device''':
<br>
 
 
<syntaxhighlight lang=bash>
cd $JETPACK
sudo ./flash.sh <target board> <rootdev>
</syntaxhighlight>
 
 
To see the possible options of the target board go to the Linux_for_Tegra folder and check the *.conf names, some examples are:
 
*jetson-xavier-nx-devkit
*jetson-xavier-nx-devkit-emmc
*jetson-xavier-nx-devkit-qspi
 
In the following subsections, we are going to use the jetson-xavier-nx-devkit configuration to flash the Xavier.
<br>
 
 
The root device indicates the storage that will be used to boot the Xavier, some available options are:
 
*internal
*external
*mmcblk0p1
*mmcblk1p1
 
You can read the description for each of these in the flash.sh code.
 
 
The following subsections show the command to flash each of the storage options available.
 
===Option #1: eMMC===
This option is the most simple, just execute the following commands:
 
<syntaxhighlight lang=bash>
cd $JETPACK
sudo ./flash.sh jetson-xavier-nx-devkit mmcblk0p1
</syntaxhighlight>
 
 
The flashing process will take a while, and should print a success message if the flash is finished successfully. After the flash script finishes successfully, the Xavier will boot automatically.
 
{{Review|Add more methods|fherrera}}
 
<!--
 
=== Option #2: USB Drive ===
 
This option requires copying the OS components to the USB.
 
 
==== Prepare the USB Drive ====
First, you will need to identify the mount point of the USB Drive. To do so, you can run the following command before and after connecting the USB Drive to your host computer and identify the new line that appears:
 
<syntaxhighlight lang=bash>
mount
</syntaxhighlight>
 
The mount command will print a list of block devices and the mountpoint. For example, in our case, the following line wasn't printed by mount before connecting the USB Drive but was printed by mount after the USB Drive was connected:
 
<syntaxhighlight lang=bash>
/dev/sdd1 on /media/$USER/bde7a526-1b2d-4ad3-925f-4650b2563ab7 type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)
</syntaxhighlight>
 
This indicates that the block device for the USB Drive is /dev/sdd1.
 
Now that the block device of the USB Drive has been identified, you can format the USB drive in your host computer using the commands below. Make sure to replace </dev/sdX> with your actual device.
 
<syntaxhighlight lang=bash>
umount </dev/sdX>
sudo mkfs.ext4 </dev/sdX>
</syntaxhighlight>
 
At this point, you can proceed to copy the files to the USB drive. This can take a while because around 6GB need to be copied:
 
<syntaxhighlight lang=bash>
cd $JETPACK
sudo mkdir tmp_system
sudo mount </dev/sddX> $JETPACK/tmp_system
cd rootfs/
sudo cp -a * $JETPACK/tmp_system && sync
</syntaxhighlight>
 
When the copy finishes, you can proceed to umount the USB Drive with the following command:
 
<syntaxhighlight lang=bash>
sudo umount $JETPACK_DIR/tmp_system
</syntaxhighlight>
 
At this point, you can disconnect the USB Drive.
 
====Flash====
Connect the USB Drive where you copied the files to the Jetson AGX Orin. Then, flash the board with the following commands:
 
<syntaxhighlight lang=bash>
cd $JETPACK
sudo ./flash.sh jetson-agx-orin-devkit sda1 #it can be another mount point
</syntaxhighlight>
 
 
After the flash script finishes successfully, the Orin will boot automatically
 
==NVMe==
<syntaxhighlight lang=bash>
cd $JETPACK
sudo ./flash.sh jetson-agx-orin-devkit  nvme0n1p1
</syntaxhighlight>
 
 
To flash the Jetson Orin you need to set the board in Recovery Mode. This Mode can be set by connecting the USB Type-C to the board and the USB port on the host PC. The USB Type-C port is shown in the figure below. Before setting the board in Recovery Mode is important to know that when the power supply is connected, the Jetson Orin board will power on automatically.
 
 
[[File:Orin-usb-typeC-.jpg|800px|thumb|center|Port USB-Type C.]]
==Setting Board in Recovery Mode==
To put the board into force USB Recovery Mode follow these instructions:
To put the board into force USB Recovery Mode follow these instructions:
<pre>
<pre>
1. Power down the device. If connected, remove the AC adapter from the device. The device must be powered OFF, and not in a suspend or sleep state.
1. Power down the device. If connected, remove the AC adapter from the device. The device must be powered OFF, and not in a suspend or sleep state.
2. Connect the Type-C plug on the USB cable to the Recovery (USB Type-C) Port on the device and the other end to an available USB port on the host PC.
2. Connect the Type-C plug on the USB cable to the Recovery (USB Type-C) Port on the device and the other end to an available USB port on the host PC.
3. Connect the power adapter to the device.
3. Connect the power adapter to the device. The board will power on automatically.
4. Press and release the POWER button to power on device.
4. Press and hold the FORCE RECOVERY button: while pressing the FORCE RECOVERY button, press the RESET button, then release both.
5. Press and hold the FORCE RECOVERY button: while pressing the FORCE RECOVERY button, press and release the RESET button; wait two seconds and release the FORCE RECOVERY button.
5. Check if the device is in recovery mode by using the lsusb command. A line is similar to "Bus 001 Device 011: ID 0955:7023 NVidia Corp" will appear listed as the output command on the host terminal.
6. When the device is in recovery mode, lsusb command on host will list a line of "NVidia Corp"
</pre>
</pre>


All examples assume that the board is in recovery mode.
All examples assume that the board is in recovery mode.


=Flash Script Options=
==Flash Script Options==
<pre>
 
NVIDIA provides several scripts to help to generate the images and to flash the resulting images.
 
This is the main script to flash :
 
<syntaxhighlight lang=bash>
JETPACK_DIR=/home/$USER/nvidia/nvidia_sdk/JetPack_5.0_DP_Linux_DP_JETSON_AGX_ORIN_TARGETS/flash.sh.
</syntaxhighlight>
 
What this script will do is install or flash the image to the desired destination. The script is controlled by variables defined in the DTB file.
 
<syntaxhighlight lang=bash>  
# Examples:
# Examples:
# ./flash.sh <target_board> mmcblk0p1                   - boot <target_board> from eMMC
# ./flash.sh <target_board> internal - boot <target_board> from on-board device (eMMC/SDCARD)
# ./flash.sh <target_board> mmcblk1p1                   - boot <target_board> from SDCARD
# ./flash.sh <target_board> external - boot <target_board> from external device
# ./flash.sh <target_board> sda1                       - boot <target_board> from USB device
# ./flash.sh <target_board> mmcblk0p1 - boot <target_board> from eMMC
# ./flash.sh -N <IPaddr>:/nfsroot <target_board> eth0   - boot <target_board> from NFS
# ./flash.sh <target_board> mmcblk1p1 - boot <target_board> from SDCARD
# ./flash.sh -k LNX <target_board> mmcblk1p1           - update <target_board> kernel
# ./flash.sh <target_board> sda1 - boot <target_board> from USB device
# ./flash.sh -k EBT <target_board> mmcblk1p1           - update <target_board> bootloader
# ./flash.sh <target_board> nvme0n1 - boot <target_board> from NVME storage device
# ./flash.sh -N <IPaddr>:/nfsroot <target_board> eth0 - boot <target_board> from NFS
# ./flash.sh -k LNX <target_board> mmcblk1p1 - update <target_board> kernel
# ./flash.sh -k EBT <target_board> mmcblk1p1 - update <target_board> bootloader
#
#
# Optional Environment Variables:
# Optional Environment Variables:
# BCTFILE ---------------- Boot control table configuration file to be used.
# BCTFILE ---------------- Boot control table configuration file to be used.
# BOARDID ---------------- Pass boardid to override EEPROM value
# BOARDID ---------------- Pass boardid to override EEPROM value
# BOARDREV --------------- Pass board_revision to override EEPROM value
# BOARDSKU --------------- Pass board_sku to override EEPROM value
# BOOTLOADER ------------- Bootloader binary to be flashed
# BOOTLOADER ------------- Bootloader binary to be flashed
# BOOTPARTLIMIT ---------- GPT data limit. (== Max BCT size + PPT size)
# BOOTPARTLIMIT ---------- GPT data limit. (== Max BCT size + PPT size)
Line 39: Line 226:
# DTBFILE ---------------- Device Tree file to be used.
# DTBFILE ---------------- Device Tree file to be used.
# EMMCSIZE --------------- Size of target device eMMC (boot0+boot1+user).
# EMMCSIZE --------------- Size of target device eMMC (boot0+boot1+user).
# EMCFUSE_VALUE ---------- Value of emc fuse.
# FLASHAPP --------------- Flash application running in host machine.
# FLASHAPP --------------- Flash application running in host machine.
# FLASHER ---------------- Flash server running in target machine.
# FLASHER ---------------- Flash server running in target machine.
# IGNOREFASTBOOTCMDLINE -- Block fastboot from filling unspecified kernel
#                          cmdline parameters with its defaults.
# INITRD ----------------- Initrd image file to be flashed.
# INITRD ----------------- Initrd image file to be flashed.
# KERNEL_IMAGE ----------- Linux kernel zImage file to be flashed.
# KERNEL_IMAGE ----------- Linux kernel zImage file to be flashed.
Line 50: Line 236:
#   <C-ipa>:<S-ipa>:<G-ipa>:<netmask>
#   <C-ipa>:<S-ipa>:<G-ipa>:<netmask>
# NFSROOT ---------------- NFSROOT i.e. <my IP addr>:/exported/rootfs_dir.
# NFSROOT ---------------- NFSROOT i.e. <my IP addr>:/exported/rootfs_dir.
# NO_KERNEL_DTB ---------- Do not use kernel dtb.
# NO_RECOVERY_IMG -------- Do not create or re-create recovery.img
# NO_ROOTFS -------------- Do not create or re-create system.img
# ODMDATA ---------------- Odmdata to be used.
# ODMDATA ---------------- Odmdata to be used.
# PKCKEY ----------------- RSA key file to used to sign bootloader images.
# ROOTFSSIZE ------------- Linux RootFS size (internal emmc/nand only).
# ROOTFSSIZE ------------- Linux RootFS size (internal emmc/nand only).
# ROOTFS_DIR ------------- Linux RootFS directory name.
# ROOTFS_DIR ------------- Linux RootFS directory name.
# SCEFILE ---------------- SCE firmware file such as camera-rtcpu-sce.bin.
# SBKKEY ----------------- SBK key file to used to encrypt bootloader images.
# SCEFILE ---------------- SCE firmware file such as camera-rtcpu-sce.img.
# SPEFILE ---------------- SPE firmware file path such as bootloader/spe.bin.
# SPEFILE ---------------- SPE firmware file path such as bootloader/spe.bin.
# FAB -------------------- Target board's FAB ID.
# FAB -------------------- Target board's FAB ID.
# TEGRABOOT -------------- lowerlayer bootloader such as nvtboot.bin.
# TEGRABOOT -------------- lowerlayer bootloader such as nvtboot.bin.
# WB0BOOT ---------------- Warmboot code such as nvtbootwb0.bin
# WB0BOOT ---------------- Warmboot code such as nvtbootwb0.bin
</pre>
</syntaxhighlight>
 
=== eMMc ===


=Flash Filesystem=
{{review|why did we move to cmdline scripts? Does the sdkmanager not support flashing the MMC? if so, please specify that.|mgruner}}


==EMMC==
Before flashing the eMMC for the first time a new user must be set. You can do so by running:


{{review|Please parametrize commands. Instead of <user> use $USER and the variable set on top|mgruner}}
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
JETPACK_DIR=/home/$USER/JetPack/
JETPACK_DIR=/home/$USER/nvidia/nvidia_sdk/JetPack_5.0_DP_Linux_DP_JETSON_AGX_ORIN_TARGETS/
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
cd $JETPACK_DIR/Linux_for_Tegra/tools
sudo ./flash.sh jetson-xavier mmcblk0p1
sudo ./l4t_create_default_user.sh -u <user_name> -p <password>
</syntaxhighlight>
</syntaxhighlight>


==USB==
For example:  
'''Important:''' Only for USB tegra needs a firmware that is loaded from the filesystem so the USB port is not enabled on uboot and then it causes problems to mount the fs from there, you can read about it [https://devtalk.nvidia.com/default/topic/933850/jetson-tx1/tx1-boot-from-usb/?offset=2#4871443 here].
 
To flash the filesystem to USB you need to put the filesystem on the USB first
 
1) Insert your USB flash/drive in your PC and check where it was mounted:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
$ mount
sudo ./l4t_create_default_user.sh -u nvidia -p nvidia
/dev/sdb1 on /media/$USER/EF02-5626 type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2)
</syntaxhighlight>
</syntaxhighlight>


2) Format the USB drive in your PCB
After creating the user name, follow the next steps to flash the Orin with the flash script.
 
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
umount /dev/sdb1
JETPACK_DIR=/home/$USER/nvidia/nvidia_sdk/JetPack_5.0_DP_Linux_DP_JETSON_AGX_ORIN_TARGETS/
sudo mkfs.ext4 /dev/sdb1
cd $JETPACK_DIR/Linux_for_Tegra/
sudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1
</syntaxhighlight>
</syntaxhighlight>


3) Copy the filesystem to the USB drive. It takes a while, its size is around 2.4GB
=== USB Drive ===
<syntaxhighlight lang=bash>
JETPACK_DIR=/home/$USER/JetPack/
DEVDIR=/home/$USER/devdirs/
mkdir $DEVDIR/images/fs
sudo mount /dev/sdb1 $DEVDIR/images/fs
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/
sudo cp -a * $DEVDIR/images/fs  && sync
</syntaxhighlight>


4) Unmount the USB drive and remove it
To flash the filesystem to USB you need to put the filesystem on the USB first.
<syntaxhighlight lang=bash>
sudo umount $DEVDIR/images/fs
</syntaxhighlight>


Insert your USB flash/drive into your PC and check where it was mounted:


5) Finally connect the USB drive to the Jetson board put the Jetson on recovery mode, flash the board to look for the filesystem on the USB port:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
/dev/sdd1 on /media/$USER/bde7a526-1b2d-4ad3-925f-4650b2563ab7 type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)
sudo ./flash.sh jetson-xavier sdb1 #it can be other mount point
</syntaxhighlight>
</syntaxhighlight>


== SD Card ==
Format the USB drive in your PC


Similar to USB but you need to replace the extlinux.conf so before copying the filesystem into the SD card run:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
JETPACK_DIR=/home/$USER/JetPack/
umount /dev/sdd1
sudo cp $JETPACK_DIR/Xavier/Linux_for_Tegra/bootloader/t186ref/p2771-0000/extlinux.conf.sdcard $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/boot/extlinux/extlinux.conf
sudo mkfs.ext4 /dev/sdd1
</syntaxhighlight>
</syntaxhighlight>


then flash it
Copy the filesystem to the USB drive. It takes a while, its size is around 6GB


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
JETPACK_DIR=/home/$USER/nvidia/nvidia_sdk/JetPack_5.0_DP_Linux_DP_JETSON_AGX_ORIN_TARGETS
sudo ./flash.sh jetson-xavier mmcblk1p1
cd $JETPACK_DIR/Linux_for_Tegra
sudo mkdir tmp_system
sudo mount /dev/sdd1 $JETPACK_DIR/Linux_for_Tegra/tmp_system
cd rootfs/
sudo cp -a * $JETPACK_DIR/Linux_for_Tegra/tmp_system && sync
</syntaxhighlight>
</syntaxhighlight>


== NFS ==
Umount the USB drive and remove it from your PC
1) First you need to set up your NFS server using [https://developer.ridgerun.com/wiki/index.php/Getting_Started_Guide_for_DM8168_EVM#Setting_up_an_NFS_server these instructions].


2) Open file in $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/etc/network/interfaces and add
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
auto eth0
sudo umount $JETPACK_DIR/Linux_for_Tegra/tmp_system
iface eth0 inet manual
</syntaxhighlight>
</syntaxhighlight>


3) Then flash the board to generate and install the initrd image to use nfs, you need to do this everytime that you recompile the kernel
Finally, connect the USB drive to the Jetson AGX Orin board and put it in recovery mode. Then, flash the board to look for the filesystem on the USB port:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
JETPACK_DIR=/home/$USER/JetPack/
cd $JETPACK_DIR/Linux_for_Tegra
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
sudo ./flash.sh jetson-agx-orin-devkit sda1 #it can be another mount point
sudo ./flash.sh -N $MY_IPADDRESS:$JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs jetson-xavier eth0
</syntaxhighlight>
</syntaxhighlight>


-->


=Flash Kernel=
<!--
To flash your kernel you just need to copy it to /boot in your filesystem. The old method to flash it in the LNX partition (./flash.sh -k LNX <target_board> mmcblk1p1) is NOT longer used


<syntaxhighlight lang=bash>
== Known Issues ==
JETPACK_DIR=/home/$USER/JetPack/
 
sudo cp $DEVDIR/images/zImage $DEVDIR/images/Image $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/boot/
=== Display Port Graphical Interface ===
</syntaxhighlight>


if you are not booting from NFS then you need to reflash your filesysm in order to update the kernel. However, likely you did some changes in the kernel modules so it is recommended to run the apply_binaries.sh script instead of only copying the kernel images.
The board does not boot correctly or provide a graphical interface when a monitor is powered on and connected to the Display Port output during boot. It only shows the NVIDIA Logo before booting, and the BIOS interface if the Escape key is pressed. Running dmesg in the Orin AGX terminal and disconnecting/connecting the cable shows the following messages:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
[  299.546829] NVRM rpcRmApiControl_dce: NVRM_RPC_DCE: Failed RM ctrl call result 0xffff:
sudo ./apply_binaries.sh
[  309.799053] NVRM rpcRmApiControl_dce: NVRM_RPC_DCE: Failed RM ctrl call result 0x25:
</syntaxhighlight>
</syntaxhighlight>


then flash your filesystem again.
To avoid this issue, make sure that the monitor is turned off when booting the Orin AGX. After it has booted, the monitor can be turned on and it should show a graphical interface.


=== USB Drive preparation for flashing ===


=Flash Bootloader=
NVIDIA provides a guide for Flashing to a USB Drive in the following link:


Update the content of the EBT partition where uboot is located
[https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/SD/FlashingSupport.html#to-set-up-a-flash-drive-manually-for-using-as-root-file-system Flashing to a USB Drive]


However, after following the next commands:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
JETPACK_DIR=/home/$USER/JetPack/
sudo mount bootloader/system.img.raw ./tmp_system
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
sudo rsync -axHAWX --numeric-ids --info=progress2 --exclude=/proc ./tmp_system/ /mnt
sudo ./flash.sh -k EBT jetson-xavier mmcblk1p1
</syntaxhighlight>
</syntaxhighlight>


= Boot Sequence =
The USB drive only has a directory name ''boot'' and does not have the filesystem. To avoid this issue, make sure to use the commands in our previous '''Prepare the USB Drive''' section to copy the required files to the USB drive.
According to the U-boot guide provided by Nvidia uboot scans booteable devices as follows:
 
*External SD Card
-->
*USB Device
*Internal eMMC
*NFS Device


<noinclude>
<noinclude>
{{Xavier/Foot|<Replace with "previous" page>|In_Board}}
{{Xavier/Foot|JetPack 5.0.2‎/Compiling_Code|JetPack_5.0.2/Performance_Tuning}}
</noinclude>
</noinclude>

Latest revision as of 17:03, 8 August 2023




Previous: JetPack 5.0.2‎/Compiling_Code Index Next: JetPack_5.0.2/Performance_Tuning






This section provides a guide to flashing the Jetson Xavier OS components from the host computer command line. Flashing is the process of copying the files required into the selected storage from which the Xavier is going to boot. In the flashing process, we use the host computer and the Xavier.


This section assumes that you already have followed through our Getting Started and Installing Jetpack sections.


Assumptions

  1. You have Jetpack 5.0.2 installed on your host computer in the default path ($HOME/nvidia/nvidia_sdk/JetPack_5.0.2_Linux_JETSON_XAVIER_NX_TARGETS/Linux_for_Tegra). If your Jetpack installation used a different path, make sure to modify accordingly the JETPACK environment variable in Step 1.
  1. The OS components to be installed in the Xavier are stored in the default locations expected by the Jetpack flash script. If you haven't modified your Jetpack directory or if you followed our Compiling Code Section, then the files should be in the default locations. If you have the files stored in a custom location, make sure to use the appropriate flags to indicate to the flash script the paths to the kernel, dtb, and bootloader.

Step 1: Define the Environment Variables

Make sure to run the following commands in the terminal that you will use to flash the Xavier.


export JETPACK=$HOME/nvidia/nvidia_sdk/JetPack_5.0.2_Linux_JETSON_XAVIER_NX_TARGETS/Linux_for_Tegra

Step 2: Set Board in Recovery Mode

In order to flash the Xavier, we must set it in recovery mode so that it can accept the files. The procedure to put the Xavier in recovery mode can be found on the SDK manager, just ignore step 1.

Start Installation
Start Installation
Figure 1. Put Device in Recovery Mode


At this point, Xavier should be in recovery mode. To verify, you can run the following command on your host computer:

lsusb

If the Xavier is in recovery mode, you should see a line similar to the following among the command output:

Bus 003 Device 015: ID 0955:7e19 NVIDIA Corp.


Step 3 (Optional): Create a Default User

The default user/password can be configured after flashing if you can connect a display, keyboard, and mouse to the Xavier to complete the OEM configuration during the first boot. If you wish to save time and create a default user/password for your Xavier before flashing, you can execute the commands below, make sure to replace <user_name> and <password> for a username and password of your choice.


 cd $JETPACK/tools
 sudo ./l4t_create_default_user.sh -u <user_name> -p <password>

Step 4: Execute the Flash Script

NVIDIA provides a script for flashing the Xavier in the Jetpack directory. This script takes two arguments, the target board, and the root device:


cd $JETPACK
sudo ./flash.sh <target board> <rootdev>


To see the possible options of the target board go to the Linux_for_Tegra folder and check the *.conf names, some examples are:

  • jetson-xavier-nx-devkit
  • jetson-xavier-nx-devkit-emmc
  • jetson-xavier-nx-devkit-qspi

In the following subsections, we are going to use the jetson-xavier-nx-devkit configuration to flash the Xavier.


The root device indicates the storage that will be used to boot the Xavier, some available options are:

  • internal
  • external
  • mmcblk0p1
  • mmcblk1p1

You can read the description for each of these in the flash.sh code.


The following subsections show the command to flash each of the storage options available.

Option #1: eMMC

This option is the most simple, just execute the following commands:

cd $JETPACK
sudo ./flash.sh jetson-xavier-nx-devkit mmcblk0p1


The flashing process will take a while, and should print a success message if the flash is finished successfully. After the flash script finishes successfully, the Xavier will boot automatically.




Previous: JetPack 5.0.2‎/Compiling_Code Index Next: JetPack_5.0.2/Performance_Tuning