c - make 出了什么问题?

标签 c linux module header makefile

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

最佳答案

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

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

关于c - make 出了什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6755677/

相关文章:

linux - AWS EC2 : How to remount previous EBS volume using pivot_root?

linux - Bash - 将 'nested' 变量的值获取到另一个变量中 [编辑 : Indirect Variable Expansion]

c - 在构建词法分析器时使用哈希表

c - 如何将指针传递给数组而不衰减,并在野蛮人的函数中使用 'reference'?

c - 使用 select() 检测 UIO 设备文件上的 block

linux - 由于 ALTER SYSTEM 设置错误而无法启动 postgres

intellij-idea - 具有共享内容根的 Kotlin/IntelliJ 模块

module - Prestashop从产品名称获取产品默认图片?

java - 在 Java 中调用 Python 3.x 函数

c++ - "Linux Kernel API"、 "System Calls"、 "System Interfaces"和 "GNU C Library"有什么区别?