Including RT Patch, Getting the Backup Image and Transferring the Root File-System on DSBOX-N2

Including RT Patch, Getting the Backup Image and Transferring the Root File-System on DSBOX-N2

Jetson Nano

11 November 2021
WHAT YOU WILL LEARN?

1-Creating the Jetson module’s image folder

2- Applying the RT patch to the Jetson OS image

3- Jetson OS Installation

4- Jetson SDK Components Installation

5- Jetson Module Backup

6- Root File-System Transfer


ENVIRONMENT

ENVIRONMENT

Hardware 1: DSBOX-N2

Hardware 2: Corsair Gaming PC

OS 2: Ubuntu 18.04.5 LTS

Language: Bash


In this blog post, we will include the RT patch on DSBOX-N2. First, we will create the Jetson module’s image folder with NVIDIA SDK Manager. Then, we will apply the RT patch to the Jetson OS image with our custom kernel source files and install it. Finally, we will install the SDK components, backing up the root file-system and transferring the root file-system.



Creating the Jetson Module’s Image Folder


Open the NVIDIA SDK Manager. Select “JetPack 4.5.1” for Target Operating System and “Jetson Nano modules” for Target Hardware. (The “Host Machine” components are not required) Then continue to Step 2.



Choose the Jetson Nano eMMC module and press “OK”.



Choose only “Jetson OS”, accept the terms & conditions and continue to Step 3.



The SDK Manager will ask the username’s password. Fill it and continue.



After the Jetson OS has created, the SDK Manager asks the Jetson module’s flashing style. Just skip it and exit from the SDK Manager.




Now, you can include the RT patch into the target HW image folder 

(~/nvidia/nvidia_sdk/JetPack_4.5.1_Linux_JETSON_NANO/Linux_for_Tegra).



Applying the RT Patch to the Jetson OS Image

Install some development packages on your host PC(git, build-essential, ncurses-dev, xz-utils, bzip2, libssl-dev, bc, flex, libelf-dev, bison) with this command:


sudo apt install git build-essential ncurses-dev xz-utils bzip2 libssl-dev bc flex libelf-dev bison vim-common


Download the GCC 7.3.1 archive from this page to compile the kernel sources:



Create “l4t-gcc” folder in your $HOME directory and extract the GCC archive into it.



Now, download our custom kernel source archive file from here and extract it (For this archive file, its location does not require in a specific path too):



Let’s check the “environment_nvidia” file.



Be careful about “CROSS_COMPILE” environment’s definition. If you located the GCC compiler in another path, you should update this environment (In our setup, we do not need to change it).


Open a new terminal on this folder and type these commands to include RT patch:



cd ./kernel/kernel-4.9/
source ../../environment_nvidia
sudo ./scripts/rt-patch.sh apply-patches
make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2_nano dsboard_nx2_nano_defconfig



Then, type this command to apply some changes with menuconfig:



make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2_nano menuconfig



Go to the “General setup → Timer subsystem → Timer tick handling” and select the “Full dynticks system (tickless)”.



Go to the “Kernel Features → Preemption Model” and select the “Fully Preemptible Kernel (RT)”.



Go to the “Kernel Features → Timer frequency” and select the “1000 HZ”.



Before exiting the “menuconfig”, select “Yes” to save the new configuration.



Save the defconfig file and build the kernel sources with these commands:


make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2_nano savedefconfig
make mrproper
make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2_nano -j$(($(nproc)-1))



A few minutes later … 



After the kernel compiling progress ended, install the modules and update the BSP files (the Image and the dtb file) with these commands (The “INSTALL_MOD_PATH” was created by NVIDIA SDK Manager):


sudo make ARCH=arm64 O=$HOME/kernel_out_dsboard_nx2_nano modules_install INSTALL_MOD_PATH=$HOME/nvidia/nvidia_sdk/JetPack_4.5.1_Linux_JETSON_NANO/Linux_for_Tegra/rootfs/

cp $HOME/kernel_out_dsboard_nx2_nano/arch/arm64/boot/Image $HOME/nvidia/nvidia_sdk/JetPack_4.5.1_Linux_JETSON_NANO/Linux_for_Tegra/kernel/Image

cp $HOME/kernel_out_dsboard_nx2_nano/arch/arm64/boot/dts/tegra210-p3448-0002-dsboard-nx2-b00.dtb $HOME/nvidia/nvidia_sdk/JetPack_4.5.1_Linux_JETSON_NANO/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0002-p3449-0000-b00.dtb



Now, you can ready to flash the updated Jetson OS to the DSBOX-N2.



Jetson OS Installation


Change the current directory and create the “system.img” file with this command:

$ cd ~/nvidia/nvidia_sdk/JetPack_4.5.1_Linux_JETSON_NANO/Linux_for_Tegra/

$ sudo ./flash.sh --no-flash jetson-nano-emmc mmcblk0p1



Connect the recovery USB (between installer PC & DSBOX-N2's recovery USB) and power connection of your DSBOX-N2. While the DSBOX-NX2's power connector plugged in,

• press power button then wait for boot led lights up.

• press reset & recovery buttons together

• release reset button

• release the recovery button after 3 seconds later. This will set it to Recovery mode.

Check it’s connected in recovery mode with the next terminal command and flash it:



lsusb | grep 0955:7f21
sudo ./flash.sh -r jetson-nano-emmc mmcblk0p1



A few seconds later … 




At the end of the flashing step, complete the Ubuntu Configuration Wizard (language, keyboard type, location, username & password etc.).


Open a terminal at DSBOX-N2 or connect it via “ssh” to check the RT patch included successfully. To do this, type these commands:


uname -r
ls /lib/modules/
lsmod



Now, continue to install the Jetson SDK components from NVIDIA SDK Manager.


Jetson SDK Components Installation

Delete LibreOffice & ThunderBird packages (if you don’t need) and remove the unnecessary packages to increase the free space. To do this type these commands to the DSBOX-N2 side:



sudo apt remove -y libreoffice* thunderbird*
sudo apt autoremove -y
sudo apt clean


Connect the DSBOX-N2 to the Ethernet or connect its Recovery USB to the Host PC. Then open the NVIDIA SDK Manager. Select “JetPack 4.5.1” for Target Operating System and “Jetson Nano modules” for Target Hardware. (The “Host Machine” components are not required) Then continue to Step 2.



Choose only “Jetson SDK Components”, accept the terms & conditions and continue to Step 3.



The SDK Manager will ask the username’s password. Fill it and continue.



Type the IP address, username and password of DSBOX-N2 and install the SDK Components.



At the end of the installation, the DSBOX-N2 becomes ready.

If you want to get its backup image or transfering the root file-system, please continue to the next steps.


Jetson Module Backup


If you want to clone your DSBOX-N2, please follow this guide (This guide may prepared for different JetPack versions. Only the working directories differs from this situation).


While backing up the Jetson module, please use the RT patch included folder

 (~/nvidia/nvidia_sdk/JetPack_4.5.1_Linux_JETSON_NANO/Linux_for_Tegra/). This folder is using both cloning and restoring it.

After completing this cloning tutorial, come back to this tutorial and continue the following step below if you want to transfer the root file-system.



Root File-System Transfer


If you want to transfer the root file-system into SD card, please follow this guide at this point.


If you want to transfer the root file-system into NVME SSD drive, please follow this guide at this point.



Türkçe