编译安装内核
- 先下载https://www.kernel.org/ 下载内核文件,tar xf linux-版本tar.xz
- 复制/boot/下的config-版本号
- cp /boot/config-2.6.32-696.el6.x86_64 linux-3.16.45/config
- 安装开发包组
- yum groupinstall "Development Tools"
- tar 解压 tar xf linux-3.18.56.tar.xz 压缩包
- cd 切换至解压目录
- cp拷贝/boot/下的 cp /boot/config-2.6.32-696.el6.x86_64 至安装目录并改名叫.cinfig文件(拷贝模板文件)
- 使用图形化工具
[root@centos6 linux-3.16.45]# make menuconfig
、 HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
*** 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
使用yum源安装工具
[root@centos6 linux-3.16.45]# yum -y install ncurses-devel
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package ncurses-devel.x86_64 0:5.7-4.20090207.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Installing:
ncurses-devel x86_64 5.7-4.20090207.el6 base 641 k
Transaction Summary
=====================================================================================================================================
Install 1 Package(s)
Total download size: 641 k
Installed size: 1.7 M
Downloading Packages:
ncurses-devel-5.7-4.20090207.el6.x86_64.rpm | 641 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ncurses-devel-5.7-4.20090207.el6.x86_64 1/1
Verifying : ncurses-devel-5.7-4.20090207.el6.x86_64 1/1
Installed:
ncurses-devel.x86_64 0:5.7-4.20090207.el6
Complete!
- 打开图形化工具[root@centos6 linux-3.16.45]# make menuconfig
General setup ---> : 通用设置箭头表示子菜单
-
回车进入通用设置子菜单;定义内核的小版本设置好后使用tab键后按回车回到上级菜单
-
网络设置的子菜单
-
设置文件系统类型
设置编译时是否支持NTFS功能
进入后选中敲空格键
- 编译内核
make [-j #] - 安装内核模块
make modules_install -
拷贝内核文件
make install
- 单独编译吗某个模块
- 删除编译生成的文件
- 卸载时删除安装时生成的目录
- 删除boot跟安装内核版本有关的所有文件,以及修改grub文件
- 删除/lib/modules/ 目录下不需要的内核库文件
- 删除解压目录下不需要的内核源码
- 删除/boot 目录下启动的内核和内核映像文件
- 更改grub的配置文件,删除不需要的内核启动列表