JetPack 5.1 RT patch not working

Hi,

I know there are multiple threads on that subject, but none of them conclude the full solution.

I have followed the steps (as far as I could interpret them) from the official documentation, but with no success:
https://docs.nvidia.com/jetson/archives/r35.2.1/DeveloperGuide/text/SD/Kernel/KernelCustomization.html

The following guides/tickets were also considered:

Current state:

  • Applying rt-patch : pass
  • Building kernel : pass
  • Building display modules : pass
  • Binaries : pass
  • Flashing : pass
  • Loading screen (white with green eye) is visible, but then it turns black… (not good)

IMPORTANT:
I use the Linux version downloaded by the SDK manager.

Shell script for all commands:

# Toolchain
export CROSS_COMPILE=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu-
export CROSS_COMPILE_AARCH64_PATH=$HOME/l4t-gcc
export CROSS_COMPILE_AARCH64=$HOME/l4t-gcc/bin/aarch64-buildroot-linux-gnu-
export NV_SDK=$HOME/nvidia/nvidia_sdk
export L4T_SDK=$NV_SDK/JetPack_5.1_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra
export LOCALVERSION="-tegra"
export IGNORE_PREEMPT_RT_PRESENCE=1

# Extract source and build kernel
# Assume public_sources.tbz2 is downloaded here
# $NV_SDK is where the SDK manager puts its JetPack
cd $NV_SDK
tar -xjf public_sources.tbz2
cd Linux_for_Tegra/source/public
export NV_SRC=$PWD
tar -xjf kernel_src.tbz2
cd kernel
./kernel-5.10/scripts/rt-patch.sh apply-patches
cd ..
mkdir kernel_out
./nvbuild.sh -o $PWD/kernel_out
export KERNEL_OUT=$PWD/kernel_out

# Build display
tar xf nvidia_kernel_display_driver_source.tbz2
cd NVIDIA-kernel-module-source-TempVersion
make \
modules \
-j`nproc` \
SYSSRC=${NV_SDK}/Linux_for_Tegra/source/public/kernel/kernel-5.10 \
SYSOUT=${NV_SDK}/Linux_for_Tegra/source/public/kernel_out \
CC=${CROSS_COMPILE_AARCH64}gcc \
LD=${CROSS_COMPILE_AARCH64}ld.bfd \
AR=${CROSS_COMPILE_AARCH64}ar \
CXX=${CROSS_COMPILE_AARCH64}g++ \
OBJCOPY=${CROSS_COMPILE_AARCH64}objcopy \
TARGET_ARCH=aarch64 \
ARCH=arm64

