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);
- move hellomodule.c to firefly-rk3399/kernel/drivers/misc/
- add to makefile (in misc):
obj-$(CONFIG_HELLO_MODULE) += HelloModule.o
3.add to Kconfig(in misc):
config HELLO_MODULE
tristate "Hello Module"
default y
- cd firefly-rk3399/
- ./FFtools/make.sh -j32
- ./FFtools/mkupdate/mkupdate.sh
- 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:
- is there a way to see the installed modules on android adb shell? (lsmod doesnt work )
- how do you run hellomodule in this case? (modprobe doesnt work)
- im trying to run
make ARCH=arm64 CROSS_COMPILE=?
to make a .ko for hellomodule.c by itselfWhere is the cross compiler for the rk3399 board?