2011-07-20 23 views
-1

ç製造有什麼問題?

#include <linux/module.h> 
#include <linux/kernel.h> 
int init_module(void) 
{ 
    printk(KERN_INFO "Hello world 1.\n"); 
    return 0; 
} 
void cleanup_module(void) 
{ 
    printk(KERN_INFO "Goodbye world 1.\n"); 
} 

/* makefile */ 
/* uname -r = 2.6.32-5-686 */ 
obj-m += hello.o 
all : 
    make -C /lib/modules/2.6.32-5-686/build /home/mgh/Documents modules 
clean : 
    make -C /lib/modules/2.6.32-5-686/build /home/mgh/Documents clean 

[email protected]:/home/mgh/Documents# make 
make -C /lib/modules/2.6.32-5-686/build /home/mgh/Documents modules 
make[1]: Entering directory /usr/src/linux-headers-2.6.32-5-686' 
/usr/src/linux-headers-2.6.32-5-common/scripts/Makefile.build:44: /usr/src/linux-headers-``2.6.32-5-common/scripts/basic/Makefile: No such file or directory 
make[5]: *** No rule to make target `/usr/src/linux-headers-2.6.32-5-common/scripts/basic``/Makefile'. Stop. 
make[4]: *** [scripts_basic] Error 2 
make[3]: Nothing to be done for `/home/mgh/Documents'. 
make[3]: *** No rule to make target `include/config/auto.conf', needed by `include/config``/kernel.release'. Stop. 
make[2]: *** [sub-make] Error 2 
make[1]: *** [all] Error 2 
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-5-686' 
make: *** [all] Error 2 
+0

引述斯科特邁爾斯: 「?'make'誰需要討厭的'make'」。 – carlpett

回答

4

我否認任何事都是錯make。不過,我非常肯定你的Makefile有問題。根據一些隨機互聯網搜索,嘗試這樣的事情:

make -C /lib/modules/2.6.32-5-686/build SUBDIRS=/home/mgh/Documents modules 

這是假設你的Makefile駐留在/home/mgh/Documents

+0

那麼......我該怎麼辦? –

+0

您是否嘗試按照我的建議更換線條? –

5

臆測:您沒有設置自定義的Makefile M個環境變量。見http://tldp.org/LDP/lkmpg/2.6/html/x181.html

,下一次,請確實問一個更具體的問題不是「什麼是錯了嗎?」

+0

我是這樣做的'使-C /lib/modules/2.6.32-5-686/build M = /家庭/ MGH /文件modules'但錯誤仍然在這裏! :(我的操作系統是Debian的擠壓,我想我還沒有一些文件,如headrs或...(我在Linux新手) –

+0

不,你在你的評論中寫道不是你在你的問題中寫道。如果你是新的,請查看其中一個內核模塊教程,並按照該單詞進行操作。然後,如果遇到問題,請提出更具體的問題。 – BjoernD