Difference between revisions of "Xavier/Flashing the Board"

From RidgeRun Developer Connection
Jump to: navigation, search
(Created page with "<noinclude> {{Xavier/Head}} </noinclude> =Setting Board in Recovery Mode= To put the board into force USB Recovery Mode follow these instructions: <pre style="background:#d6e...")
 
Line 5: Line 5:
 
=Setting Board in Recovery Mode=
 
=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 style="background:#d6e4f1">
+
<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 Micro-B plug on the USB cable to the Recovery (USB Micro-B) 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.
4. Press POWER button.
+
4. Press and release the POWER button to power on device.
5. Press and hold the RECOVERY FORCE (REC) button.
+
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. While pressing the RECOVERY FORCE button, press and release the RESET button.
+
6. When the device is in recovery mode, lsusb command on host will list a line of "NVidia Corp"
7. Wait 2 seconds and release the RECOVERY FORCE button.
 
 
</pre>
 
</pre>
  
 
All examples assume that the board is in recovery mode.
 
All examples assume that the board is in recovery mode.
  
=Flash image with Jetpack=
+
=Flash Image with GUI Installer=
After following the instructions in [[Xavier/Installing Jetpack|Installing Jetpack]]
+
 
 +
This process will flash the image to the eMMC memory in the Jetson Board.
 +
After following the instructions in [[Xavier/Installing Jetpack|Installing Jetpack]] do the following:
  
  
Line 26: Line 27:
 
<br>  
 
<br>  
  
2. Follow the instructions in the pup-up window to put the device in recovery mode
+
2. Follow the instructions in the pop-up window to put the device in recovery mode
 
[[Image:Jetpack4 flash 04.png|frameless|center|455px|Start Installation]]  
 
[[Image:Jetpack4 flash 04.png|frameless|center|455px|Start Installation]]  
 
<div style="text-align: center;">'''Figure 2'''. Put Device in Recovery Mode</div>  
 
<div style="text-align: center;">'''Figure 2'''. Put Device in Recovery Mode</div>  
Line 43: Line 44:
  
  
=Flash the Board=
+
=Flash the 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.
 
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.
  
Line 91: Line 92:
 
===EMMC===
 
===EMMC===
  
<pre style="background:#d6e4f1">
+
<syntaxhighlight lang=bash>
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
sudo ./flash.sh jetson-xavier mmcblk0p1
 
sudo ./flash.sh jetson-xavier mmcblk0p1
</pre>
+
</syntaxhighlight>
  
 
===USB===
 
===USB===
Line 102: Line 103:
  
 
1) Insert your USB flash/drive in your PC and check where it was mounted
 
1) Insert your USB flash/drive in your PC and check where it was mounted
<pre style="background:#d6e4f1">
+
<syntaxhighlight lang=bash>
 
mount
 
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)
 
/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)
</pre>
+
</syntaxhighlight>
 +
 
 
2) Format the USB drive in your PCB
 
2) Format the USB drive in your PCB
<pre style="background:#d6e4f1">
+
<syntaxhighlight lang=bash>
 
umount /dev/sdb1
 
umount /dev/sdb1
 
sudo mkfs.ext4 /dev/sdb1
 
sudo mkfs.ext4 /dev/sdb1
</pre>
+
</syntaxhighlight>
 +
 
 
3) Copy the filesystem to the USB drive. It takes a while, its size is around 2.4GB
 
3) Copy the filesystem to the USB drive. It takes a while, its size is around 2.4GB
<pre style="background:#d6e4f1">
+
<syntaxhighlight lang=bash>
 
mkdir $DEVDIR/images/fs
 
mkdir $DEVDIR/images/fs
 
sudo mount /dev/sdb1 $DEVDIR/images/fs  
 
sudo mount /dev/sdb1 $DEVDIR/images/fs  
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/
 
sudo cp -a * $DEVDIR/images/fs  && sync
 
sudo cp -a * $DEVDIR/images/fs  && sync
</pre>
+
</syntaxhighlight>
 +
 
 
4) Unmount the USB drive and remove it
 
