您好,我正在尝试编译我的第一个内核模块,但是我收到一条错误消息。我的模块的hello.c程序如下所示:
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: ListPage(),
floatingActionButton: FloatingActionButton(
onPressed: () =>{},
child: const Icon(Icons.add),
),
);
我的makefile如下:
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void){
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void){
printk(KERN_ALERT "Goodbye, cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
我还想提到我尝试将obj-m := hello.o
KDIR := /lib/modules/4.19.94-ti-r42/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) M=$(PWD)
替换为M=$(PWD)
,但是我仍然收到相同的错误。
当我运行我的make文件时,我收到以下错误消息:
SUBDIRS=$(PWD)
有人知道我在做什么错吗?谢谢。
答案 0 :(得分:0)
您已将您的Makefile命名为makefile
,正如我们从此消息中看到的:
make: *** [makefile:6: default] Error 2
内核构建系统期望您的makefile命名为Makefile
,如以下消息所示:
scripts/Makefile.build:45: /home/debian/LDD-3/Makefile: No such file or directory
所以我建议您使用:
mv makefile Makefile