linux重新编译内核

时间:2021-01-27 03:48:27

在编译内核时,有了一个问题,一直解决不了,网上好多教程,要安的包也安了,可还是报这样的错

在make menuconfig后

[root@localhost linux-4.10.3]# make menuconfig
  HOSTCC  scripts/basic/fixdep
In file included from /usr/include/bits/posix1_lim.h:153,
                 from /usr/include/limits.h:145,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h:122,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/syslimits.h:7,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include/limits.h:11,
                 from scripts/basic/fixdep.c:113:
/usr/include/bits/local_lim.h:36:26: error: linux/limits.h: No such file or directory
In file included from /usr/include/sys/socket.h:35,
                 from /usr/include/netinet/in.h:24,
                 from /usr/include/arpa/inet.h:23,
                 from scripts/basic/fixdep.c:115:
/usr/include/bits/socket.h:310:24: error: asm/socket.h: No such file or directory
scripts/basic/fixdep.c: In function ‘parse_dep_file’:
scripts/basic/fixdep.c:319: error: ‘PATH_MAX’ undeclared (first use in this function)
scripts/basic/fixdep.c:319: error: (Each undeclared identifier is reported only once
scripts/basic/fixdep.c:319: error: for each function it appears in.)
scripts/basic/fixdep.c:319: warning: unused variable ‘s’
make[1]: *** [scripts/basic/fixdep] Error 1
make: *** [scripts_basic] Error 2


然后发现解决方法是安装kernel-headers这个包,可以要安的时候又提示已经安装

最后把这个包卸载了重新安装就好了

yum remove kernel-headers

yum install kernel-headers

最后就可以进行make menuconfig