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

From ESS-WIKI
Jump to: navigation, search
 
(72 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Linux BSP Version ==
 
  
Ubuntu 18.04
+
== Project ==
  
Kernel 4.9.201
+
[[AIR-020|AIR-020]]<br/> [[AIR-030|AIR-030]]<br/> [[EPC-R7000|EPC-R7000]]<br/> [[EPC-R7200|EPC-R7200]]<br/> [[EPC-R7300|EPC-R7300]]
 
 
== Released Image ==
 
 
 
*[[IoTGateway/BSP/Linux/OS_Support_List_Jetpack_4.5.1_L4T_R32.5.1|OS Support List ( Jetpack 4.5.1 / L4T R32.5.1 )]]
 
 
 
== Build Environment on Host ==
 
 
 
Currently, we adopt [https://www.docker.com/ Docker] as build environment.
 
 
 
You can get the latest version of advrisc/u18.04-imx8lbv1 Docker image for developing nVidia jetson&nbsp;projects.
 
 
 
Docker command:
 
<pre>$ docker pull advrisc/u18.04-imx8lbv1</pre>
 
 
 
== Run Docker example ==
 
 
 
Step1 Run docker container (example)
 
<pre>sudo docker run -it --name jetson_linux_risc -v /home/bsp/myLinux:/home/adv/BSP:rw --privileged advrisc/u18.04-imx8lbv1:latest /bin/bash
 
</pre>
 
 
 
Step2 In container, change the user. (example)
 
<pre> adv@7cc0fa834366:~$ sudo chown adv:adv -R BSP</pre>
 
 
 
== Install Some tools ==
 
<pre>$sudo apt-get install expect
 
</pre>
 
 
 
== Getting Linux Source Code ==
 
<pre>$ export GIT_SSL_NO_VERIFY=1</pre>
 
 
 
EPC-R7200
 
<pre>$ 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/repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/EPC-R7200/_git/manifests
 
$ ../repo/repo sync
 
</pre>
 
 
 
AIR-020
 
<pre>$ 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/repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/AIR-020/_git/manifests
 
$ ../repo/repo sync
 
</pre>
 
 
 
== Build Image - AIR-020 / EPC-R7200 ==
 
 
 
Build Release Image
 
<pre>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"</pre>
 
 
 
== Build Kernel - AIR-020 / EPC-R7200 ==
 
<pre>sudo ./scripts/build_ota.sh -s <SOC> -v <VERSION></pre>
 
 
 
== Enter Download Mode ==
 
 
 
Press following button +&nbsp;power ON, or
 
 
 
{| border="1" cellspacing="1" cellpadding="1" style="width:500px;"
 
|-
 
| style="width: 389px; background-color: rgb(80, 80, 80); color: rgb(255, 255, 255); text-align: center;" | EPC-R7200
 
| style="width: 389px; background-color: rgb(80, 80, 80); color: rgb(255, 255, 255); text-align: center;" | AIR020
 
|-
 
| style="text-align: center;" | [[File:Epcr7200 recovery button.jpg|200px|Epcr7200 recovery button.jpg]]]<br/>
 
| style="text-align: center;" | [[File:Air020 recovery button.png|200px|Air020 recovery button.png]]<br/>
 
|}
 
 
 
Enter following command in the device,
 
<pre>$ sudo reboot --force forced-recovery</pre>
 
 
 
== Flash Image ==
 
 
 
Before flashing the image, power off the DUT, press recovery button and power on.
 
 
 
{| border="1" cellspacing="1" cellpadding="1" style="width: 1100px;"
 
|-
 
! scope="row" | <br/>
 
! scope="col" style="width: 389px;background-color:rgb(80, 80, 80);color:#FFFFFF" | EPC-R7200<br/>
 
! scope="col" style="width: 438px;background-color:rgb(80, 80, 80);color:#FFFFFF" | AIR-020<br/>
 
|-
 
! scope="row" | Xavier NX<br/>
 
| style="width: 700px;" |
 
$ cd $TOP/Linux_for_Tegra/186/<br/>$ sudo ./flash.sh -d <span style="color:#800080;">./kernel/dtb/</span><span style="color:#0000FF;">tegra194-epcr7200.dtb</span> &nbsp;<span style="color:#0000FF;">jetson-xavier-nx-devkit-emmc</span> mmcblk0p1<br/>or<br/>$ sudo ./flash.sh <span style="color:#0000FF;">jetson-xavier-nx-devkit-emmc</span> mmcblk0p1
 
 
 
| style="width: 438px;" | $ cd $TOP/Linux_for_Tegra/186/<br/>$ sudo ./flash.sh <span style="color:#0000FF;">jetson-xavier-nx-devkit-emmc</span> mmcblk0p1
 
|-
 
! scope="row" | TX2 NX<br/>
 
| style="width: 700px;" | $ cd $TOP/Linux_for_Tegra/186/<br/>$ sudo ./flash.sh -d ./<span style="color:#800080;">kernel/dtb/</span><span style="color:#0000FF;">tegra186-epcr7200.dtb</span> &nbsp;<span style="color:#0000FF;">jetson-xavier-nx-devkit-tx2-nx</span> mmcblk0p1<br/>or<br/>$ sudo ./flash.sh <span style="color:#0000FF;">jetson-xavier-nx-devkit-tx2-nx</span> mmcblk0p1<br/>
 
| style="width: 438px;" | $ cd $TOP/Linux_for_Tegra/186/<br/>$ sudo ./flash.sh <span style="color:#0000FF;">jetson-xavier-nx-devkit-tx2-nx</span> mmcblk0p1<br/>
 
|-
 
! scope="row" | Nano
 
| style="width: 700px;" |
 
$ cd $TOP/Linux_for_Tegra/210/<br/>$ sudo ./flash.sh -d ./<span style="color:#800080;">kernel/dtb/</span><span style="color:#0000FF;">tegra210-epcr7200.dtb</span> &nbsp;<span style="color:#0000FF;">jetson-nano-devkit-emmc</span> mmcblk0p1<br/>or<br/>$ sudo ./flash.sh <span style="color:#0000FF;">jetson-nano-devkit-emmc</span> mmcblk0p1
 
 
 
| style="width: 438px;" | $ cd $TOP/Linux_for_Tegra/210/<br/>$ sudo ./flash.sh <span style="color:#0000FF;">jetson-nano-devkit-emmc</span> mmcblk0p1<br/>
 
|}
 
 
 
== Flash DTB ==
 
 
 
{| border="1" cellspacing="1" cellpadding="1" style="width: 891px;"
 
|-
 
! scope="row" | <br/>
 
! scope="col" style="width: 389px;background-color:rgb(80, 80, 80);color:#FFFFFF" | EPC-R7200<br/>
 
! scope="col" style="width: 438px;background-color:rgb(80, 80, 80);color:#FFFFFF" | AIR-020<br/>
 
|-
 
! scope="row" | Xavier NX<br/>
 
| style="width: 389px;" | $ cd $TOP/Linux_for_Tegra/186/<br/>$ sudo ./flash.sh -r -k kernel-dtb <span style="color:#0000FF;">xavier-nx-epcr7200</span> mmcblk0p1<br/>
 
| style="width: 438px;" | $ cd $TOP/Linux_for_Tegra/186/<br/>$ sudo ./flash.sh -r -k kernel-dtb <span style="color:#0000FF;">jetson-xavier-nx-devkit-emmc</span> mmcblk0p1
 
|-
 
! scope="row" | TX2 NX<br/>
 
| style="width: 389px;" | $ cd $TOP/Linux_for_Tegra/186/<br/>$ sudo ./flash.sh -r -k kernel-dtb <span style="color:#0000FF;">tx2-nx-epcr7200</span> mmcblk0p1<br/>
 
| style="width: 438px;" | $ cd $TOP/Linux_for_Tegra/186/<br/>$ sudo ./flash.sh -r -k kernel-dtb <span style="color:#0000FF;">jetson-xavier-nx-devkit-tx2-nx</span> mmcblk0p1<br/>
 
|-
 
! scope="row" | Nano
 
| style="width: 389px;" | $ cd $TOP/Linux_for_Tegra/210/<br/>$ sudo ./flash.sh -r -k DTB <span style="color:#0000FF;">nano-epcr7200</span> mmcblk0p1<br/>
 
| style="width: 438px;" | $ cd $TOP/Linux_for_Tegra/210/<br/>$ sudo ./flash.sh -r -k kernel-dtb <span style="color:#0000FF;">jetson-nano-devkit-emmc</span> mmcblk0p1<br/>
 
|}
 
 
 
== Flash Mac Address ==
 
 
 
=== <span style="color:#0000CD;">GBE in eeprom</span> ===
 
<pre>$ sudo ./eeprom $SOC $mac_address</pre>
 
 
 
Where SOC
 
<pre>  186&nbsp;: TX2-NX
 
  194&nbsp;: XavierNX
 
  210&nbsp;: Nano
 
</pre>
 
 
 
=== <span style="color:#0000CD;">Intel I210</span> ===
 
<pre>$ sudo -s
 
$ BDF=`lspci | grep 210 | awk '{print $1}'`
 
$ setpci -s $BDF COMMAND=0007
 
</pre>
 
 
 
Get NIC
 
<pre>$./EepromAccessTool</pre>
 
 
 
Flash I210 address with mac_address = D4E5F6123456 ( If mac address = D4:E5:F6:12:34:56 )
 
<pre>$ ./EepromAccessTool -nic=<NIC> -f=Dev_Start_I210_Copper_NOMNG_8Mb_A2_3.25_0.03.hex -mac=$mac_address</pre>
 
 
 
Cold reboot the device.
 
  
 
== Reference ==
 
== Reference ==
  
<span style="font-size:medium;"><span style="color:#006400;">'''Boot Device'''</span></span>
+
<span style="font-size:medium;"><span style="color:#006400;">'''Miscellaneous'''</span> </span><br/> [[Jetson_Boot_Device|Boot Device]]<br/> [[Jetson_Simultaneous_flashing_to_multiple_target_devices.|Simultaneous flashing to multiple target devices.]]<br/> [[Jetson_Device_PID_VID|Device PID VID]]<br/> [[NVidia_check_soc_jetpack|SOC module / Jetpack version / Chip ID / target_board]]<br/> [https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/index.html nVidia&nbsp;: Developer Guide]<br/> [https://elinux.org/Jetson/L4T_BSP_development_tips elinux.org&nbsp;: Jetson L4T BSP_development tips]<br/> [https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3261/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/jetson_eeprom_layout.html Jetson Module EEPROM Layout]
 
 
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 &lt;search_keyword&gt; 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 &lt;device&gt; 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 &lt;size&gt; 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 &lt;device&gt; 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 &lt;DPART&gt; is then &lt;nvmeXn1&gt;p1.<br/>The U-Disk device name of the APP partition &lt;DPART&gt; is then &lt;sdX&gt;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 &lt;DPART&gt; 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;&lt;DPART&gt; 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/sda1 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>
 
 
 
Open a terminal window on your host and enter the command '''''lsusb'''''.<br/>The Jetson module is in Force Recovery mode if you see this message:
 
<pre>Bus <bbb> Device <ddd>: ID 0955: <nnnn> Nvidia Corp.</pre>
 
 
 
Where:
 
 
 
•&lt;bbb&gt; is any three-digit number<br/>•&lt;ddd&gt; is any three-digit number<br/>•&lt;nnnn&gt; is a four-digit number that represents the type of Jetson module:
 
 
 
[[File:Nvidia pidvid.png|RTENOTITLE]]
 
 
 
<span style="font-size:medium;"><span style="color:#006400;">'''Flash to Multi-Device'''</span></span>
 
 
 
Create MFI
 
<pre>$sudo BOARDID=<boardid> BOARDSKU=<boardsku> FAB=<fab> BOARDREV=<boardrev> FUSELEVEL=fuselevel_production ./nvmassflashgen.sh <BOARD> <DEV_PART>
 
</pre>
 
 
 
ex&nbsp;: Create a MFI tarball for a TX2 board.
 
<pre>$ 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</pre>
 
 
 
The tarball mfi_&lt;BOARD&gt;.tbz2 will be created in the Linux_for_Tegra/
 
  
[[File:Jetson board nvmassflashgen.jpg|RTENOTITLE]]
+
<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&nbsp;: 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]
  
Flash this tarball to device
+
<span style="font-size:medium;"><span style="color:#006400;">'''Backup / Restore'''</span></span><br/> [https://elinux.org/Jetson/Clone eLinux:Jetson/Clone]

Latest revision as of 04:26, 24 May 2023

Project

AIR-020
AIR-030
EPC-R7000
EPC-R7200
EPC-R7300

Reference

Miscellaneous
Boot Device
Simultaneous flashing to multiple target devices.
Device PID VID
SOC module / Jetpack version / Chip ID / target_board
nVidia : Developer Guide
elinux.org : Jetson L4T BSP_development tips
Jetson Module EEPROM Layout

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