Jetson Nano Custom Kernel replaced after apt upgrade

Hello,

I am facing a problem during process of kernel customization using Cross compilation. I followed the Nvidia documentation : https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html

I achieve to add my modifications to the kernel and to flash the Jetson Nano correctly. But, when I do this command after booting for the first time : sudo apt upgrade, it changes the kernel image to put a non modified one after rebooting.

What’s a bit strange is that it’s always the same old image dating from the 5th May of 2021 which is put and it’s not corresponding to a particular nvidia update.

I searched this type of error on Google and I found that sudo apt upgrade normally do this thing when it detects a more recent image. After searching more I found in my sources files (in particular in the rootfs folder) at this path : /Linux_for_Tegra/rootfs/lib/modules two folders with two different names or versions : 4.9.201 and 4.9.201-tegra. I noticed that the 4.9.201-tegra folder appears after doing this command : sudo ./apply_binaries.

On Jetson nano, before rebooting I have that :

uname -r
4.9.201

and after doing an upgrade and rebooting I have :

uname -r
4.9.201-tegra

The problem is that the 4.9.201-tegra version of the kernel doesn’t contain my modifications.
Do you know what to do to solve this issue ?

Thank you by advance !

Adrien Leroy

apt upgrade would upgrade all packages installed at the system.
This wiki guides package upgrades without kernel:
https://www.bonusbits.com/wiki/HowTo:Upgrade_Ubuntu_without_Updating_the_Kernel

I do not have a chance to test it myself.

1 Like

Hi @MtHiker, thank you for your quick answer !
I tested your suggestion and it worked well !
But i am wondering, isn’t that working around the problem ?

Because previously (like a month ago) I was able to do the whole process without holding on the image etc…

But anyway thanks a lot !
Adrien

To make this issue more easier to understand… the apt-get upgrade will install the NV official debian package to the latest jetpack version.

Thus, why your kernel has been changed is because it is moving to one specific version of jetpack. Thus, if you don’t want those package overwrite your change, you can remove them from the source list.

/etc/apt/sources.list.d/nvidia-l4t-apt-source.list

2 Likes

If you want to stop one particular package from update, then you might find “sudo apt-mark hold <package>” does this (I have not tried with a Jetson kernel). First, to know the name of the package owning a file (example being the kernel):
dpkg -S /boot/Image

In my case this is “nvidia-l4t-kernel”. In theory (I have not tested) you could then:
sudo apt-mark hold nvidia-l4t-kernel

If packages have correct dependencies, then you wouldn’t need to mark packages depending on kernel update to be held. You might find though that something like a firmware package would need to be separately held.

Nice URL on topic:
https://www.computerhope.com/unix/apt-mark.htm

2 Likes

Yes it is the commands that I have done :

sudo apt-mark hold nvidia-l4t-kernel nvidia-l4t-kernel-dtbs nvidia-l4t-kernel-headers

Did that work?

1 Like

Also note that nvidia-l4t-bootloader package may also change your early stage boot.

I’m using a NVME for linux rootfs with a link to emmc boot directory, so each time I apt upgrade one of these, I have to manually edit /boot/extlinux/extlinux.conf where my config for NVME is and change the default entry added by the update…(and when missing that, I have to use a serial console for running the correct extlinux.conf entry and fix extlinuf.conf file).

Indeed, the jetson nano booted correctly and with my custom image !

And I didn’t know for bootloader thank you !