Skip to content

hmxf/RTJetson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

RT Jetson

Preempt-RT Kernel Build Guide for NVIDIA Development Board

The system used to build the image is Ubuntu 20.04.6 LTS, which is recommended because the current version of L4T is based on Ubuntu 20.04.

  • Jetpack version: 5.1.1
  • Jetson Linux version: 35.3.1
  • Linux Kernel version: 5.10

This guide and this Reference only tested on the Xavier developer kit and Jetson Nano development board.

Since L4T and related source codes are common to all NVIDIA development boards, so this tutorial is theoretically applicable to all NVIDIA development boards supported by L4T.

The only thing to note is that a specific version of L4T and related source codes only support the development platforms supported by this version of L4T, and cross-version hardware support is hard to guarantee.

Modify the $BUILD_DIR Parameter in the two scripts before you use them if you need a different Build Path other than ~/RTJetsonBuild.

Install Dependencies

sudo apt update && sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
sudo apt install -y build-essential bc libncurses5-dev lbzip2 pkg-config flex bison libssl-dev qemu-user-static

Create build folder

mkdir ~/RTJetsonBuild 
cd ~/RTJetsonBuild

Download the following files in the nvidia-rt folder:

Extract files

sudo tar xpf Jetson_Linux_R35.3.1_aarch64.tbz2 
cd Linux_for_Tegra/rootfs/ 
sudo tar xpf ../../Tegra_Linux_Sample-Root-Filesystem_R35.3.1_aarch64.tbz2
cd ../../ 
tar -xvf aarch64--glibc--stable-final.tar.gz
sudo tar -xjf public_sources.tbz2
tar -xjf Linux_for_Tegra/source/public/kernel_src.tbz2

Apply PREEMPT-RT patches

cd kernel/kernel-5.10/ 
./scripts/rt-patch.sh apply-patches 

Compile kernel

TEGRA_KERNEL_OUT=kernel_out 
mkdir $TEGRA_KERNEL_OUT 
export CROSS_COMPILE=~/RTJetsonBuild/bin/aarch64-buildroot-linux-gnu-
make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig 
make ARCH=arm64 O=$TEGRA_KERNEL_OUT menuconfig 

This option should already be selected:

Kernel Features -> Preemption  Model: Fully Preemptible Kernel (RT)

You can modify other options for your kernel, like the timer frequency (or anything you need):

Kernel Features -> Timer frequency: 1000 HZ 

After saving the configuration and exiting, start the kernel compilation

make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j$(nproc) 

Copy results

sudo cp kernel_out/arch/arm64/boot/Image ~/RTJetsonBuild/Linux_for_Tegra/kernel/Image
sudo cp kernel_out/arch/arm64/boot/Image.gz ~/RTJetsonBuild/Linux_for_Tegra/kernel/Image.gz
sudo cp -r kernel_out/arch/arm64/boot/dts/nvidia/* ~/RTJetsonBuild/Linux_for_Tegra/kernel/dtb/ 
sudo make ARCH=arm64 O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=~/RTJetsonBuild/Linux_for_Tegra/rootfs/ 
cd ~/RTJetsonBuild/Linux_for_Tegra/rootfs/ 
sudo tar --owner root --group root -cjf kernel_supplements.tbz2 lib/modules 
sudo mv kernel_supplements.tbz2  ../kernel/ 

Apply binaries

cd .. 
sudo ./apply_binaries.sh

Choose flash method and flash compiled system image

  • Generate System Image for SD flash

    This method is mostly used in the case of directly using the SD card as the boot device and is not limited to Xavier, it can also support other NVIDIA development boards in theory, such as Jetson Nano.

      cd tools
      sudo ./jetson-disk-image-creator.sh -o nvidia-rt.img -b jetson-agx-xavier-devkit -d SD
      sudo ./create-jetson-nano-sd-card-image.sh -o jetson_nano.img -s 12G -r 100
    
  • Set AGX Xavier at Recovery Mode and directly flash image to Xavier's onboard EMMC

      cd tools
      sudo ./flash.sh jetson-agx-xavier-devkit mmcblk0p1
    

About

Preempt-RT Kernel Build Guide for NVIDIA Development Board

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages