简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM