2016-10-29 113 views
-1

我要運行這個內核模塊編譯內核模塊錯誤

代碼文件hello.c的

#include <linux/module.h> 
#include <linux/kernel.h> 

int init_module(void) { 
    printk(KERN_INFO "Hello world!\n"); 
    return 0; 
} 
void cleanup_module(void) { 
    printk(KERN_INFO "Goodbye world!\n"); 
} 

我跑下面

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 

,但我收到以下錯誤makefile文件

make -C /lib/modules/4.4.0-45-generic/build M=/home/fyousry/Desktop/Untitled Folder 4 modules 
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-45-generic' 
arch/x86/Makefile:148: CONFIG_X86_X32 enabled but no binutils support 
Makefile:676: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler 
make[1]: *** No rule to make target 'Folder'. Stop. 
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-45-generic' 
Makefile:3: recipe for target 'all' failed 
make: *** [all] Error 2 

回答

0

導演Y,它包含此代碼有空間 當我刪除空間是工作(UntitledFolder4而不是Untitled Folder 4

0

當你給一個路徑的命令時,你應該使用雙引號,特別是如果路徑是包含一個子命令或一個變量。 例子:

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

您還可以,如果你想保持它逃脫的空間間隔:

make -C /lib/modules/4.4.0-45-generic/build M=/home/fyousry/Desktop/Untitled\ Folder\ 4 modules