1 , view kernel version
Experimental environment
[[email protected] src] #uname-R
2.6.32-358.el6.x86_64
2 , installing the graphics dependency package
Yum Install - y ncurses ncurses-devel
3 , download kernel
[Email protected]src]# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.16.2.tar.xz
Extract
[Email protected] src]# TAR-XF linux-3.16.2.tar.xz-c/usr/src/
4 , compiling and installing
[Email protected] src]# cd/usr/src/linux-3.16.2
[[Email protected]linux-3.16.2]# make Mrproper
[Email protected]linux-3.16.2] #make menuconfig
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/49/B1/wKioL1QZCAfBFthVAAIBCXcqICE234.jpg "title=" Untitled picture. png "alt=" wkiol1qzcafbfthvaaibcxcqice234.jpg "/>
Set, save and exit.
......
End of Theconfiguration.
Execute ' make ' to start of the build or try ' make help '.
[[Email protected]linux-3.16.2]# make
......
/bin/sh:bc:command not found
MAKE[1]: ***[kernel/timeconst.h] Error 127
Make: * * * [Kernel]error 2
Error: Missing BC
[Email protected] src]# yuminstall-y BC
Run again
[[Email protected]linux-3.16.2]# make
equivalent to: make DEP (build dependent attribute relationships), make clean (remove old data), do Bzimage (start compiling core), Makemodules (Start compiling module)
the process will probably 1 , 2 hours.
Error:
Drivers/tty/serial/built-in.o:final Close Failed:no space left on device
MAKE[3]: ***[DRIVERS/TTY/SERIAL/BUILT-IN.O] Error 1
MAKE[2]: ***[drivers/tty/serial] Error 2
MAKE[1]: ***[drivers/tty] Error 2
Make: * * * [Drivers]error 2
The reason is that there is not enough disk space to clean up the disk or expand the disk
[[Email protected]linux-3.16.2]# make Modules_install
Install the module to /lib/modules/ to load the module from this directory later when the program runs.
[[Email protected]linux-3.16.2]# make install
Installing the kernel
put Make all generated Vmlinuz and System.map are copied to the/boot directory while modifying grub/boot/grub/menu.lst. Modify MENU.LST without manual modification.
sh./arch/x86/boot/install.sh 3.16.2 arch/x86/boot/bzimage \
System.map "/Boot"
ERROR:modinfo:could not find module Snd_page_alloc
ERROR:modinfo:could not find module Vmware_balloon
Error
These two modules have already been loaded:
[Email protected]linux-3.16.2]# lsmod |grep Snd_page_alloc
Snd_page_alloc 8470 1 SND_PCM
[Email protected]linux-3.16.2]# lsmod |grep Vmware_balloon
Vmware_balloon 7199 0
View the next Grub
[[Email protected]linux-3.16.2]# cat/boot/grub/grub.conf
#
# Note that you donot has to rerun grub after making changes to the This file
# notice:you has a/boot partition. This means
# all kernel and INITRD paths arerelative to/boot/, eg.
# root (hd0,0)
# kernel/vmlinuz-version Roroot=/dev/mapper/volgroup-lv_root
# initrd/initrd-[generic-]version.img
#boot =/DEV/SDA
Default=1
Timeout=5
Splashimage= (hd0,0)/grub/splash.xpm.gz
Hiddenmenu
Title RedHat Enterprise Linux Server (3.16.2)
Root (hd0,0)
kernel/vmlinuz-3.16.2 ro Root=/dev/mapper/volgroup-lv_rootrd_no_luks lang=en_us. UTF-8 RD_NO_MD Rd_lvm_lv=volgroup/lv_swapsysfont=latarcyrheb-sun16 Crashkernel=auto rd_LVM_LV=VolGroup/lv_root KEYBOARDTYPE=PC keytable=us RD_NO_DM Rhgbquiet
Initrd/initramfs-3.16.2.img
Title Red hatenterprise Linux (2.6.32-358.el6.x86_64)
Root (hd0,0)
kernel/vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/mapper/volgroup-lv_root rd_no_lukslang=en_us. UTF-8 RD_NO_MD Rd_lvm_lv=volgroup/lv_swap Sysfont=latarcyrheb-sun16crashkernel=auto rd_LVM_LV=VolGroup/lv_root keyboardtype=pc keytable=us rd_no_dm RHGB quiet
Initrd/initramfs-2.6.32-358.el6.x86_64.img
There's been a lot of new stuff. Then there are two error modules we can ignore.
then modify default =1 to be default=0
5 , restart
[[Email protected] ~] #uname-A
Linux kernel 3.16.2 #1 SMP Wed Sep 04:18:19 CST2014 x86_64 x86_64 x86_64 gnu/linux
Compilation succeeded
About the error:
[[Email protected]linux-3.16.2]# make Modules_install
sh./arch/x86/boot/install.sh 3.16.2 arch/x86/boot/bzimage \
System.map "/Boot"
ERROR:modinfo:could not find module Snd_page_alloc
ERROR:modinfo:could not find module Vmware_balloon
If your CentOS is installed on VMware, you may see this warning at the last make install step:
ERROR:modinfo:could Notfind Module Vmware_balloon
literally, the Vmware_balloon module is not found, and this vmware_balloon is actually called memory release or balloon bloat (see this article "for 2 possible reasons:
First, verify that your. config file contains config_vmware_balloon=m this line, or you can use Make Menuconfig go to kernel compile menu, check devicedrivers -> MISC devices, VMware Balloon Driver for M or *
Second, and this module in the later version, has been renamed to Vmw_balloon, so you can use the following command to solve:
Cd/lib/modules/3.x.xx/kernel/drivers/misc #将版本号改成你自己的ln-S Vmw_balloon.ko vmware_balloon.ko #建立软连接
Tips:
If you have a lot of could not find module XXXX error when you last make install, and you do not know which of the corresponding is. config, you can use this command:
Grep-r--include=makefile ' \bname\.o\b '
The above workaround is from: http://winotes.net/centos-64-upgrade-to-kernel-3x.html
This article is from the "Habits" blog, make sure to keep this source http://xiguanmin.blog.51cto.com/4857855/1553714
Linux compile kernel steps and error resolution