Kernel configuration is invalid. include/linux/autoconf.h or include/config/auto.conf are missing

https://blog.csdn.net/yusiguyuan/article/details/11144941

 
  1. //刚下载的linux源代码,一个简单的hello驱动都没有编译通过

  2. //下面是驱动源代码

  3. #include <linux/init.h>

  4. #include <linux/module.h>

  5. static int hello_init(void)

  6. {

  7. printk(KERN_ALERT "Hello, Tekkaman Ninja !\n");

  8. return 0;

  9. }

  10. static void hello_exit(void)

  11. {

  12. printk(KERN_ALERT "Goodbye, Tekkaman Ninja !\n Love Linux !Love ARM ! Love KeKe !\n");

  13. }

  14. module_init(hello_init);

  15. module_exit(hello_exit);

  16. MODULE_LICENSE("Dual BSD/GPL");

下面是简单的makefile文件

 
  1. obj-m := hello.o

  2. KERNELDIR = /home/xduser/study/driver/src/linux-2.6.22

  3. PWD := $(shell pwd)

  4. default:

  5. $(MAKE) -C $(KERNELDIR) M=$(PWD) modules

但是却有错误

 
  1. make[1]: Entering directory `/home/xduser/study/driver/src/linux-2.6.22'

  2. ERROR: Kernel configuration is invalid.

  3. include/linux/autoconf.h or include/config/auto.conf are missing.

  4. Run 'make oldconfig && make prepare' on kernel src to fix it.

  5. WARNING: Symbol version dump /home/xduser/study/driver/src/linux-2.6.22'/Module.symvers

  6. is missing; modules will have no dependencies and modversions.

原因是内核没有编译,先处理内核

进入内核目录执行

1, make oldconfig

2, make prepare

3, make scripts

然后在执行make编译hello驱动即可

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

从一而终

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值