1

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?

Thirdeye
  • 89
  • 3

1 Answers1

0

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.

Pang
  • 9,564
  • 146
  • 81
  • 122
Rami Rosen
  • 330
  • 2
  • 2
  • The output of ls -al /usr/src/linux-4.3.0-sabayon is: total 5156 drwxr-xr-x 3 root root 4096 Jan 5 2016 . drwxr-xr-x 6 root root 4096 Dec 30 12:15 .. -rw-r--r-- 1 root root 177673 Dec 16 2015 .config drwxr-xr-x 3 root root 4096 Jan 5 2016 include -rw-r--r-- 1 root root 54503 Dec 16 2015 Makefile -rw-r--r-- 1 root root 1262265 Dec 16 2015 Module.symvers -rw-r--r-- 1 root root 3761878 Dec 16 2015 System.map I searched (equo search kernel header) and the results say that I have headers installed. Not sure where to look for them however. – Thirdeye Dec 30 '16 at 20:56
  • 1
    Your two queries should be posted as a comment, and not as an answer. BTW Ubuntu is not *"a dervative [sic] of Gentoo"*; it's a well-known Debian-based distro. – sawdust Dec 30 '16 at 22:30
  • It was a typo, apologies. I meant that sabayon is a derivative of gentoo, and not that Ubuntu is a derivative of gentoo. Rami Rosen – Rami Rosen Dec 31 '16 at 22:01