韦东山视频学习笔记--字符设备驱动

今天跟着老师 写字符设备驱动 make时 出现了很长的错误

出现了这样的情况

make -C /work/system/linux-2.6.22.6 M=`pwd` modules
make[1]: Entering directory '/work/system/linux-2.6.22.6'

  ERROR: Kernel configuration is invalid.
         include/linux/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.


  WARNING: Symbol version dump /work/system/linux-2.6.22.6/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /work/test/second_drv.o
cc1: include/linux/autoconf.h: No such file or directory
In file included from include/linux/thread_info.h:20,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:49,
                 from include/linux/module.h:9,
                 from /work/test/second_drv.c:2:
include/linux/bitops.h:3:23: asm/types.h: No such file or directory
include/linux/bitops.h:9:24: asm/bitops.h: No such file or directory
In file included from include/linux/thread_info.h:20,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:49,
                 from include/linux/module.h:9,
                 from /work/test/second_drv.c:2:
include/linux/bitops.h: In function `get_bitmask_order':
include/linux/bitops.h:15: warning: implicit declaration of function `fls'
include/linux/bitops.h: In function `hweight_long':
include/linux/bitops.h:31: warning: implicit declaration of function `hweight32'
include/linux/bitops.h:31: warning: implicit declaration of function `hweight64'
include/linux/bitops.h: At top level:
include/linux/bitops.h:39: error: syntax error before "rol32"
include/linux/bitops.h:39: error: syntax error before "word"
include/linux/bitops.h:40: warning: return type defaults to `int'
include/linux/bitops.h:40: warning: function declaration isn't a prototype
include/linux/bitops.h: In function `rol32':
include/linux/bitops.h:41: error: `word' undeclared (first use in this function)
include/linux/bitops.h:41: error: (Each undeclared identifier is reported only once
include/linux/bitops.h:41: error: for each function it appears in.)
include/linux/bitops.h:41: error: `shift' undeclared (first use in this function)
include/linux/bitops.h: At top level:
include/linux/bitops.h:49: error: syntax error before "ror32"
include/linux/bitops.h:49: error: syntax error before "word"
include/linux/bitops.h:50: warning: return type defaults to `int'
include/linux/bitops.h:50: warning: function declaration isn't a prototype
include/linux/bitops.h: In function `ror32':
include/lin

感觉有几百行的这个 错误 当时我就蒙了 不知所措
后来静下心看错误的时候 发现 第五行就把解决问题的方法告知了

 ERROR: Kernel configuration is invalid.
         include/linux/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

然后我就试着执行了一下
sudo make oldconfig
sudo make prepare
问题就解决了
后来上网查资料才发现是版本太新的缘故

还要执行make scripts 命令
不然会出现

/bin/sh: 1: scripts/mod/modpost: not found
/work/system/linux-2.6.22.6/scripts/Makefile.modpost:70: recipe for target '__modpost' failed

这个错误

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值