内核编译

来源:互联网 发布:swagger ui 搭建mac 编辑:程序博客网 时间:2024/04/29 11:10

转载于http://forum.ubuntu.org.cn/viewtopic.php?f=105&t=113443

 

 

http://www.linuxmigration.com/quickref/ ... build.html
redhat下编译参考

http://www.cromwell-intl.com/unix/linux-kernel.html
参考

http://www.digitalhermit.com/linux/Kern ... RATION-2-6参考

http://www.cyberciti.biz/tips/compiling ... el-26.html
ubuntu下参考

http://forum.ubuntu.org.cn/viewtopic.ph ... 31e56bdaf8
安装后配置

 

编译新内核经验总结:(顺便说一句,有很多人很不负责任,从别人那儿转来一篇编译内核的文章就乱发,自己根本就没试过,对与不对自己都不知道,误导别人,这种人啊。。。)
之前也编译过2.6.24的内核,但因为对每个步骤要做的事情,不是很清楚,最终所有的工作全部白费,糊里糊涂的就失败了,我想说的是,自己编译内核,一定要清楚每一个步骤你是在做什么,为什么要这么做,如果都清楚了,那么你肯定能编译成功,现在我们就开始吧

步骤:在www.kernal.org的官网上下载自己需要的内核,解压的步骤就省了吧,这个相信使用linux的人都会
1.我下载的是2.6.24的核,解压后的目录为linux-2.6.24。
cd linux-2.6.24若之前编译过内核,需要用命令
sudo make mrproper 清理一下
2.Now you can start kernel configuration by typing any one of the command:
$ make menuconfig - Text based color menus, radiolists &dialogs. This option also useful on remote server if you wanna compilekernel remotely.
$ make xconfig - X windows (Qt) based configuration tool, works best under KDE desktop
$ make gconfig - X windows (Gtk) based configuration tool, works best under Gnome Dekstop.

For example make menuconfig command launches following screen:
$ make menuconfig
You have to select different options as per your need. Eachconfiguration option has HELP button associated with it so select helpbutton to get help.

3.Compile kernel
Start compiling to create a compressed kernel image, enter:
$ make
Start compiling to kernel modules:
$ make modules
Install kernel modules (become a root user, use su command):
$ su -
# make modules_install
4.Install kernel
So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.
# make install
It will install three files into /boot directory as well as modification to your kernel grub configuration file:

System.map-2.6.24
config-2.6.24
vmlinuz-2.6.24
5.Create an initrd image
Type the following command at a shell prompt:
# cd /boot
# mkinitrarmfs -o initrd.img-2.6.24 2.6.24
initrd.img-2.6.24 表示initrd images,后一个2.6.24是的位置是在/lib/modules目录下
initrd images contains device driver which needed to load rest ofthe operating system later on. Not all computer requires initrd, but itis safe to create one.
6. Modify Grub configuration file - /boot/grub/menu.lst
Open file using vi:
# vi /boot/grub/menu.lst
title kernel 2.6.24 Default
root (hd0,2)
kernel /boot/vmlinuz root=/dev/hdb3 ro
initrd /boot/initrd.img-2.6.24
savedefault
bootRemember to setup correct root=/dev/hdXX device. Save the file.If you think editing and writing all lines by hand is too much for youthen try out update-grub command to update the lines for each kernel in/boot/grub/menu.lst file. Just type command:
# update-grub
若仅仅用命令update-grub在menu.lst不会出现initrd /boot/initrd.img-2.6.24的,若无initrd的映像文件,该内核是不会启动,会出现错误,无法启动新内核。
7.computer and boot into your new kernel
Just issue reboot command:
# reboot


 

 

原创粉丝点击