4) Unmount the USB drive and remove it
<pre>
+
<syntaxhighlight lang=bash>
 
sudo umount $DEVDIR/images/fs
 
sudo umount $DEVDIR/images/fs
</pre>
+
</syntaxhighlight>
 +
 
 +
 
 
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:
 
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:
<pre>
+
<syntaxhighlight lang=bash>
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
sudo ./flash.sh jetson-xavier sda1 #it can be other mount point
 
sudo ./flash.sh jetson-xavier sda1 #it can be other mount point
</pre>
+
</syntaxhighlight>
  
=== SD card ===
+
=== SD Card ===
  
 
Similar to USB but you need to replace the extlinux.conf so before copying the filesystem into the SD card run:
 
Similar to USB but you need to replace the extlinux.conf so before copying the filesystem into the SD card run:
<pre>
+
<syntaxhighlight lang=bash>
 
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 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
</pre>
+
</syntaxhighlight>
  
 
then flash it
 
then flash it
  
<pre>
+
<syntaxhighlight lang=bash>
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
sudo ./flash.sh jetson-xavier mmcblk1p1  
 
sudo ./flash.sh jetson-xavier mmcblk1p1  
</pre>
+
</syntaxhighlight>
  
 
=== NFS ===
 
=== NFS ===
Line 146: Line 152:
  
 
2) Open file in $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/etc/network/interfaces and add
 
2) Open file in $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/etc/network/interfaces and add
<pre>
+
<syntaxhighlight lang=bash>
 
auto eth0
 
auto eth0
 
iface eth0 inet manual
 
iface eth0 inet manual
</pre>
+
</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
 
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
  
<pre>
+
<syntaxhighlight lang=bash>
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
MY_IPADDRESS=192.169.0.3
 
MY_IPADDRESS=192.169.0.3
 
sudo ./flash.sh -N $MY_IPADDRESS:$JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs jetson-xavier eth0
 
sudo ./flash.sh -N $MY_IPADDRESS:$JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs jetson-xavier eth0
</pre>
+
</syntaxhighlight>
  
  
Line 163: Line 169:
 
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
 
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
  
<pre>
+
<syntaxhighlight lang=bash>
 
sudo cp $DEVDIR/images/zImage $DEVDIR/images/Image $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/boot/
 
sudo cp $DEVDIR/images/zImage $DEVDIR/images/Image $JETPACK_DIR/Xavier/Linux_for_Tegra/rootfs/boot/
</pre>
+
</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.
 
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.
  
<pre>
+
<syntaxhighlight lang=bash>
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
sudo ./apply_binaries.sh  
 
sudo ./apply_binaries.sh  
</pre>
+
</syntaxhighlight>
  
 
then flash your filesystem again.
 
then flash your filesystem again.
Line 181: Line 187:
 
Update the content of the EBT partition where uboot is located
 
Update the content of the EBT partition where uboot is located
  
<pre>
+
<syntaxhighlight lang=bash>
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
cd $JETPACK_DIR/Xavier/Linux_for_Tegra/
 
sudo ./flash.sh -k EBT jetson-xavier mmcblk1p1
 
sudo ./flash.sh -k EBT jetson-xavier mmcblk1p1
</pre>
+
</syntaxhighlight>
  
= Boot sequence =
+
= Boot Sequence =
 
According to the U-boot guide provided by Nvidia uboot scans booteable devices as follows:
 
According to the U-boot guide provided by Nvidia uboot scans booteable devices as follows:
 
*External SD Card
 
*External SD Card

Revision as of 15:14, 11 September 2018



  Index  



Nvidia-preferred-partner-badge-rgb-for-screen.png



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 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.
3. Connect the power adapter 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
Figure 1. Select Network Layout


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

Start Installation
Figure 2. Put Device in Recovery Mode


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

Start Installation
Figure 3. Flash Jetson Board


4. Wait for installation to finish

Start Installation
Figure 4. Finish Installation



Flash the 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 sda1 #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/
MY_IPADDRESS=192.169.0.3
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
  • Internal eMMC
  • USB Device
  • NFS Device



Previous: Installing Jetpack Index Next: Rebuilding kernel