Title: How to add a module to android Kernel [Print This Page] Author: Orion Time: 1/7/2018 07:43 Title: How to add a module to android Kernel 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):
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?
Welcome Firefly Open Source Community (https://bbs.t-firefly.com/)