make 出了什么问题?

发布于 2024-11-25 10:06:35 字数 1373 浏览 1 评论 0原文

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(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

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

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(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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

离线来电— 2024-12-02 10:06:35

猜测:您没有在自定义 Makefile 中设置 M 环境变量。请参阅http://tldp.org/LDP/lkmpg/2.6/html/x181。 html

下次,请确实问一个比“出了什么问题?”更具体的问题。

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?'

月牙弯弯 2024-12-02 10:06:35

我认为 make 有什么问题。不过,我非常确定您的 Makefile 有问题。根据一些随机的互联网搜索,尝试如下操作:

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

假设您的 Makefile 位于 /home/mgh/Documents 中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文