今天跟着老师 写字符设备驱动 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
这个错误