简体   繁体   中英

Android kernel modules build failed

i want to build pixel3 blueline android10 kernel module.

my example test.c:

#include"linux/module.h"
#include"linux/kernel.h"

int init_module(void)
{
printk(KERN_INFO "Hello android kernel...\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye android kernel...\n");
}

my Makefile:

obj-m += test.o

all:
    make -C /home/ijiami/newdisk/android10/aosp_kernel M=$(PWD) modules

i get android kernel branch android-msm-crosshatch-4.9-android10-qpr3:

ijiami@ijiami-All-Series:~/newdisk/android10/aosp_kernel$ ls 
build  build.config  out  prebuilts  prebuilts-master  private

the error:

ijiami@ijiami-All-Series:~/newdisk/android10/ko_test$ make
make -C /home/ijiami/newdisk/android10/aosp_kernel M=/home/ijiami/newdisk/android10/ko_test modules 
make[1]: Entering directory '/home/ijiami/newdisk/android10/aosp_kernel'
make[1]: *** No rule to make target 'modules'.  Stop. 
make[1]: Leaving directory '/home/ijiami/newdisk/android10/aosp_kernel' Makefile:4: recipe for target 'all' failed 
make: *** [all] Error 2

It appears that the makefile in the specified directory is not being found or is not being executed properly. Make sure that you are in the correct directory and that the makefile exists.

The error message also suggests that there is no rule for building target 'modules' in the makefile. Check the makefile in the specified directory and ensure that it has the correct target and dependencies for building the kernel modules.

Make sure that the kernel source has been successfully built and that the environment is set up correctly for building kernel modules. This typically involves setting the CROSS_COMPILE variable to point to the correct toolchain and ensuring that the correct headers are in place.

Also check if you have the necessary build dependencies installed.

It might be helpful to check the build documentation for the specific Android version and device that you are working with to ensure that you are following the correct steps for building kernel modules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM