How to install kernel_headers to the same directory as the burn image by adding a custom implementation based on the RT patch

I follow the URL Kernel Customization — NVIDIA Jetson Linux Developer Guide 1 documentation, I can replace the driver and modules, but I do not know how to update the kernel_headers, because I have added some custom functions in the kernel, the URL does not describe how to install the custom kernel headers. To install flash.sh to orin agx

*** Please note that this reply is generated by LLM automatically ***

Based on the provided context, I’ll provide a comprehensive answer to your question.

You’ve followed the NVIDIA Jetson Linux Developer Guide to customize your kernel by replacing the driver and modules. However, you’re unsure about how to update the kernel headers, as you’ve added custom functions to the kernel. The guide doesn’t explicitly describe how to install custom kernel headers.

To update the kernel headers, you’ll need to rebuild the kernel packages, specifically the nvidia-l4t-kernel-headers package. Here’s a step-by-step guide to help you achieve this:

  1. Obtain the kernel source code: Download the public_sources.tbz2 archive from the NVIDIA Developer Center, which contains the kernel source code.
  2. Extract the kernel source code: Extract the kernel_src.tbz2 archive from the public_sources.tbz2 archive. This will give you the kernel source code directory.
  3. Modify the kernel source code: Make the necessary changes to the kernel source code to incorporate your custom functions.
  4. Rebuild the kernel: Follow the instructions in the NVIDIA Jetson Linux Developer Guide to rebuild the kernel. This will create a new kernel image.
  5. Rebuild the kernel packages: Use the dpkg-buildpackage command to rebuild the kernel packages, including the nvidia-l4t-kernel-headers package. You can find more information on rebuilding kernel packages in the Debian Guide for Debian Maintainers.
  6. Install the custom kernel headers: Once you’ve rebuilt the kernel packages, you can install the custom kernel headers using the dpkg -i command.

To install the custom kernel headers on your Jetson AGX Orin device, you’ll need to use the flash.sh script. Here’s an example of how to use the script:

  1. Prepare the flash.sh script: Make sure you have the flash.sh script in your working directory.
  2. Specify the kernel image: Use the -K option to specify the path to your custom kernel image.
  3. Specify the kernel headers: Use the -H option to specify the path to your custom kernel headers.
  4. Flash the device: Run the flash.sh script with the necessary options to flash your Jetson AGX Orin device.

Here’s an example command:

./flash.sh -K <path_to_custom_kernel_image> -H <path_to_custom_kernel_headers> jetson-agx-orin-devkit

Replace <path_to_custom_kernel_image> and <path_to_custom_kernel_headers> with the actual paths to your custom kernel image and headers, respectively.

By following these steps, you should be able to update the kernel headers on your Jetson AGX Orin device with your custom kernel headers.

In comparison to the original guide, the key difference is that you need to rebuild the kernel packages, including the nvidia-l4t-kernel-headers package, to incorporate your custom kernel headers. The original guide only describes how to replace the driver and modules, but not how to update the kernel headers.

I’m using jetPack5.1.3, L4T 35.5, and I don’t see the nvidia-l4t-kernel-headers package, and I don’t see the -H parameter in flash.sh

Hi,
Please run the commands on AGX Orin:

$ sudo apt update
$ apt list -a | grep nvidia-l4t-kernel-headers

You should be able to see the package.

I downloaded the BSP for Orin-35.5.0, and I noticed that there are two sources for the kernel headers: kernel_headers.tbz2 and nvidia-l4t-kernel-headers_5.10.192.tegra-35.5.0_arm64.deb. From what I see in the apply_binaries.sh script, it first extracts and installs the .deb package into the rootfs, and then later extracts and installs the .tbz2 package. So, I’d like to ask — is the suggestion you gave me earlier correct? If it is, was the .deb package generated using make bindeb-pkg from the kernel source?

Hi,
The packages are default kernel headers. If there’s customization, please manually apply it to the files under Linux_for_Tegra/rootfs, before re-flashing the system.

Hi,
I’m planning to install a customized part. The user manual describes how to handle the modules part — just repackage it into kernel_supplements.tbz2 and replace the original. However, it doesn’t explain how to generate kernel_headers.tbz2, and that’s where my confusion lies. How can I create and replace it so that I can directly flash my custom kernel to the Orin device?

Hi,
You should not need to generate kernel_headers.tbz2. The files under Linux_for_Tegra/rootfs are flashed to device, so you can copy the files to corresponding path. And then flash the system.

Hi,
So does that mean I have to copy the files one by one manually? There’s no other way? I would expect there to be a script or some method to package everything at once. I tried running make ARCH=arm64 headers_install, but the resulting directory structure is completely different. So I attempted to run make ARCH=arm64 bindeb-pkg in the kernel source directory to generate a headers .deb package for installation, but it seems to run into issues — it can’t find the DTB file.

Hi,
There is no existing script for copying header files, so would need to manually copy the files to rootfs.

Hi,
Thank you very much for your explanation.

So, if I understand correctly, all the components generated from my own RT-patched kernel (image, dtb, modules, headers) need to be manually installed into the rootfs before running the flash script.

By the way, I have one more question: can I flash the official image first, then generate my own .deb packages and install them directly on the Orin device?

Hi,
While copying, I realized that I not only need to copy the parts I modified, but also the official RT patch parts. However, I don’t know which header files were modified by the original RT patch. So, is there any alternative to copying everything manually?

Hi,
We have rt-kernel packages for developer kit:

Kernel Customization — NVIDIA Jetson Linux Developer Guide

Yo may install only nvidia-l4t-rt-kernel-headers for a try. Please not to install other packages since it will overwrite your self-built RT kernel.

Hi,
The link you provided is for version 36.4.4, and I noticed that there are significant differences compared to my version, which is 35.5.0. I checked the user manual but couldn’t find the information you mentioned. Also, I couldn’t find the package you referred to on my Orin device. The kernel source patch I’m using is 5.10.192-rt96. Could you please explain in more detail? For example, where can I download this package?

Hi,
The packages are for Jetpack 6. For Jetpack 5, patches for RT kernel are listed in

kernel-5.10/rt-patches

And you would need to manually check which header files are modified.

Hi,
Alright, this seems like a huge task. There are a lot of files under the rt-patches directory, and I have to go through them one by one, which is not very convenient. It seems that there’s no better solution on your end. I’m now planning to try generating a .deb package to solve this issue, since that’s how I usually install the kernel on x86.

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