Problem with loading kernel modules



I have compiled a linaro-hikey kernel following the instructions in
Kernel version is 4.9.28,
cross compilers are aarch64-linux-android-*
and I enabled loadable module support in the config.
I created a new boot image using the built images and flashed them.

I have a very simple Hello World kernel module that I want to load.
I compiled it using the same kernel source directory and the same cross compilers.
Versions are matching.
I pushed the .ko file, and su to root on the device.

Now the problem is I get "failed to load, …, Operation not permitted"
when I do the insmod on the device!

I ran the insmod as root and tried 777 permission on the module file.
I even turned off enforcing, but nothing changed.
And there’s nothing being logged in dmesg.

How can I load the module?



So I solved the problem!

The problem was that initramfs was loading all the necessary modules and disabling loading any further modules through /proc/sys/kernel/modules_disabled
I changed the boot config to prevent it from disabling the module loading.

Insmod not working

Hello saeeden,

can you describe how did you modify the boot config please?
Kind regards.


I edited the init.rc file and simply commented the line that disables the module loading. You can find those lines by searching for “modules_disabled”.