最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

makefile - loading kernel module on a Pixel 8 on CalyxOS - Stack Overflow

matteradmin8PV0评论

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).

Post a comment

comment list (0)

  1. No comments so far