Preempt-RT patch on Jetson kernel

Discovered this thread. What is this “RT Mainline” you speak of? I can’t find repository online that has the jetson kernel. All I can do fetch whatever sources the jetpack-agx-build repo finds for me, so there’s no selecting a version

Hello oren.bell,

What I meant was the PREEMPT_RT kernel that is released by the RT community.

You can find one here:
https://cdn.kernel.org/pub/linux/kernel/projects/rt/4.9/older/

2 Likes

I am using xavier NX and I am currently very confused on how to apply this RT. This is what I undertsood:

  1. Xavier is running on JetPack 4.4 with L4T 32.4.3

  2. If I follow the above steps first confusion is it in a ubuntu 18.04 machine or on the NX directly! (as in some guide in the internet it says it has to be done on an host machine while in some there are no mentions)

  3. Using my intuition (which is probably wrong) I ran it on NX directly. Second confusion the last device the envsetup supports is 4.3.

  4. I used that version and and followed through anyways but while flashing it says the board is not supported!

  5. Then I tried patching it from the last comment with patch-4.9.232-rt150.patch everything seems to go smoothly. The only thing now is to go into recovery mode. Which I haven’t cause I want to know what I am doing. Any help will be appreciated. as I am for it fro two days now with no success.

Hello,

I am sorry but I have not used the steps mentioned in comment #10. I, usually untar the public_sources tarball available through “jetson download center” and then apply the RT patches provided under rt-patches/* directory.

This is all done on your build system. You can compile the kernel on the NX as well but with just 6 CPUs, it may be slower to compile compared to you build system. That’s your decision completely depending on the trade-off.

To answer your points:

  1. Yes, NX is running JetPack 4.4 with L4T 32.4.3. But the kernel version is same 4.9.140.

  2. The steps can be run on NX or the Ubuntu 18.04 system. If Ubuntu 18.04 system and if it’s an x86_64 then you will need to install/point to a cross-compiler.

  3. As I said, you can run it on the NX but I don’t know what envsetup does.

  4. I think it’s the flash script that you might be using from the github. I don’t know where you ran the flash.sh script.

  5. 4.9.232-rt150 is built for a 4.9.232 mainline kernel. I think you should either use the RT patches provided with the L4T kernel or use the RT patch that is closest to the L4T kernel version i.e. closest to 4.9.140. This way you won’t have backporting issues and/or functionality mismatches.

Thanks a lot for your response I am still struggling a lot with this.

  1. The env setup: Takes you to a command line prompt to set up like this

  2. Jetson-TX1

    1. Jetson-Xavier
    2. Jetson-Nano
    3. Jetson-TX2
      Which device would you choose? [Jetson-TX1] 1
    4. 4.1.1_DP
    5. 4.2
    6. 4.2.1
    7. 4.2.2
    8. 4.2.3
    9. 4.3
      Which release would you choose? [4.1.1_DP]
      and username and password along with network Ip address.
  3. I ran everything on the NX by chosing 4.3 takes a long time to reach the last step even then after I flash said failed due to version mismatch.

  4. Now I am following this link Setting up Realtime Kernel on Jetson • PREEMPT_RT on Jetson . but still I am unsure if NX will work on 4.3 as in the documentation it shows it only works with 4.4.

  5. How do I know which one is the closest to the L4T kernel? patch-4.9.146-rt125.patch.gz this one? since NX has 4.9.140-tegra? I do not see any mention of L4T in this link Index of /pub/linux/kernel/projects/rt/4.9/older/

Could you please point me to the right direction. Say I have set up my NX as the getting started guide said and now I want to patch the kernel to PREEMPT RT what should I do?

Hello,

As I have mentioned before, I do not have familiarity with these links.

This is what we usually follow in order to setup the kernel source on top of which 400+ Concurrent developed debug/RT/enhancement patches are applied.

  1. Untar the public_sources tarball, available for download from Jetson Download Center.
  2. Untar the kernel_src.tbz2 to get the kernel source.
  3. Change directory to the untarred kernel source
  4. Run: ./scripts/rt-patch.sh apply-patches

Now, you have an L4T kernel applied with the PREEMPT_RT patch applied. The RT patch supplied with the kernel source is 4.19.115-rt93. If you wish, you can update it to use -rt94.

Going to an RT patch which is created for a higher kernel sublevel i.e. 4.9.146 as you mentioned may or may not work since there may have been changes to the mainline kernel between .140 and .146 that are incompatible with this newer patch.

So, going with the rt-patches/* provided with L4T kernel is the safest thing to do here.

Once, you have the L4T kernel with RT patches applied, you can build kernel Image and modules, and install them on the NX. Change the /boot/extlinux/extlinux.conf file to point to this new “Image” and “initramfs.img” file. You don’t need to reflash the board.

NOTE: Make sure that you have backed up original extlinux.conf and Image/initrd files.

https://developer.nvidia.com/embedded/downloads#?search=public_sources You mean this L4T sources? Sorry for the delay. I will try to patch it next week again. Do you have a link for the " public_sources tarball, available for download from Jetson Download Center." As when I search for public sources I end up in the L4T sources and I do not think it is the right one

Also since we are on the topic do you know how to solve the nx being stuck at the log in screen and I have to plug and unplug about 7 times before it boots.

Hello,

Yes, that’s the right link. Download the one for Xavier NX: https://developer.nvidia.com/embedded/L4T/r32_Release_v4.3/sources/T186/public_sources.tbz2

I think opening a new post for this will be useful since others who might have seen this issue may comment on it.

I downloaded the file (the link on the comment), untared it, changed the directory to the source folder but there is no folder scripts and file rt-patch.sh. There is just source and then public where there is a nv_public_src_build.sh I do not think the latest L4T has a patch or am I missing some steps?

Hello,

I have not looked at the latest public_source but I am doubtful that NVIDIA won’t provide L4T source.

I have downloaded R32.4.2 public_sources tarball. There’s a kernel_src.tbz2 tarball in there. Once you untar this tarball, you will find the kernel source and couple of scripts. Change directory to kernel/kernel-4.9. There you should find scripts/rt-patch.sh and rt-patches/* .

Yes I finnaly found that after extracting there is another tar file of kernels which needed to be extracted I also applied the patch how do I build it just with make?

Hello,

Please follow the steps mentioned in the below doc:
https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html

If you run into any issues, may be someone at NVIDIA can help you out.

I am trying to apply the preempt rt patch on nvidia nx. Can I apply the same RT pacthes on the kernel code for nvidia nx?

Hi Anish,

I am looking at comparison between RedHawk RTOS and PREEMPT_RT Patch on AGX Orin. Do you have any papers, researchs or studies about this? How good RedHawk RTOS on AGX Orin against PREEMPT_RT Patch if it is good ?

Thanks.