I want to load module and driver. At first there were errors like:

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

So I did the actions as stated here:

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

But still, I can not create a ko file.

This is the Error:

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

This is the 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 Answers