insmod on android w/virtualbox

165 views
Skip to first unread message

Osi

unread,
Jul 20, 2011, 9:34:40 AM7/20/11
to Android-x86
Hi all,

Being a newbie to kernel programming and android, I appologize in
advance if what I'm asking seems trivial .

I want to insert a new module to an android-x86 kernel (in my case to
test a new io scheduler).

I successfuly installed and ran android-x86-2.2-eeepc.iso. I want to
start with an "Hello world" scheduler I have (basiacly took noop and
renamed it), compile it and insmod it so I can use it.

Is there a tutorial on appropriately creating the .ko file? I guess I
can compile the entire kernel to an .iso (though I did not see
specifically that this can easily be done for VirtualBox, and haven't
tried this yet).
But obviously I'd like to avoid compiling an entire kernel and all
this process every time I make a change to my module.

I'd appreciate your help.
Thank you

Chih-Wei Huang

unread,
Jul 20, 2011, 11:47:43 AM7/20/11
to andro...@googlegroups.com
Building an android-x86 kernel module is nothing different
than building a module for a normal linux distribution.

You can just build your module as usual, and
use adb to push the .ko into a running android-x86 system,
and then use insmod to load it.

2011/7/20 Osi <osis...@gmail.com>:

--
Chih-Wei
Android-x86 project
http://www.android-x86.org

osishkin osishkin

unread,
Jul 21, 2011, 4:37:42 AM7/21/11
to Android-x86
Thank you for your reply.

I need to compile it to the specific architecture etc, don't I?
How do I that for the architecture of the kernel already compiled in
the above iso?

Osi

unread,
Aug 1, 2011, 9:31:04 AM8/1/11
to Android-x86
I appologize for the bother, but I'd appreicate any help.
I was able to compile the froyo build for x86 with vm target. I
compiled an iso, and everything runs fine.
But I still need to compile the kernel module, against the android
kernel and architecture I'm using.
Otherwise I get a format error when I try to insmod.
Can I use the current makefiles with a small modification to create
the kernel module I want directly?

Thank you

Yi Sun

unread,
Aug 1, 2011, 1:26:13 PM8/1/11
to andro...@googlegroups.com
I did not read your early e-mail since it is cut off , but here is what I can help:

It depends on how you want to build your module. If you want to build a driver as a kernel module that has the source code comes with the android-x86 kernel source code, then  the only thing you need to do is to change the vm_defconfig and rebuild the kernel. If you have your own driver code that is separated from the standard kernel code, then you can point your kernel dir to the android-x86 kernel directory and rebuild your module. 
For the detail on how to build kernel with Android-x86. you can check on:
For the detail on how to write a makefile for a kernel module, you can find from here http://lwn.net/Kernel/LDD3/
In either case, you will need to either install the module manually or update the auto detect script to have it install your driver correct 
 
--
You received this message because you are subscribed to the Google Groups "Android-x86" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-x86...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-x86?hl=en.


Osi

unread,
Aug 4, 2011, 4:55:09 AM8/4/11
to Android-x86
Thank Yi. I previously tried what the the book you refered me to
suggested, after gathering the information from various tutorials on
the web. But it was insightful, and more organized. So thanks for
that.

For any future newbies who make the same mistake like me -
My problem was that in my source code directory make call I did not
reference the kernel build directory Makefile, but the kernel source
code one. i.e.
# make -C <kernel source code directory> M=`pwd` modules

while I should have done was
# make -C <kernel source code directory>/out/target/product/vm/obj/
kernel M=`pwd` modules

Thanks for all the help here!

On Aug 1, 8:26 pm, Yi Sun <beyo...@gmail.com> wrote:
> I did not read your early e-mail since it is cut off , but here is what I can help:
>
> It depends on how you want to build your module. If you want to build a driver as a kernel module that has the source code comes with the android-x86 kernel source code, then  the only thing you need to do is to change the vm_defconfig and rebuild the kernel. If you have your own driver code that is separated from the standard kernel code, then you can point your kernel dir to the android-x86 kernel directory and rebuild your module.
> For the detail on how to build kernel with Android-x86. you can check on:http://www.android-x86.org/documents/customizekernel
> For the detail on how to write a makefile for a kernel module, you can find from herehttp://lwn.net/Kernel/LDD3/
Reply all
Reply to author
Forward
0 new messages