1

I wanted to create a simple Hello world driver as in here: Page2 and compile it with Makefile:

obj-m := hello.o

all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

But I got:

make1: *** /lib/modules/4.3.5-300.fc23.x86_64/build: No such file or directory.

Which is logic, since build is a link to /usr/src/kernels/4.3.5-300.fc23.x86_64 and my /usr/src directory is empty. But kernel-devel is installed: rpm -qa|grep kernel:

kernel-headers-4.3.5-300.fc23.x86_64
kernel-modules-4.3.5-300.fc23.x86_64
kernel-core-4.2.3-300.fc23.x86_64
kernel-devel-4.3.5-300.fc23.x86_64
kernel-4.2.3-300.fc23.x86_64
kernel-modules-extra-4.3.5-300.fc23.x86_64
kernel-modules-extra-4.2.3-300.fc23.x86_64
kernel-core-4.3.5-300.fc23.x86_64
libreport-plugin-kerneloops-2.6.4-1.fc23.x86_64
abrt-addon-kerneloops-2.8.0-2.fc23.x86_64
kernel-4.3.5-300.fc23.x86_64
kernel-modules-4.2.3-300.fc23.x86_64

And I read that these packages might have been stored in /usr/include and when I try to install them, it of course keep saying that they are already installed.

Question: What should I do, makefile or installation, to properly compile my hello.c to hello.ko ?

I have Fedora 23.

1 Answer 1

0

Okay, so for me worked upgrading/installing kernel and all kernel-X modules. After that a kernel (propriate version) directory appeared in /usr/src/kernels/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.