Apt-upgrade updates custom kernel to default

I stumbled upon a similar problem discussed here: Apt-upgrade uploads nvidia-l4t-kernel - #13 by Gorgo90

The sole reason I had a custom kernel in the first place I needed just one device driver as a module (a 5G modem, cdc-wdm).

Before the update there was a folder /lib/modules/5.15.148-tegra/ and after the update there was also /lib/modules/5.15.148-rt-tegra/

Is there any way to build the module on the running system or do I need to reflash again with custom kernel?

Please see attached apt history log.

history.log (14.2 KB)

You could blacklist kernel updates, but that might not be a good idea for the reason of other software depending on that update. On the other hand, if you have the kernel source for the specific release version you now run, and if you configure the build by starting with that kernel’s exact configuration, including CONFIG_LOCALVERSION, you could then add your feature as a module (if it is available as a module; not everything is available as a module, but most are), compile against that correctly configured source, and then copy just the module in place.

This can be done on the Jetson itself.

Hi,
Please apply the steps if you have custom kernel/bootloader:

Making sure you're not a bot!
[Jetpack 6.1/r36.4.0] Self-built kernel is overwritten after sudo apt update && sudo apt upgrade

Thank you! I was able to get the missing modules with not-so-straightforward procedure:

  1. Download the full Jetson Linux 36.4.4 driver package to get the source_sync.sh script.

  2. Figure out from apt history log the newly installed kernel sources can be synced with 36.4.7 tag

  3. Configure kernel sources first with make defconfig and then menuconfig to add the driver (which had one dependancy) as a module.

  4. Finally make modules, copy the missing ones under /lib/modules/ to their respective places and run depmod

It would have saved a bit of effort if there was a package for the kernel sources as there are for the kernel headers.