开发者

What is wrong With make?

C

#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(KE开发者_如何转开发RN_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

root@localhost:/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


Guesswork: You did not set the M environment variable in your custom Makefile. See http://tldp.org/LDP/lkmpg/2.6/html/x181.html

And the next time, please do indeed ask a more specific question than 'What is wrong?'


I dispute that anything is wrong with make. I am very certain, though, that something is wrong with your Makefile. According to some random internet searching, try something like this:

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

This is assuming that your Makefile resides in /home/mgh/Documents.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