I got the exact same errors when I tried to compile v4l2loopback kernel module for 4.4.179
modprobe: ERROR: could not insert module test.c: Invalid module format
uname -r reported: 4.4.179
modinfo 4.4.179
It took me two days to get it fixed:
As I understand it you will need not only the matching kernel header files. You need a complete kernel source tree with
a bunch of files that are created on compiling the kernel. So what I did is the following:
Setup Development Environment:
In order to compile an Linux kernel I suggest you do it on a 64 bit Ubuntu 16.04 system (VirtualBox) and install the following packages:
sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zip
sudo apt-get install flex curl libncurses5-dev libssl-dev gawk minicom
sudo apt-get install openjdk-8-jdk
sudo apt-get install exfat-fuse exfat-utils device-tree-compiler liblz4-tool
Install Cross Compiler:
git clone
https://github.com/friendlyarm/prebuilts.git -b master --depth 1
cd prebuilts/gcc-x64
cat toolchain-6.4-aarch64.tar.gz* | sudo tar xz -C /
export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin:$PATH
export GCC_COLORS=auto
Compile FriendlyCore/FriendlyDesktop/Lubuntu/EFlasher Kernel Source Code:
git clone
https://github.com/friendlyarm/kernel-rockchip --depth 1 -b nanopi4-linux-v4.4.y kernel-rockchip
cd kernel-rockchip
export PATH=/opt/FriendlyARM/toolchain/6.4-aarch64/bin/:$PATH
make ARCH=arm64 nanopi4_linux_defconfig
make ARCH=arm64 nanopi4-images
Because my Ubuntu 16.04 system runs kernel 4.15.0-88-generic I then edited the makefile of v4l2loopback so it uses the kernel source tree that I worked on. I got a working v4l2loopback.ko that I could successfully load on the 4.4.179 kernel that comes with the FriendlyDesktop bistro from Friendlyarm for NanoPi M4V2