Install compiled kernel on Xavier NX

Hello, I am attempting to install a modified kernel on the Jetson Xavier NX. The idea is to fix a possible uvc driver issue. I followed a guide here to compile and install the kernel, but step 7 fails with:
make: *** No rule to make target 'modules_install'. Stop.

Also I could not find a Linux_for_Tegra folder on my Xavier NX system as was specified by some parts of the tutorial. As such I replaced the Image file in the /boot directory with the new Image file, and the contents of the /boot/dtb directory with contents of the newly made dts directory instead. The problem I was seeing (namely 2 USB 3.0 cameras not working together) keeps persisting after a reboot, so I’m wondering if the steps I followed did or did not successfully replace the old kernel. Do I need to complete step 7? Is there a way to check whether the old kernel was replaced (wanted to add a printf statement to the driver as a check but no stdio.h file was found)? Did I do something completely wrong? Any help would be very appreciated.

Linux_for_Tegra is download by the sdkmanager after you update the system image it will gen this folder.

FYI, if the “modules_install” (after setting up per that URL) is unknown, then something is wrong with the source you have. Something is missing or you are using “make” from the wrong location.

If you do modify the kernel code, then you would not use “printf()”. You would instead use a “printk()”. Example:
printk(KERN_ALERT "DEBUG at %s %d \n",__FUNCTION__,__LINE__);

Hi @alexbaronov

Could you please tell us which L4T version and toolchain you are using here ? maybe I can help you about this issue.

Regards,
Ilies

@ShaneCCC Thank you, how do I update the system image though if it’s supposed to be in Linux_for_Tegra and I can’t find it? I assumed it might be the image in /boot I need to update, is that wrong?

@linuxdev I think the latter is the more likely, but again, I can’t find the Linux_for_Tegra folder as mentioned in the tutorial yet… So if I’m supposed to run from there, I can’t.

The printk suggestion is great, really appreciate it! Didn’t know there was different syntax for the kernel output function.

@ilies.chergui The head -n 1 /etc/nv_tegra_release command returns:

R32 (release), REVISION: 4.4, GCID: 23942405, BOARD: t186ref, EABI: aarch64, DATE: Fri Oct 16 19:37:08 UTC 2020

Would you mind telling me how to check which toolchain I am using? I’m guessing default since I didn’t specify it, but don’t know how to probe it. Thanks so much!

Hi @alexbaronov

Are you building the Linux kernel in your machine or in the target ? if in the target, please try $ gcc --version
For example: I’m using the Linaro toolchain because I’m doing cross compilation.

I will build the tegra Linux kernel and send you the instructions.

regards,
Ilies

On the target. The output is:

gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0

I really appreciate you taking the time!

Hi @alexbaronov

For your information, Nvidia documentation mention the cross compilation. so if you want to do the same, you can download the linaro toolchain from here then you choose this one gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz.
after that follow the steps that you can find here.

Let me know if you need more detail.

FYI, if you’ve used JetPack/SDK Manager, then the “Linux_for_Tegra/” subdirectory is on the host PC. The location would be:
~/nvidia/nvidia_sdk/JetPack...version.../Linux_for_Tegra/

If you’ve never flashed with JetPack/SDKM, then this might not show up. Technically the SDKM is just a front end for downloading and running the actual flash software, and the “Linux_for_Tegra/” content is from the “driver package” (which SDKM would have downloaded and installed for you).

FYI, if you go here (the L4T R32.4.4 URL), then you will find " GCC 7.3.1 for 64 bit BSP and Kernel". This is the recommended cross compile tool set for that release if cross compiling.

All kernel space is considered “bare metal”. The standard programming you are used to is “user space”. Ordinary programming books describe only “user space”.

@ilies.chergui Actually, I transferred the OS of the Xavier NX to an SSD, and I’m wondering if that’s perhaps the reason that there is no change to the system even though I replaced the Image file in the /boot directory? Perhaps I need to modify the /boot directory on the SD card since that is what the system actually boots from? I will try that and report back. If that fails, I’ll just flash the SD card again on a separate machine.

@linuxdev Yes, I realised by now that the instructions are for cross-compiling.

That’s nice to know. You’re right, I’ve only learned user space programming in the past.