I tried to recompile the kernel using official tuto, replaced the /boot/Image with the generated one, and the entire folder /lib/modules/5.10.104-tegra/ with the newly generated one.
However, some of the modules I compiled are loaded correctly, but others not. When trying to do it, I get the following kernel error:
[225798.897772] nvidia: disagrees about version of symbol nvhost_get_default_device
[225798.905415] nvidia: Unknown symbol nvhost_get_default_device (err -22)
[225798.912288] nvidia: disagrees about version of symbol fget
[225798.918021] nvidia: Unknown symbol fget (err -22)
[225798.922999] nvidia: disagrees about version of symbol fd_install
[225798.929266] nvidia: Unknown symbol fd_install (err -22)
[225798.934834] nvidia: disagrees about version of symbol wake_up_process
[225798.941561] nvidia: Unknown symbol wake_up_process (err -22)
[225798.947559] nvidia: disagrees about version of symbol iterate_fd
[225798.953837] nvidia: Unknown symbol iterate_fd (err -22)
[225798.959390] nvidia: disagrees about version of symbol __close_fd
[225798.965662] nvidia: Unknown symbol __close_fd (err -22)
[225798.971389] nvidia: disagrees about version of symbol nvhost_syncpt_unit_interface_get_aperture
[225798.980431] nvidia: Unknown symbol nvhost_syncpt_unit_interface_get_aperture (err -22)
It happens for instance with the nvidia driver (sudo modprobe nvidia), but with many others as well.
By the way, I did not replace the dtbs files. As I understood, these don’t have to be modified if no new hardware or driver modification has been performed.
Should I replace them ? and the kernel dtb file as well ?.
FYI, if you change the kernel source code itself, then old modules won’t load. If you change the integrated features (some features are modules, others are part of the Image file), then you also risk not being able to load old modules. If you change the configuration of CONFIG_LOCALVERSION, then likely you also need to build modules even if 100% of the configuration is an exact match to the old kernel (modules are searched for at “/lib/modules/$(uname -r)/kernel”, and the prefix of “uname -r” is the source code version, with the suffix being the CONFIG_LOCALVERSION).
It is a mistake to install the Image file if all you’ve done is to compile a new module feature without changing an integrated feature. It is also a mistake to change parts of the Image file and not build all modules from scratch. By far it is advisable that:
You start with an exact match to the existing kernel (and the tegra_defconfig target is almost that for a default kernel; one would also set CONFIG_LOCALVERSION to “=-tegra”).
Use a dependency-aware editor, such as the menuconfig or nconfig target to make any changes (I prefer nconfig due to the symbol search function).
If any “=y” feature changes, you must build the Image file, and very likely you must build all of the modules.
If any “=m” feature changes, but no “=y” feature, then most likely you only need to build related modules and can leave the Image alone (requires keeping “CONFIG_LOCALVERSION=-tegra”).
The default configuration reads out-of-tree content, and this is only available with the kernel provided by NVIDIA, so use the source which matches your L4T release (see “head -n 1 /etc/nv_tegra_release”, then go to https://developer.nvidia.com/linux-tegra).