Difference between revisions of "Linux BSP User Guide for jetson series"

From ESS-WIKI
Jump to: navigation, search
Line 181: Line 181:
  
 
<span style="font-size:medium;"><span style="color:#006400;">'''Miscellaneous'''</span> </span><br/> [[EPC-R7200-UIO|EPC-R7200-UIO]]<br/> [[AIR-020-RS-485|AIR-020-RS-485]]
 
<span style="font-size:medium;"><span style="color:#006400;">'''Miscellaneous'''</span> </span><br/> [[EPC-R7200-UIO|EPC-R7200-UIO]]<br/> [[AIR-020-RS-485|AIR-020-RS-485]]
 +
<br/>[[:File:AIR-020-nVidia_GPIO.docx|Calculate GPIO value from pin number]]
  
 
<span style="font-size:medium;"><span style="color:#006400;">'''OTA'''</span></span><br/> [https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3261/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/updating_jetson_and_host.html nVidia:Over-the-Air Update]<br/> [https://developer.ridgerun.com/wiki/index.php/How_to_Use_A/B_Filesystem_Redundancy_and_OTA_with_NVIDIA_Jetpack How to Use A/B Filesystem Redundancy and OTA with NVIDIA Jetpack]<br/> [https://wiki.seeedstudio.com/Update-Jetson-Linux-OTA-Using-Allxon/ Update Jetson Linux Over-the-Air Using Allxon]
 
<span style="font-size:medium;"><span style="color:#006400;">'''OTA'''</span></span><br/> [https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3261/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/updating_jetson_and_host.html nVidia:Over-the-Air Update]<br/> [https://developer.ridgerun.com/wiki/index.php/How_to_Use_A/B_Filesystem_Redundancy_and_OTA_with_NVIDIA_Jetpack How to Use A/B Filesystem Redundancy and OTA with NVIDIA Jetpack]<br/> [https://wiki.seeedstudio.com/Update-Jetson-Linux-OTA-Using-Allxon/ Update Jetson Linux Over-the-Air Using Allxon]
  
<span style="font-size:medium;"><span style="color:#006400;">'''Backup / Restore'''</span></span>
+
<span style="font-size:medium;"><span style="color:#006400;">'''Backup / Restore'''</span></span><br/> [https://elinux.org/Jetson/Clone eLinux:Jetson/Clone]<br/> <br/> <span style="font-size:medium;"><span style="color:#006400;">'''Boot Device'''</span></span>
  
<span style="font-size:medium;"><span style="color:#006400;">'''Boot Device'''</span></span>
 
  
In CBoot, there is bootable menu,
 
<pre>[0002.262] I> Using default boot order
 
[0002.265] I> boot-dev-order&nbsp;:-
 
[0002.268] I> 1.sd
 
[0002.270] I> 2.usb
 
[0002.272] I> 3.nvme
 
[0002.274] I> 4.emmc
 
[0002.276] I> 5.net
 
[0002.277] I> Hit any key to stop autoboot:    4      3      2      1
 
</pre>
 
  
Change the boot order, you may type
 
<pre>$ setvar boot-order emmc, sd, usb, net
 
</pre>
 
 
or
 
<pre>$ setvar boot-order emmc
 
</pre>
 
 
And boot the system
 
<pre>$ boot
 
</pre>
 
 
For example, there are two of bootable devices - NVME SSD and EMMC If the NVME SSD was plugged-in, the system will always boot NVME SSD.
 
 
<span style="font-size:medium;"><span style="color:#006400;">'''Boot to Rootfs in external storage'''</span></span>
 
 
<span style="font-size:bold;">'''Make Rootfs'''</span>
 
 
1.Check the external drive’s device name (e.g. NVME&nbsp;: /dev/nvmeXn1, U-Disk&nbsp;: /dev/sdX): The <search_keyword> will be NVME&nbsp;: nvme and U-Disk&nbsp;: sd
 
<pre>$ lsblk -d -p | grep <search_keyword> | cut -d\  -f 1</pre>
 
 
Note that there must be two spaces after the ‑d\.
 
 
2.Create a new GPT:
 
<pre>$ sudo parted /dev/<device> mklabel gpt</pre>
 
 
Where <device> is the device name that your host computer assigns to the external drive. For example, if the host computer assigns the NVMe drive device name nvme0n1, the command is:
 
<pre>$ sudo parted /dev/nvme0n1 mklabel gpt</pre>
 
 
3.Add the APP partition:
 
<pre>$ sudo parted /dev/<device> mkpart APP 0GB <size></pre>
 
 
Where <size> is the size of the partition. It must be at least 16 GB. It may be larger if the external drive has enough space. For example, if <device> is nvme0n1 and the partition is to contain 16 GB, enter:
 
<pre>$ sudo parted /dev/nvme0n1 mkpart APP 0GB 16GB</pre>
 
 
The NVME device name of the APP partition <DPART> is then <nvmeXn1>p1.<br/> The U-Disk device name of the APP partition <DPART> is then <sdX>1.
 
 
4.Format APP as an ext4 partition and mount it.
 
<pre>$ sudo mkfs.ext4 /dev/<DPART>
 
$ sudo mount /dev/<DPART> /mnt
 
</pre>
 
 
You may format APP as ext2 or ext3, but ext4 is strongly recommended because it is faster, more compact, and more reliable.
 
 
5.Connect the Jetson device to a host computer and put it into recovery mode, then enter the following commands to generate the rootfs without flashing the device:
 
<pre>$ cd Linux_for_Tegra/
 
$ sudo BOOTDEV=<DPART> ./flash.sh --no-flash <board> <DPART>
 
$ sudo mkdir tmp_system
 
$ sudo mount bootloader/system.img.raw ./tmp_system
 
$ sudo rsync -axHAWX --numeric-ids --info=progress2 --exclude=/proc ./tmp_system/ /mnt
 
</pre>
 
 
Where <DPART> is the device name that the Jetson device will assign to APP.
 
 
6.Unmount the external drive and disconnect it from the host computer:
 
<pre>$ sudo umount /mnt
 
$ sudo umount ./tmp_system
 
</pre>
 
 
7.Plug the external drive into the target device and power on.
 
 
reference&nbsp;: [https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/flashing.html#wwpID0E0VM0HA nVidia]
 
 
<span style="font-size:bold;">'''Set up boot menu for multi-rootfs'''</span>
 
 
During system boot to u-boot, it will check the file&nbsp;/boot/extlinux/extlinux.conf&nbsp;to select one of rootfs.<br/> The following example added NVME and SD card for candidate. the default rootfs will be&nbsp;'''''primary'''''. You may choose one of option in console termianl or default if there was&nbsp;no any selection.<br/> Modify the root path to the&nbsp;<DPART> for every external storage
 
<pre>TIMEOUT 30
 
DEFAULT primary
 
 
MENU TITLE L4T boot options
 
 
LABEL primary
 
      MENU LABEL primary kernel
 
      LINUX /boot/Image
 
      INITRD /boot/initrd
 
      FDT /boot/tegra194-epcr7200.dtb
 
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0
 
 
LABEL sdcard
 
      MENU LABEL Boot from SD Card
 
      LINUX /boot/Image
 
      INITRD /boot/initrd
 
      FDT /boot/tegra194-epcr7200.dtb
 
      APPEND ${cbootargs} quiet root=/dev/mmcblk1p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0
 
 
LABEL UIO-4040
 
      MENU LABEL Boot from UIO-4040
 
      LINUX /boot/Image
 
      INITRD /boot/initrd
 
      FDT /boot/tegra194-epcr7200.dtb
 
      APPEND ${cbootargs} quiet root=/dev/sda1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0
 
</pre>
 
 
<span style="font-size:medium;"><span style="color:#006400;">'''Calculate GPIO value from pin number'''</span></span>
 
 
[[:File:AIR-020-nVidia_GPIO.docx|AIR-020-nVidia_GPIO.docx]]
 
  
 
<span style="font-size:medium;"><span style="color:#006400;">'''Device PID VID'''</span></span>
 
<span style="font-size:medium;"><span style="color:#006400;">'''Device PID VID'''</span></span>

Revision as of 04:25, 7 September 2022

Linux BSP Version

Ubuntu 18.04
Kernel 4.9.201

Released Image

Build Environment on Host

Currently, we adopt Docker as build environment.
You can get the latest version of advrisc/u18.04-imx8lbv1 Docker image for developing nVidia jetson projects.
Docker command:

$ docker pull advrisc/u18.04-imx8lbv1

Run Docker example

Step1 Run docker container (example)

sudo docker run -it --name jetson_linux_risc -v /home/bsp/myLinux:/home/adv/BSP:rw --privileged advrisc/u18.04-imx8lbv1:latest /bin/bash

Step2 In container, change the user. (example)

 adv@7cc0fa834366:~$ sudo chown adv:adv -R BSP

Dependncy Library

Please install library in the HOST outside of docker if you get Exec format error.

$sudo apt-get install qemu-user-static

Getting Linux Source Code

$ export GIT_SSL_NO_VERIFY=1

EPC-R7000

$ repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/EPC-R7200/_git/manifests -m epcr7000.xml

EPC-R7200
Jetpack 4.5.1 / L4T 32.5.1

$ cd ~/BSP
$ mkdir jetson_linux_risc
$ cd jetson_linux_risc
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/EPC-R7200/_git/manifests
$ repo sync

Jetpack 4.6.1 / L4T 32.7.1

$ repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/EPC-R7200/_git/manifests -m 3271.xml

AIR-020
Jetpack 4.5.1 / L4T 32.5.1

$ cd ~/BSP
$ mkdir jetson_linux_risc
$ cd jetson_linux_risc
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/AIR-020/_git/manifests
$ repo sync

Jetpack 4.6.1 / L4T 32.7.1

$ repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/AIR-020/_git/manifests -m 3271.xml

AIR-030
Jetpack 5.0.1 / L4T 34.1.1

$ repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/risc_nvidia_jetson/_git/manifest -m air030_3411.xml

Build Image - AIR-020 / EPC-R7200

Build Release Image

sudo ./scripts/build_release.sh -s <SOC> -v <VERSION>
Where
"-v : Image version" 00001~99999
"-s : 186 - Jetson TX2 NX"
"   : 194 - Jetson Xavier NX"
"   : 210 - Jetson Nano"

Build Kernel - AIR-020 / EPC-R7200

sudo ./scripts/build_kernel.sh -s <SOC> -v <VERSION>

Enter Download Mode

Press following button + power ON, or

EPC-R7200 AIR020
Epcr7200 recovery button.jpg] Air020 recovery button.png

Enter following command in the device,

$ sudo reboot --force forced-recovery

 

Flash Image

Before flashing the image, power off the DUT, press recovery button and power on.

  EPC-R7200 AIR-020
Xavier NX

$ cd $TOP/Linux_for_Tegra/186/
$ sudo ./flash.sh jetson-xavier-nx-devkit-emmc mmcblk0p1

$ cd $TOP/Linux_for_Tegra/194/
$ sudo ./flash.sh jetson-xavier-nx-devkit-emmc mmcblk0p1
TX2 NX $ cd $TOP/Linux_for_Tegra/186/
$ sudo ./flash.sh jetson-xavier-nx-devkit-tx2-nx mmcblk0p1
$ cd $TOP/Linux_for_Tegra/186/
$ sudo ./flash.sh jetson-xavier-nx-devkit-tx2-nx mmcblk0p1
Nano

$ cd $TOP/Linux_for_Tegra/210/
$ sudo ./flash.sh jetson-nano-devkit-emmc mmcblk0p1

$ cd $TOP/Linux_for_Tegra/210/
$ sudo ./flash.sh jetson-nano-devkit-emmc mmcblk0p1

Flash DTB

  EPC-R7200 AIR-020
Xavier NX $ cd $TOP/Linux_for_Tegra/186/
$ sudo ./flash.sh -r -k kernel-dtb xavier-nx-epcr7200 mmcblk0p1
$ cd $TOP/Linux_for_Tegra/186/
$ sudo ./flash.sh -r -k kernel-dtb jetson-xavier-nx-devkit-emmc mmcblk0p1
TX2 NX $ cd $TOP/Linux_for_Tegra/186/
$ sudo ./flash.sh -r -k kernel-dtb tx2-nx-epcr7200 mmcblk0p1
$ cd $TOP/Linux_for_Tegra/186/
$ sudo ./flash.sh -r -k kernel-dtb jetson-xavier-nx-devkit-tx2-nx mmcblk0p1
Nano $ cd $TOP/Linux_for_Tegra/210/
$ sudo ./flash.sh -r -k DTB nano-epcr7200 mmcblk0p1
$ cd $TOP/Linux_for_Tegra/210/
$ sudo ./flash.sh -r -k kernel-dtb jetson-nano-devkit-emmc mmcblk0p1

Flash Mac Address

GBE in eeprom

$ sudo ./eeprom $SOC $mac_address

Where SOC

  186 : TX2-NX
  194 : XavierNX
  210 : Nano 

Intel I210

$ sudo -s
$ BDF=`lspci | grep 210 | awk '{print $1}'`
$ setpci -s $BDF COMMAND=0007

Get NIC

$./EepromAccessTool

Flash I210 address with mac_address = D4E5F6123456 ( If mac address = D4:E5:F6:12:34:56 )

$ ./EepromAccessTool -nic=<NIC> -f=Dev_Start_I210_Copper_NOMNG_8Mb_A2_3.25_0.03.hex -mac=$mac_address

Cold reboot the device.

 

 

 

Reference

Miscellaneous
EPC-R7200-UIO
AIR-020-RS-485
Calculate GPIO value from pin number

OTA
nVidia:Over-the-Air Update
How to Use A/B Filesystem Redundancy and OTA with NVIDIA Jetpack
Update Jetson Linux Over-the-Air Using Allxon

Backup / Restore
eLinux:Jetson/Clone

Boot Device



Device PID VID

Open a terminal window on your host and enter the command lsusb.
The Jetson module is in Force Recovery mode if you see this message:

Bus <bbb> Device <ddd>: ID 0955: <nnnn> Nvidia Corp.

Where:

•<bbb> is any three-digit number
•<ddd> is any three-digit number
•<nnnn> is a four-digit number that represents the type of Jetson module:

RTENOTITLE

Simultaneous flashing to multiple target devices.

Create MFI

$ sudo BOARDID=<boardid> BOARDSKU=<boardsku> FAB=<fab> BOARDREV=<boardrev> FUSELEVEL=fuselevel_production ./nvmassflashgen.sh <BOARD> <DEV_PART>

ex : Create a MFI tarball for a TX2 board.

$ cd Linux_for_Tegra 
$ sudo BOARDID=3636 BOARDSKU=0001 FAB=100 BOARDREV=B.0 FUSELEVEL=fuselevel_production ./nvmassflashgen.sh jetson-xavier-nx-devkit-tx2-nx mmcblk0p1

The tarball mfi_<BOARD>.tbz2 will be created in the Linux_for_Tegra/

RTENOTITLE

Flash this tarball to device

1.Download mfi_jetson-xavier-nx-devkit-emmc.tbz2 to each flashing hosts.
2.Untar mfi_<BOARD>.tbz2.

$ tar xvjf mfi_mfi_<BOARD>.tbz2
$ cd mfi_jetson-xavier-nx-devkit-emmc

3. Connect Jetson boards(jetson-xavier-nx-devkit-emmc only) and put them in RCM mode.

$ ./nvmflash.sh