Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NO such file or directory error when doing insmod in Android Kernel

I followed the steps in the forum (http://www.schaeuffelhut.de/wordpress/?p=237&cpage=1#comment-384) to get the linux kernel source and and cross compile my module. The kernel version of the google nexus one is exactly the same as in the forum. I initially tested with my test module hello-1.ko which got installed on the android device successfully. But when I am installing my module ec.ko on the android device using insmod, I get the following error.

apurva@apurva-Inspiron-1464:~/$ adb shell
$ cd sdcard/data/ec
$ ls
ec.ko
$ su
# insmod ec.ko
insmod: init_module 'ec.ko' failed (No such file or directory)
#

It is clear that the file ec.ko is present. But I am not sure why it is not picking the file. I did the same thing for hello-1.ko and it gets insmod pretty fine. There is no permission issue, and ec.ko gets the same permission as was obtained by hello-1.ko.

Now this bring me to the question, Are there certain limitations of a kernel module in an android device because this module gets insmod in Ubuntu. Next action for me is to go for a hit and trial method and check what lines in ec.c is causing the problem. Meanwhile if you some suggestion, please let me know.

like image 997
user1219784 Avatar asked Mar 04 '12 00:03

user1219784


People also ask

What happens when insmod is performed?

Insmod copies the module into the allocated space and relocates it so that it will run from the kernel address that it has been allocated. This must happen as the module cannot expect to be loaded at the same address twice let alone into the same address in two different Linux systems.

What is the difference between modprobe and insmod?

insmod is similar to modprobe: it can insert a module into the Linux kernel. Unlike modprobe, however, insmod does not read its modules from a set location, automatically insert them, and manage any dependencies. insmod can insert a single module from any location, and does not consider dependencies when doing so.

Where is insmod and Rmmod located?

The insmod Command ko) into the kernel. There are only 2 options - on -h for help, and -V fto show the version of insmod. This example shows running the insmod command from the /lib/modules/$(uname -r) directory, and that the . ko file exists in the specified directory.


1 Answers

You can check the dmesg log to see something can help you.I have also encountered the same problem.Following is how I solved this problem. I installed my module on the android device by using insmod command,but I got the same error message like you.I checked the dmesg at that time,and I got this:Unknown symbol "XXX"(I have forgotten the function name.).I used the command —— cat /proc/kallsyms |grep "XXX" to find this symbol,but I found nothing.The reason for this problem is the function have been deprecated in AndroidM.Finally,I fixed this problem by annotating the function.

like image 170
Phoenix Chao Avatar answered Oct 06 '22 00:10

Phoenix Chao