NVIDIA Xavier - Flashing the Board

From RidgeRun Developer Wiki




  Index  





Setting Board in Recovery Mode

To put the board into force USB Recovery Mode follow these instructions:

1. Power down the device. If connected, remove the AC adaptor 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.
3. Connect the power adaptor to the device.
4. Press and release the POWER button to power on device.
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.
6. When the device is in recovery mode, lsusb command on host will list a line of "NVidia Corp"

All examples assume that the board is in recovery mode.

Flash Image with GUI Installer

This process will flash the image to the eMMC memory in the Jetson Board. After following the instructions in Installing Jetpack do the following:


1. Select network layout and interfaces for the specific enviroment

Start Installation
Start Installation
Figure 1. Select Network Layout


2. Follow the instructions in the pop-up window to put the device in recovery mode

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


3. Press next to perform the OS flash and install the desired components

Start Installation
Start Installation
Figure 3. Flash Jetson Board


4. Wait for installation to finish

Start Installation
Start Installation
Figure 4. Finish Installation


Flash Image with Cmdline Installer

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.

# Examples:
# ./flash.sh <target_board> mmcblk0p1                   - boot <target_board> from eMMC
# ./flash.sh <target_board> mmcblk1p1                   - boot <target_board> from SDCARD
# ./flash.sh <target_board> sda1                        - boot <target_board> from USB 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:
# BCTFILE ---------------- Boot control table configuration file to be used.
# BOARDID ---------------- Pass boardid to override EEPROM value
# BOOTLOADER ------------- Bootloader binary to be flashed
# BOOTPARTLIMIT ---------- GPT data limit. (== Max BCT size + PPT size)
# BOOTPARTSIZE ----------- Total eMMC HW boot partition size.
# CFGFILE ---------------- Partition table configuration file to be used.
# CMDLINE ---------------- Target cmdline. See help for more information.
# DEVSECTSIZE ------------ Device Sector size. (default = 512Byte).
# DTBFILE ---------------- Device Tree file to be used.
# EMMCSIZE --------------- Size of target device eMMC (boot0+boot1+user).
# FLASHAPP --------------- Flash application running in host 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.
# KERNEL_IMAGE ----------- Linux kernel zImage file to be flashed.
# MTS -------------------- MTS file name such as mts_si.
# MTSPREBOOT ------------- MTS preboot file name such as mts_preboot_si.
# NFSARGS ---------------- Static Network assignments.
#			   <C-ipa>:<S-ipa>:<G-ipa>:<netmask>
# NFSROOT ---------------- NFSROOT i.e. <my IP addr>:/exported/rootfs_dir.
# ODMDATA ---------------- Odmdata to be used.
# ROOTFSSIZE ------------- Linux RootFS size (internal emmc/nand only).
# ROOTFS_DIR ------------- Linux RootFS directory name.
# SCEFILE ---------------- SCE firmware file such as camera-rtcpu-sce.bin.
# SPEFILE ---------------- SPE firmware file path such as bootloader/spe.bin.
# FAB -------------------- Target board's FAB ID.
# TEGRABOOT -------------- lowerlayer bootloader such as nvtboot.bin.
# WB0BOOT ---------------- Warmboot code such as nvtbootwb0.bin

Flash Filesystem

EMMC

cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
sudo ./flash.sh jetson-xavier mmcblk0p1

USB

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

$ mount
/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)

2) Format the USB drive in your PCB

umount /dev/sdb1
sudo mkfs.ext4 /dev/sdb1

3) Copy the filesystem to the USB drive. It takes a while, its size is around 2.4GB

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

4) Unmount the USB drive and remove it

sudo umount $DEVDIR/images/fs


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:

cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
sudo ./flash.sh jetson-xavier sdb1 #it can be other mount point

SD Card

Similar to USB but you need to replace the extlinux.conf so before copying the filesystem into the SD card run:

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

then flash it

cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
sudo ./flash.sh jetson-xavier mmcblk1p1

NFS

1) First you need to set up your NFS server using these instructions.

2) Open file in $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/etc/network/interfaces and add

auto eth0
iface eth0 inet manual

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

cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
sudo ./flash.sh -N $MY_IPADDRESS:$JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs jetson-xavier eth0


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

sudo cp $DEVDIR/images/zImage $DEVDIR/images/Image $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/boot/

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.

cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
sudo ./apply_binaries.sh

then flash your filesystem again.


Flash Bootloader

Update the content of the EBT partition where uboot is located

cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
sudo ./flash.sh -k EBT jetson-xavier mmcblk1p1

Boot Sequence

According to the U-boot guide provided by Nvidia uboot scans booteable devices as follows:

  • External SD Card
  • USB Device
  • Internal eMMC
  • NFS Device



Previous: Installing Jetpack Index Next: Rebuilding kernel