下面简单介绍一下Linux内核编译过程
该操作时在Linux redhat 6.5进行操作,Ubuntu操作同理,只需要下载对应的Linux内核就可以
1.下载linux-2.6.37.tar.bz2
链接:https://pan.baidu.com/s/1h_rjk8VjpQXr_InO-pw27Q
提取码:3kk1
2.解压内核源文件
tar -xvf linux-2.6.37.tar.bz2
这里我将文件解压到/usr/src目录下
3.导入配置
首先查看配置文件名称,这里我们可以看到有两个文件,我们选择x86_64_defconfig文件
[root@ogg configs]# pwd /usr/src/linux-2.6.37/arch/x86/configs [root@ogg configs]# ls i386_defconfig x86_64_defconfig
执行命令: make x86_64_defconfig
注意:这里需要到解压目录下执行,执行成功之后,目录下回生成一个.config配置文件
[root@ogg linux-2.6.37]# make x86_64_defconfig HOSTLD scripts/kconfig/conf # # configuration written to .config #
4.执行make meunconfig命令,这里提示缺少ncurses-devel,使用yum进行安装
在Ubuntu下没有碰到这个问题
[root@ogg linux-2.6.37]# make menuconfig *** Unable to find the ncurses libraries or the *** required header files. *** ‘make menuconfig‘ requires the ncurses libraries. *** *** Install ncurses (ncurses-devel) and try again. *** make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1 make: *** [menuconfig] Error 2
5.使用yum安装ncurses-devel
[root@ogg mnt]# yum install -y ncurses-devel Loaded plugins: product-id, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package ncurses-devel.x86_64 0:5.7-3.20090208.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================================================================== Package Arch Version Repository Size =============================================================================================================================================================================================== Installing: ncurses-devel x86_64 5.7-3.20090208.el6 rhel-source 642 k Transaction Summary =============================================================================================================================================================================================== Install 1 Package(s) Total download size: 642 k Installed size: 1.7 M Downloading Packages: Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum. Installing : ncurses-devel-5.7-3.20090208.el6.x86_64 1/1 Verifying : ncurses-devel-5.7-3.20090208.el6.x86_64 1/1 Installed: ncurses-devel.x86_64 0:5.7-3.20090208.el6 Complete!
6.再次执行make menuconfig命令,出现以下,这样就可以进行编辑内核了
附录:Linux官方提示编辑内核的步骤