$ sudo insmod ./test.ko
insmod: ERROR: could not insert module test.ko: Invalid module format
Should I modify the header files of Linux?
How to export Linux header files from kernel source code? such as/usr/src/Linux headers 5.10.104 tegra ubuntu20.04-arch64
Did you reboot the device after installing new kernels?
Your module is now built against the new kernel, but if you don’t reboot, it is still the old kernel that currently runs on the device, which is imcompatible with your module.
yes, I build the module with the new kernel, but it does not work normally.
In x86 machine, I usually replace new kernel header source after updating the new kernel. But I don’t know how to export header files in the Orin kernel code.
Tip: You can unpack the full kernel source at the correct location for headers if you don’t have a “headers specific” package. For example, if you go here: cd /lib/modules/$(uname -r)
And then check: ls -ld build
You might find the location is: /usr/src/linux-headers-$(uname -r)/
You could unpack the kernel source you used at that latter location. This contains more source than needed, but it also includes the headers. Sometimes you’d need to configure it, but most of the time not.
(the uname -r is from the Jetson, not the host PC)