生成.ko文件时出错-ubuntu make失败,并显示“目标'all'的配方失败”

时间:2019-05-05 11:49:34

标签: c linux-kernel operating-system linux-device-driver

我想加载模块和驱动程序。 最初有类似以下错误:

CONFIG_UNWINDER_ORC = y, please install libelf-dev, libelf-devel or elfutils-libelf-devel

因此,我按照此处所述进行了操作:

https://askubuntu.com/questions/1070066/how-to-install-libelf-devel-or-elfutils-libelf-devel-in-ubuntu-18-04-hp-laptop-a

但是,我仍然无法创建ko文件。

这是错误:

make -C /lib/modules/4.15.0-48-generic/build M=/home/ex6 modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-48-generic'
make[1]: Warning: File '/home/ex6/.cache.mk' has modification time 0.56 s in the future
make[2]: Warning: File '/home/ex6/.cache.mk' has modification time 0.52 s in the future
  CC [M]  /home/ex6/chardev.o
/home/ex6/chardev.o: Operation not permitted
/home/ex6/chardev.o: failed
scripts/Makefile.build:337: recipe for target '/home/ex6/chardev.o' failed
make[2]: *** [/home/ex6/chardev.o] Error 1
Makefile:1552: recipe for target '_module_/home/ex6' failed
make[1]: *** [_module_/home/ex6] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-48-generic'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2

这是Makefile:

obj-m := chardev.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

all:
    $(MAKE) -C $(KDIR) M=$(PWD) modules

clean:
    $(MAKE) -C $(KDIR) M=$(PWD) clean

0 个答案:

没有答案