Trouble compiling 'hello world' kernel module in 4.3.0-sabayon linux

384 views Asked by At

I am trying to compile a simple kernel module. The Makefile is:

obj-m += hello-l.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

The errors are:

make[1]: Entering directory '/usr/src/linux-4.3.0-sabayon'
Makefile:340: scripts/Kbuild.include: No such file or directory
Makefile:605: arch/x86/Makefile: No such file or directory
/bin/sh: ./scripts/gcc-goto.sh: No such file or directory
Makefile:778: scripts/Makefile.kasan: No such file or directory
Makefile:779: scripts/Makefile.extrawarn: No such file or directory
make[1]: *** No rule to make target 'scripts/Makefile.extrawarn'.  Stop.
make[1]: Leaving directory '/usr/src/linux-4.3.0-sabayon'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2

I've been able to compile this code on an Ubuntu machine. Why would the sabayon machine be missing the files necessary to compile even the simplest code?

1

There are 1 answers

3
Rami Rosen On

What does the following command show:

ls -al /usr/src/linux-4.3.0-sabayon

Could it be that the kernel devel headers are not installed on the Sabayon Linux machine? In Fedora, the rpm is called kernel-devel. I do not have any idea how a similar package is called in Ubuntu, which is a derivative of Gentoo.