# Copy
cd $L4T_SDK
sudo cp $KERNEL_OUT/drivers/gpu/nvgpu/nvgpu.ko rootfs/usr/lib/modules/5.10.104-tegra/kernel/drivers/gpu/nvgpu/
sudo cp $KERNEL_OUT/arch/arm64/boot/dts/nvidia/* kernel/dtb/
sudo cp $KERNEL_OUT/arch/arm64/boot/Image kernel/
sudo cp $NV_SRC/NVIDIA-kernel-module-source-TempVersion/kernel-open/*.ko rootfs/usr/lib/modules/5.10.104-tegra/extra/opensrc-disp/

# Flash
sudo ./apply_binaries.sh
sudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1

Did you try the marked solution in No display with PREEMPT_RT patches? Sounds like it is the issue with the kernel module dependency file not being updated. Try running sudo depmod -a in the serial console.

Alternatively, in the thread above I posted how it could be run on the host before flashing.

Thank you @sy14 !

I’ll add the final script at the end of the post.

In general, it was nice to see an update for Jetson Documentation. I know this issue is not new, but the doc never changed.
Few things that were hard (for me) to understand from the doc:

  1. Apply binaries should be done before copying from kernel_out (at least this is how the script is)
  2. Needs to “make” the new modules from kernel_out
  3. The New display module is located at “kernel-out”, and output should be copied to “extra/opensrc-disp”
  4. The super important update from @sy14 must be included

Here is the final script (mostly from this):

ROOT=$PWD
JETSON="Jetson_Linux_R35.2.1_aarch64.tbz2"
SOURCES="public_sources.tbz2"
ROOTFS="Tegra_Linux_Sample-Root-Filesystem_R35.2.1_aarch64.tbz2"
TOOLCHAIN="aarch64--glibc--stable-final.tar.gz"
TOOLCHAIN_DIR=$ROOT/l4t-gcc

echo "Extracting Linux_for_Tegra..."
tar -xjf $JETSON

echo "Extracting rootfs..."
cd $ROOT/Linux_for_Tegra/rootfs
sudo tar -xjf $ROOT/$ROOTFS

echo "Extracting source..."
cd $ROOT
tar -xjf $SOURCES

echo "Extracting toolchain..."
mkdir -p $TOOLCHAIN_DIR
tar -xzf $TOOLCHAIN -C $TOOLCHAIN_DIR

export CROSS_COMPILE_AARCH64_PATH=$TOOLCHAIN_DIR
export CROSS_COMPILE_AARCH64=$TOOLCHAIN_DIR/bin/aarch64-buildroot-linux-gnu-

echo "Extracting src kernel..."
cd $ROOT/Linux_for_Tegra/source/public
tar -xjf kernel_src.tbz2

echo "Applying rt-patch..."
./kernel/kernel-5.10/scripts/rt-patch.sh apply-patches

echo "Building src kernel..."
mkdir -p kernel_out
./nvbuild.sh -o $PWD/kernel_out
KERNEL_OUT="$PWD/kernel_out"

echo "Apply binariesl..."
cd $ROOT/Linux_for_Tegra
sudo ./apply_binaries.sh

echo "Copy from kernel_out..."
cd $ROOT/Linux_for_Tegra
sudo cp source/public/kernel_out/drivers/gpu/nvgpu/nvgpu.ko rootfs/usr/lib/modules/5.10.104-tegra/kernel/drivers/gpu/nvgpu/nvgpu.ko
cp -r source/public/kernel_out/arch/arm64/boot/dts/nvidia/* kernel/dtb/.
cp -r source/public/kernel_out/arch/arm64/boot/Image kernel/Image

echo "Make kernel_out modules..."
cd $ROOT/Linux_for_Tegra/source/public/kernel_out
sudo make INSTALL_MOD_PATH=$ROOT/Linux_for_Tegra/rootfs O= modules_install

echo "Extracting display drivers..."
cd $ROOT/Linux_for_Tegra/source/public
tar -xjf nvidia_kernel_display_driver_source.tbz2
cd NVIDIA-kernel-module-source-TempVersion

export LOCALVERSION="-tegra"
export IGNORE_PREEMPT_RT_PRESENCE=1

echo "Make display drivers for rt-patch..."
make \
    modules -j`nproc` \
    SYSSRC=$ROOT/Linux_for_Tegra/source/public/kernel/kernel-5.10 \
    SYSOUT=$ROOT/Linux_for_Tegra/source/public/kernel_out \
    CC=${CROSS_COMPILE_AARCH64}gcc \
    LD=${CROSS_COMPILE_AARCH64}ld.bfd \
    AR=${CROSS_COMPILE_AARCH64}ar \
    CXX=${CROSS_COMPILE_AARCH64}g++ \
    OBJCOPY=${CROSS_COMPILE_AARCH64}objcopy \
    TARGET_ARCH=aarch64 \
    ARCH=arm64

echo "Copy display drivers from kernel-open..."
DRIVER_DIR=$ROOT/Linux_for_Tegra/rootfs/lib/modules/5.10.104-rt63-tegra/extra/opensrc-disp
sudo mkdir -p $DRIVER_DIR
cd $ROOT/Linux_for_Tegra/source/public/NVIDIA-kernel-module-source-TempVersion/kernel-open
sudo cp nvidia-modeset.ko nvidia.ko nvidia-drm.ko $DRIVER_DIR

echo "Installing QEMU binary in rootfs"
cd $ROOT/Linux_for_Tegra
L4T_ROOTFS_DIR="$ROOT/Linux_for_Tegra/rootfs"
sudo cp "${KERNEL_OUT}/System.map" ${L4T_ROOTFS_DIR}
QEMU_BIN="/usr/bin/qemu-aarch64-static"
sudo install --owner=root --group=root "${QEMU_BIN}" "${L4T_ROOTFS_DIR}/usr/bin/"
pushd ${L4T_ROOTFS_DIR}
LC_ALL=C sudo chroot . depmod -a -F System.map 5.10.104-rt63-tegra
popd
echo "Removing QEMU binary from rootfs"
sudo rm -f "${L4T_ROOTFS_DIR}/usr/bin/qemu-aarch64-static"

echo "Flashing"
sudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.