I am using the latest Jetpack 5.0.2 and downloaded the L4T-35.1 kernel source from https://developer.nvidia.com/embedded/l4t/r35_release_v1.0/sources/public_sources.tbz2. Then, I could build a custom kernel module from this source. My target AGX Xavier was flashed using pre-built images through the SDK Manager. When I loaded the custom module into this target, it reported this error disagrees about version of symbol module_layout.
I think it might be the mismatch of both kernel configurations. However, I could use the same build procedures in previous Jetpack version 4.4.1 or 4.6.1 and could load the module.
How to fix this if the target is using the pre-built Jetpack 5.0.2 image?
Did you set up your custom kernel to start with the same configuration as the running kernel, plus set CONFIG_LOCALVERSION? If not, then you need to start with this, and then add modules. Otherwise either config will mismatch or “uname -r” will mismatch.
Thanks for your advice. CONFIG_LOCALVERSION has been already set before kernel build.
now I can figure out the problem. It is because I used an old toolchain compiler from Jetpack 4.4.1 or 4.6.1, After I used the new ones from Jetpack 5.0.2, it can work.