Insmod: ERROR: could not insert module ./overlay.ko: Invalid module format

root@nano:~# cd /lib/modules/4.9.253-tegra/kernel/fs
root@nano:/lib/modules/4.9.253-tegra/kernel/fs# ls -a
.  ..  binfmt_misc.ko  btrfs  cifs  fuse  nfs_common  nfsd  overlayfs
root@nano:/lib/modules/4.9.253-tegra/kernel/fs# cd overlayfs/
root@nano:/lib/modules/4.9.253-tegra/kernel/fs/overlayfs# ls -al
total 100
drwxr-xr-x 2 root root  4096 aug  2  2021 .
drwxr-xr-x 8 root root  4096 aug  2  2021 ..
-rw-r--r-- 1 root root 92760 jul 26  2021 overlay.ko
root@nano:/lib/modules/4.9.253-tegra/kernel/fs/overlayfs# insmod ./overlay.ko 
insmod: ERROR: could not insert module ./overlay.ko: Invalid module format
root@nano:/lib/modules/4.9.253-tegra/kernel/fs/overlayfs# insmod overlay.ko 
insmod: ERROR: could not insert module overlay.ko: Invalid module format

Hi, Team!
Where I can download these files?

Thank you !

Apparently the file in question was not built for either (A) the architecture, or perhaps (B) that configuration. For a module to work with a given kernel it has to be compiled with some of the same configuration that the kernel itself was compiled with. To get this file you would need to download the kernel source for that particular L4T release, configure to match the existing system, use a configuration editor to add the overlay features, and then build the modules.

L4T is just Ubuntu plus NVIDIA drivers, and you can find your release with “head -n 1 /etc/nv_tegra_release”. You can then go to this URL for related documentation and downloads:

The “driver package sources” contains the kernel source (it is a kernel source package within a package). The file being extracted is noted along with its subdirectory, and this is what gets extracted:
(you can see what is in the original file via “tar --list -j -f ./public_sources.tbz2”)

The actual extraction is:
tar xjfv ./public_sources.tbz2 'Linux_for_Tegra/source/public/kernel_src.tbz2'
(do this from an empty directory, although you could do this from the parent directory to “Linux_for_Tegra/”)

You will find it creates:

You must then extract this and delete the rest (remember, I said to use an empty directory to start from…if you did not do that, then don’t delete the other content):

cd Linux_for_Tegra/source/public
tar xvfj kernel_src.tbz2

Now you have the actual kernel source in a subdirectory to that. Go here:

cd kernel/kernel-4.9

This is where most compile steps are from. Note that you could have moved the kernel_src.tbz2 to some specific location before unpacking (you don’t need the leading parent directory tree, this is just how the tree appears if it were to be unpacked within the flash software/board support package). At this point you could do this to remember the build directory if you are in the kernel-4.9/ location:

export TOP=`pwd`

# From then on, in that terminal, you can do this until exiting the terminal:
cd $TOP

Before continuing, are you going to cross compile, or are you going to native compile? Much of it is the same, but there might be an extra argument and some setup for cross compile.

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