内核编译
-
- 帖子: 51
- 注册时间: 2008-01-01 22:30
内核编译
http://www.linuxmigration.com/quickref/ ... build.html
redhat下编译参考
http://www.cromwell-intl.com/unix/linux-kernel.html
参考
http://www.digitalhermit.com/linux/Kern ... TION-2-6参考
http://www.cyberciti.biz/tips/compiling ... el-26.html
ubuntu下参考
viewtopic.php?t=95863&sid=88b3e55c488d0 ... 31e56bdaf8
安装后配置
redhat下编译参考
http://www.cromwell-intl.com/unix/linux-kernel.html
参考
http://www.digitalhermit.com/linux/Kern ... TION-2-6参考
http://www.cyberciti.biz/tips/compiling ... el-26.html
ubuntu下参考
viewtopic.php?t=95863&sid=88b3e55c488d0 ... 31e56bdaf8
安装后配置
上次由 wyylling 在 2008-04-06 11:31,总共编辑 1 次。
-
- 帖子: 51
- 注册时间: 2008-01-01 22:30
编译新内核经验总结:(顺便说一句,有很多人很不负责任,从别人那儿转来一篇编译内核的文章就乱发,自己根本就没试过,对与不对自己都不知道,误导别人,这种人啊。。。)
之前也编译过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 compile kernel 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. Each configuration option has HELP button associated with it so select help button 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 of the operating system later on. Not all computer requires initrd, but it is 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 you then 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
之前也编译过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 compile kernel 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. Each configuration option has HELP button associated with it so select help button 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 of the operating system later on. Not all computer requires initrd, but it is 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 you then 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
-
- 帖子: 2841
- 注册时间: 2006-09-11 22:47
Re: ding!!
据我观察:haox2653 写了:我是一个linux初学者,你能告诉我你的qq号或邮箱么,我有什么问题好直接请教你。你可以站内信给我!
1。大多数 Linux 高手不用 QQ,他们使用 MSN,google talk 等工具同全世界的人交流。而 QQ 因为只能同中国人交流,往往被弃用。
2。即使有少数用QQ的Linux高手,即使它愿意把QQ号告诉你,他通常也绝对不会喜欢你直接问他问题,有什么问题自己先想办法,或者上论坛,任何人都没有义务一对一的帮你解决问题。
- XEUY
- 帖子: 247
- 注册时间: 2007-08-20 8:13
- 联系:
Re:
wyylling 写了:编译新内核经验总结:(顺便说一句,有很多人很不负责任,从别人那儿转来一篇编译内核的文章就乱发,自己根本就没试过,对与不对自己都不知道,误导别人,这种人啊。。。)
之前也编译过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 compile kernel 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. Each configuration option has HELP button associated with it so select help button 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 of the operating system later on. Not all computer requires initrd, but it is 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 you then 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
学了 二楼好贴!

每天都在起步。。。如同起床
-
- 帖子: 62
- 注册时间: 2009-02-20 13:54
Re: 内核编译
我用make bzImage命令好像不行!我看版主是用的make
- xhy
- 帖子: 3916
- 注册时间: 2005-12-28 1:16
- 系统: Ubuntu 12.10 X64
- 来自: 火星
- xhy
- 帖子: 3916
- 注册时间: 2005-12-28 1:16
- 系统: Ubuntu 12.10 X64
- 来自: 火星
Re: 内核编译
节选自kernel源码目录下的 README
至此,内核源码已经正确安装了。
至此,已经配置编译并且安装好内核了。
代码: 全选
- Make sure you have no stale .o files and dependencies lying around:
cd linux
make mrproper
You should now have the sources correctly installed.
代码: 全选
To configure and build the kernel use:
cd /usr/src/linux-2.6.N
make O=/home/name/build/kernel menuconfig
make O=/home/name/build/kernel
sudo make O=/home/name/build/kernel modules_install install
Please note: If the 'O=output/dir' option is used then it must be
used for all invocations of make.
目前负债150多万
-
- 帖子: 848
- 注册时间: 2009-07-05 19:36
Re: 内核编译

代码: 全选
su
rm /boot/config* # 必须!!!删除系统自带配置文件,这个是 通用内核 的配置文件
lspci # 记下其信息,这是你系统的硬件信息
cd 内核路径
make mrproper
make menuconfig # 注意!!! 有3个驱动必须得编译进[*]内核(不是模块[M])!!! "SCSI disk support","SATA / PATA"中的SATA控制器驱动,文件系统
# 其他驱动,比如 PPPoE,声卡,网卡 也要编译进去。
# 如果你需要使用QEMU虚拟机,那么 FUSE 也要编译进去。
make
make modules_install
make headers_install
cp arch/x86/boot/bzImage /boot/vmlinuz-compiled
update-grub
上次由 def 在 2010-01-16 17:46,总共编辑 1 次。