环 境: CentOS 5.4 x86_64 linux-2.6.32.29
操 作: intel pro 1000 系列15.4的驱动,编译安装 e1000-8.0.18
出现问题:编译的时候提示缺少头文件 mmzone.h ....bounds.h...等
include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
include/linux/mmzone.h:197:5: warning: "MAX_NR_ZONES" is not defined
原因:bounds.h是在编译内核时生成的,类似于编译产生的.o文件,如果你运行
"make clean" or "make distclean",这个文件就会被清除掉(详情查看内核Makefile)。因此,如果再利用此内核源码编译内核模块,如果有涉及bounds.h,就会出现找不到该文件的错误。解决:独立内核目录之外编译模块时,要确保makefile文件中所定义的内核源代码树已经make过一遍,且没有make clean。这样就不会清除生成的bound.h头文件,这个文件是生成模块必须的。
或者"make prepare"
这样就会重新生成bounds.h,再看看其内容:
#ifndef __LINUX_BOUNDS_H__
#define __LINUX_BOUNDS_H__
/*
* DO NOT MODIFY.
*
* This file was generated by Kbuild
*
*/
#define NR_PAGEFLAGS 19 /* __NR_PAGEFLAGS @ */
#define MAX_NR_ZONES 3 /* __MAX_NR_ZONES @ */#endif
参考:http://blog.youkuaiyun.com/wby0322/archive/2010/05/26/5624565.aspx