OTA update with custom kernel?

I am using a custom compiled kernel with support for IMX477 camera, and L4T 32.4.4.

If I do OTA update, will it overwrite my custom kernel>?

I couldn’t answer for sure, but the odds are high the kernel could be overwritten. However, if you created your own “.deb” package for the kernel (which I have not personally done before so I can’t provide steps), then you could mark the package as hold to avoid interference.

By default, at least recently, you would have these kernel packages which could conceivably be held:

ii  nvidia-l4t-kernel                          4.9.140-tegra-32.4.3-20200625213407              arm64        NVIDIA Kernel Package
ii  nvidia-l4t-kernel-dtbs                     4.9.140-tegra-32.4.3-20200625213407              arm64        NVIDIA Kernel DTB Package
ii  nvidia-l4t-kernel-headers                  4.9.140-tegra-32.4.3-20200625213407              arm64        NVIDIA Linux Tegra Kernel Headers Package
ii  kmod                                       24-1ubuntu3.5                                    arm64        tools for managing Linux kernel modules

You’d end up replacing the kernel package with your package, and then marking hold. For example, if you wanted to keep nvidia-l4t-kernel from updating:
sudo apt-mark hold nvidia-l4t-kernel

In a way this is what NVIDIA did. On a PC the packages would probably be “linux-image-generic-hwe-18.04” and “linux-headers-generic-hwe-18.04” on Ubuntu 18.04. This would be held like this if you were holding the stock kernel from upgrade on a PC:

sudo apt-mark hold linux-image-generic-hwe-18.04
sudo apt-mark hold linux-headers-generic-hwe-18.04

I’m not particularly great with Ubuntu packages, but keep in mind that if you have the actual “.deb” file for the stock NVIDIA kernel, then perhaps you could deconstruct the NVIDIA package and use it as a template for designing your own replacement to that package. For example, you could extract the package, edit what is there, and then repackage.

If you originally flashed via JetPack/SDK Manager on a PC, then likely the original kernel “.deb” package is still there. As an example, for JetPack 4.5 Xavier, you would have this on your host PC:
~/nvidia/nvidia_sdk/JetPack_4.5_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/kernel/

There might be some patches so this is just an example, but I have there these files:

nvidia-l4t-kernel_4.9.201-tegra-32.5.0-20210115151051_arm64.deb 
nvidia-l4t-kernel-headers_4.9.201-tegra-32.5.0-20210115151051_arm64.deb
nvidia-l4t-kernel-dtbs_4.9.201-tegra-32.5.0-20210115151051_arm64.deb

You can extract metadata and actual content and explore what you might customize. For example:

cd ~/nvidia/nvidia_sdk/JetPack_4.5_Linux_JETSON_AGX_XAVIER/Linux_for_Tegra/kernel/
mkdir tmp
cd tmp
# This will create subdirectory "`DEBIAN/`" with metadata.
sudo dpkg -e ../nvidia-l4t-kernel_4.9.201-tegra-32.5.0-20210115151051_arm64.deb
sudo mkdir unpack
# This will unpack to "./unpack":
sudo dpkg -x ../nvidia-l4t-kernel_4.9.201-tegra-32.5.0-20210115151051_arm64.deb ./unpack

Then you could see what is actually in the content of the “.deb”, along with the metadata of packaging. I have not done this before on Ubuntu packages (mostly what I’ve worked on is Fedora rpm packages), but the instructions for repackaging would be the same on a Jetson as on other Ubuntu 18.04 platforms. So if you see what needs editing, then perhaps you could experiment with turning your kernel (and related content, e.g., device trees and initrd) into custom packages which replace and supersede the original kernel packages. With that in place, and either creating a local repository on the Jetson or your own remote repository, you could avoid overwrites. You could also mark hold on your packages even if you don’t have a custom repository.

1 Like

Yes, it will.

Actually, OTA update method is more like a demonstrate for non-customized case. If you have too many customized elements there, please be careful when using that.

Please note that even “boot from external storage” has risk when running OTA.

1 Like

Thank you for the information @linuxdev . Given I only need to load a single kernel module, I am considering just using the nvidia kernel and just loading the kernel module on startup.

If the module is not needed for reading the filesystem, then that would be fairly easy. If this is required for actual initial boot, then you’d need to make sure the module is in the initrd package.

1 Like