Insmod issue: disagrees about version of symbol module_layout


I’m customizing the kernel r35.1, JetPack 5.0.2.

$ uname -r

When I do insmod with newly compiled kernel module, I can see the error messages in dmesg.

[   89.929329] nv_imx219: disagrees about version of symbol module_layout
[  107.639780] nv_lc898212: disagrees about version of symbol module_layout

To fix this, I modified defconfig. CONFIG_MODVERSIONS=y to CONFIG_MODVERSIONS=n. After copying new kernel image and moduels, that error message has disappeared.

However, insmod shows still error messages. (It is not dmesg error)

insmod: ERROR: could not insert module my_module.ko: Invalid module format

Some pages in google said it can occur when kernel version of image and module are not the same. However, in my case, they have the same version.

$ modinfo my_module.ko
vermagic: 5.10.104-tegra SMP preempt mod_unload aarch64

# below module(built in image) does not show error message.
$modinfo /usr/lib/modules/5.10.104-tegra/kernel/drivers/media/i2c/max96712.ko
vermagic:       5.10.104-tegra SMP preempt mod_unload modversions aarch64

At first, I couldn’t do insmod because of signing. How I ignore signing issue is discussed in I want to sign kernel and dtb files - #20 by jw.cs.park.

Thank you in advance.

Is this the original kernel Image? What does it reply when you run the command “uname -r”? Looks like it will be “5.10.104-tegra”, but I want to confirm.

The module would need to be built against a kernel configured to that same “uname -r”. The prefix is the base kernel version, and so using 5.10.104 kernel source (which is what you get when you download the kernel from the NVIDIA web site) would fulfill this. The suffix though is “-tegra”, and I’m guessing you missed configuring that. You could do this from one of the config edit tools, e.g., “menuconfig” or “nconfig” (I like the latter because you can search for symbols, e.g., search for “CONFIG_LOCALVERSION”), or else directly editing the “.config” file (I don’t recommend this for most features, but CONFIG_LOCALVERSION has no dependencies). If editing .config:

Thank you for your response.

I compiled the kernel image and it is copied to Orin board.
The result of uname -r is 5.10.104-tegra. I didn’t configure the suffix but it is added by default. As you recommended, I added CONFIG_LOCALVERSION="-tegra" and the modinfo shows this results.

vermagic:       5.10.104-tegra-tegra SMP preempt mod_unload aarch64

I think it is not correct. -tegra is duplicated when I add CONFIG_LOCALVERSION="-tegra". But uname -r still shows 5.10.104-tegra.

It looks like the kernel image and the kernel module have the same kernel version and the same name (includes -tegra suffix by default).

Yes, if something else already configured “-tegra”, then you’ll actually need to remove the duplicate from “CONFIG_LOCALVERSION” (there are multiple ways to configure this, e.g., through environment variables, and my assumption was that it was unconfigured). This would cause all modules to be looked for at:
…and it would fail unless you put new modules there (the old modules are compiled for “5.10.104-tegra”, not “5.10.104-tegra-tegra”).

Keep in mind that the response of “uname -r” is bound to the actual “Image” file. The version magic of the module indicates that “uname -r” was not “5.10.104-tegra”, but instead “5.10.104-tegra-tegra”, which the kernel is not allowing. One can build and install modules separately from a kernel Image, but the “uname -r” has to match the version magic. This says “-tegra” was double set during module compile, but single set (which is correct) during “Image” compile.

Until now, I used to flash Orin.
I flashed Orin with SDK manager and it works now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.