You are not logged in.
I am attempting to build a custom kernel module for a PCI express interface to an FPGA. However, I seem to be running into some issues with getting the standard kernel module makefile to work correctly. Here is my makefile:
# object files to build
obj-m += nnic.o
nic-objs += nnic_driver.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(pwd) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(pwd) cleanHowever, the first time I ran 'make', I got this output:
make -C /lib/modules/3.14.1-1-ARCH/build M= modules
make[1]: Entering directory '/usr/lib/modules/3.14.1-1-ARCH/build'
Makefile:608: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
scripts/kconfig/conf --silentoldconfig Kconfig
*** Error during update of the configuration.
/usr/lib/modules/3.14.1-1-ARCH/build/scripts/kconfig/Makefile:36: recipe for target 'silentoldconfig' failed
make[3]: *** [silentoldconfig] Error 1
/usr/lib/modules/3.14.1-1-ARCH/build/Makefile:512: recipe for target 'silentoldconfig' failed
make[2]: *** [silentoldconfig] Error 2
scripts/Makefile.build:44: /usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/syscalls/Makefile: No such file or directory
make[2]: *** No rule to make target '/usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/syscalls/Makefile'. Stop.
/usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/Makefile:183: recipe for target 'archheaders' failed
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/lib/modules/3.14.1-1-ARCH/build'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2After poking around online, I decided to try running make as root. I got the following output:
make -C /lib/modules/3.14.1-1-ARCH/build M= modules
make[1]: Entering directory '/usr/lib/modules/3.14.1-1-ARCH/build'
scripts/kconfig/conf --silentoldconfig Kconfig
scripts/Makefile.build:44: /usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/syscalls/Makefile: No such file or directory
make[2]: *** No rule to make target '/usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/syscalls/Makefile'. Stop.
/usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/Makefile:183: recipe for target 'archheaders' failed
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/lib/modules/3.14.1-1-ARCH/build'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2Now, when runing 'make' as a normal user, I get:
make -C /lib/modules/3.14.1-1-ARCH/build M= modules
make[1]: Entering directory '/usr/lib/modules/3.14.1-1-ARCH/build'
Makefile:608: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
scripts/Makefile.build:44: /usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/syscalls/Makefile: No such file or directory
make[2]: *** No rule to make target '/usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/syscalls/Makefile'. Stop.
/usr/lib/modules/3.14.1-1-ARCH/build/arch/x86/Makefile:183: recipe for target 'archheaders' failed
make[1]: *** [archheaders] Error 2
make[1]: Leaving directory '/usr/lib/modules/3.14.1-1-ARCH/build'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2I have the linux-headers package installed. I do not need to build the whole kernel, only this small module. What am I missing here? What is the correct procedure for this?
Last edited by alex.forencich (2014-04-25 08:16:31)
Offline
Sigh, found the problem. Should be $(PWD) and not $(pwd) in my makefile.
Offline