I have been trying for a few days now. My final goal is to be able to load a kernel module (for example, a simple 'hello world' module) on a rooted Pixel 8 device running CalyxOS. For now, it will also be great to load it on a regular, vanilla, Google Pixel8, Android OS.
I followed the intructions on / except for the last "m" command. That is, I used the repo utility as described and used the setup scripts for Pixel 8 (codename shiba).
Afterwards, I created a simple C file for the module, named hello.c, and a Makefile as follows:
hello.c:
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
static int __init module_start(void)
{
printk(KERN_INFO "Hello, World!\n");
return 0;
}
static void __exit module_end(void)
{
printk(KERN_INFO "Goodbye, World!\n");
}
module_init(module_start);
module_exit(module_end);
Makefile:
obj-m += hello.o
all:
make -C ~/calyxos/android14/build M=$(PWD) modules
clean:
make -C ~/calyxos/android14/build M=$(PWD) clean
And then executed:
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C ~/calyxos/android14/build M=$(PWD) modules
I get an error from the make stating that there is no rule named "modules". Which is indeed correct, as there is no Makefile there at ~/calyxos/android14/build. I tried using the vanilla AOSP and got the same make error. I would appriciate any help on solving this issue.
Alternatively (and even better), I think that if somehow I'll get the kernel headers for the Android kernel version I want, I can to compile the module without compiling the kernel, but I fail to find a wat to retrieve it.
Note that I checked and I succefully can load a simple 'hello world' kernel module on a regular Linux machine (unrelated to the Pixel 8 device).
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745663265a4638966.html
评论列表(0条)