|
How to add a module to android Kernel
Posted at 1/7/2018 07:43:46
View:2505
|
Replies:0
Print
Only Author
[Copy Link]
1#
Hello im new to making modules for android/linux so i apologize if these are obvious questions but ive been having trouble with getting this to work properly.
Ive been trying to add a simple hello module to the android kernel. here are my current steps:
HelloModule.c:- #include <linux/module.h>
- #include <linux/kernel.h>
- #include <linux/init.h>
- static int __init hello_module(void)
- {
- printk(KERN_INFO "Hello android kernel...\n");
- return 0;
- }
- static void __exit goodbye_module(void)
- {
- printk(KERN_INFO "Goodbye android kernel...\n");
- }
- module_init(hello_module);
- module_exit(goodbye_module);
Copy the code 1. move hellomodule.c to firefly-rk3399/kernel/drivers/misc/
2. add to makefile (in misc):- obj-$(CONFIG_HELLO_MODULE) += HelloModule.o
Copy the code 3.add to Kconfig(in misc):
- config HELLO_MODULE
- tristate "Hello Module"
- default y
Copy the code 4. cd firefly-rk3399/
5. ./FFtools/make.sh -j32
6. ./FFtools/mkupdate/mkupdate.sh
7. sudo upgade_tool uf ./rockdev/Image-rk3399_firefly_box/Firefly-RK3399_Android7.1.1_MP_180106.img
It looks like hellomodule.o was compiled correctly in /misc directory
The diffrences between android kernel and a normal linux kernel have been giving me trouble, So heres my questions:
1. is there a way to see the installed modules on android adb shell? (lsmod doesnt work )
2. how do you run hellomodule in this case? (modprobe doesnt work)
3. im trying to run- make ARCH=arm64 CROSS_COMPILE=?
Copy the code to make a .ko for hellomodule.c by itselfWhere is the cross compiler for the rk3399 board?
|
|