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

6,670 views
Skip to first unread message

Apurva Jaiswal.

unread,
Mar 3, 2012, 7:12:18 PM3/3/12
to android...@googlegroups.com

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:~/RA/MultFlowSync_Ahmad/thesiscode_final/android_ec/ec$ 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.

rong

unread,
Mar 4, 2012, 7:17:56 PM3/4/12
to Android Linux Kernel Development
Okay, this is a easy one. But first of all, I found a lot of questions
posted on this group are actually fairly basic and not specifically
related to Android kernel, you may find better chance to get those
questions answered and more instantly on other Linux kernel
development forum.

Back to the question, it did find your file, except somehow either
your module_init function didn't return 0 (for correct initialization)
instead it returned -ENOENT, which was why insmod printed out that
"not found" message, or are you sure you have cross-compiled your
module with proper toolchain? Regarding your question about
limitation, no I'm not aware of any.

Cheers,
Rong


On Mar 4, 11:12 am, "Apurva Jaiswal." <jaiswal.apu...@gmail.com>
wrote:

Apurva Jaiswal

unread,
Mar 4, 2012, 9:19:28 PM3/4/12
to android...@googlegroups.com
Hello,

The dmesg error is as follows

<4>[56941.357788] ec: Unknown symbol tcp_get_info (err 0)
<4>[56941.360656] ec: Unknown symbol debugfs_remove (err 0)
<4>[56941.362548] ec: Unknown symbol __aeabi_fdiv (err 0)
<4>[56941.364440] ec: Unknown symbol __aeabi_ui2f (err 0)
<4>[56941.366546] ec: Unknown symbol __aeabi_fmul (err 0)
<4>[56941.369079] ec: Unknown symbol __aeabi_f2uiz (err 0)

I hope this provides a lot more info and suggest that something is
wrong with the module. The kernel module was compiled with the exact
kernel source as in the device, but the device is currently having the
stock kernel obtained from AOSP site. So I guess the android kernel in
order to let install this module requires to have some more
configuration enabled. I guess I will have to flash the custom kernel
on the device and then try insmod.

Any comments?

Thanks and Regards,

Apurva Jaiswal

> --
> unsubscribe: android-kerne...@googlegroups.com
> website: http://groups.google.com/group/android-kernel

--
Thanks and Regards,

Apurva Jaiswal

Phone No. +358 465424993
Email: jaiswal...@gmail.com

rong

unread,
Mar 5, 2012, 4:24:59 AM3/5/12
to Android Linux Kernel Development
The first two errors suggest you didn't declared that your module is
GPL compatible, i.e. missing the following line or similar in your
source code.

The rest suggest you have used floating point calculations in your
module. Kernel doesn't do floating point calculations. Find yourself
some workarounds.

Regards,
Rong


MODULE_LICENSE("GPL v2");
> Email: jaiswal.apu...@gmail.com

rong

unread,
Mar 5, 2012, 4:26:39 AM3/5/12
to Android Linux Kernel Development
sorry it should read
"
The first two errors suggest you didn't declared that your module is
GPL compatible, i.e. missing the following line or similar in your
source code:

Ashish Daga

unread,
Mar 5, 2012, 5:03:49 AM3/5/12
to android...@googlegroups.com
Yes Kernel does not allow for floating point calculations since the virtual memory footprint is different as compared to the User space.

In addition, one needs to be careful as to the style of module writing in case of Kernel space as compared to the user space. Infact keep in mind to use more dynamic allocation of memory

Ashish

Apurva Jaiswal

unread,
Mar 7, 2012, 1:10:12 PM3/7/12
to android...@googlegroups.com
Hello,

@Ashish Thanks for the info. I was able to run the module after
removing the floating arithmetic. Do you think there is a work around
if I want to have some floating point calculations in my module.

Thanks and Regards,

Apurva Jaiswal

--
Thanks and Regards,

Apurva Jaiswal

Phone No. +358 465424993
Email: jaiswal...@gmail.com

Reply all
Reply to author
Forward
0 new messages