首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

重新编译内核后,之前编译好的模块出错?该怎么处理

2012-02-06 
重新编译内核后,之前编译好的模块出错??我之前的内核是2.4.20-8,在该系统下,写了几个驱动程序模块,并且运

重新编译内核后,之前编译好的模块出错??
我之前的内核是2.4.20-8,   在该系统下,写了几个驱动程序模块,并且

运行良好;

后来,重新编译内核,使用原系统提供的源代码树,在其下面配置编译内核,

然后进入新内核的系统,发现之前写的模块make报错,然后回到原来的内核的系统,

make   仍然出错,不知道具体是什么原因;

错误代码如下:
-D__KERNEL__   -DMODULE   -I/usr/src/linux-2.4.20-8/include   -O   -Wall   -g   -c   short.c   -o   short.o
In   file   included   from   /usr/src/linux-2.4.20-8/include/linux/config.h:4,
                                  from   short.c:26:
/usr/include/linux/autoconf.h:1:2:   #error   Invalid   kernel   header   included   in   userspace
In   file   included   from   /usr/src/linux-2.4.20-8/include/linux/module.h:25,
                                  from   short.c:27:
/usr/include/asm/atomic.h:40:2:   warning:   #warning   Using   kernel   header   in   userland   program.   BAD!
In   file   included   from   /usr/src/linux-2.4.20-8/include/linux/dcache.h:7,
                                  from   /usr/src/linux-2.4.20-8/include/linux/fs.h:19,
                                  from   /usr/src/linux-2.4.20-8/include/linux/capability.h:17,
                                  from   /usr/src/linux-2.4.20-8/include/linux/binfmts.h:4,
                                  from   /usr/src/linux-2.4.20-8/include/linux/sched.h:10,
                                  from   short.c:29:
/usr/src/linux-2.4.20-8/include/linux/mount.h:   In   function   `mntget ':
/usr/src/linux-2.4.20-8/include/linux/mount.h:37:   warning:   implicit   declaration
of   function   `atomic_inc '
/usr/src/linux-2.4.20-8/include/linux/mount.h:   In   function   `mntput ':
/usr/src/linux-2.4.20-8/include/linux/mount.h:46:   warning:   implicit   declaration
of   function   `atomic_dec_and_test '
In   file   included   from   /usr/src/linux-2.4.20-8/include/linux/fs.h:26,
                                  from   /usr/src/linux-2.4.20-8/include/linux/capability.h:17,
                                  from   /usr/src/linux-2.4.20-8/include/linux/binfmts.h:4,
                                  from   /usr/src/linux-2.4.20-8/include/linux/sched.h:10,
                                  from   short.c:29:
/usr/include/asm/bitops.h:327:2:   warning:   #warning   This   includefile   is   not   available   on   all   architectures.
/usr/include/asm/bitops.h:328:2:   warning:   #warning   Using   kernel   headers   in   userspace:   atomicity   not   guaranteed


In   file   included   from   /usr/src/linux-2.4.20-8/include/linux/ext3_fs_i.h:19,
                                  from   /usr/src/linux-2.4.20-8/include/linux/fs.h:298,
                                  from   /usr/src/linux-2.4.20-8/include/linux/capability.h:17,
                                  from   /usr/src/linux-2.4.20-8/include/linux/binfmts.h:4,
                                  from   /usr/src/linux-2.4.20-8/include/linux/sched.h:10,
                                  from   short.c:29:
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:   In   function   `down_read ':
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:46:   warning:   implicit   declaration
of   function   `__down_read '
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:   In   function   `down_read_trylock ':
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:57:   warning:   implicit   declaration
of   function   `__down_read_trylock '
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:   In   function   `down_write ':
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:68:   warning:   implicit   declaration
of   function   `__down_write '
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:   In   function   `down_write_trylock ':/usr/src/linux-2.4.20-8/include/linux/rwsem.h:79:   warning:   implicit   declaration
of   function   `__down_write_trylock '
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:   In   function   `up_read ':
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:90:   warning:   implicit   declaration
of   function   `__up_read '
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:   In   function   `up_write ':
/usr/src/linux-2.4.20-8/include/linux/rwsem.h:100:   warning:   implicit   declaration   of   function   `__up_write '
In   file   included   from   /usr/src/linux-2.4.20-8/include/linux/fs.h:298,
                                  from   /usr/src/linux-2.4.20-8/include/linux/capability.h:17,
                                  from   /usr/src/linux-2.4.20-8/include/linux/binfmts.h:4,
                                  from   /usr/src/linux-2.4.20-8/include/linux/sched.h:10,
                                  from   short.c:29:
/usr/src/linux-2.4.20-8/include/linux/ext3_fs_i.h:   At   top   level:
/usr/src/linux-2.4.20-8/include/linux/ext3_fs_i.h:75:   field   `truncate_sem '   has   incomplete   type
/usr/src/linux-2.4.20-8/include/linux/ext3_fs_i.h:76:   confused   by   earlier   errors,   bailing   out
make:   ***   [short.o]   Error   1

------解决方案--------------------


配置后产生一个配置文件,就是源代码目录下的.config

里面存放了内核配置信息,并且被内核源代码的其它文件包含

但是如果是通过make munuconfig等内核源代码提供的脚本编译,应该不会出错的

1.你在新内核下编译出错,不晓得是什么原因

你可以检查一下,编译内核一般是需要root权限的

2.重新切换回原来的内核,只是运行内核变化了,内核源代码树并没有改变
所以你重新编译原来的模块可以会出错.
你可以把.config删除,然后执行make clean,再重新执行make menuconfig,不需要
配置,产生默认的.config,然后执行 make mrproper,这样就恢复了原来的环境

热点排行