Debian:编译内核2.6
2011-08-06 08:50
423 查看
所谓千里之行,始于足下,要想进入内核开发,首先要有个可供裁剪的内核,以下内容完整的表述了如何在Debian lenny上编译自己的内核,此内容对内核编译过程表述清楚,操作简单,故照抄之,不想看英文的直接Step by Step 就可以了。
How to: Compile Linux kernel 2.6
by NIXCRAFT on SEPTEMBER29, 2005 · 116
COMMENTS
原文链接:http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html
Compiling custom kernel has its own advantages and disadvantages. However, new Linux user / admin find it difficult to compile Linux kernel. Compiling kernel needs to understand few things and then just type couple of commands.
This step by step howto covers compiling Linux kernel version 2.6.xx under Debian GNU Linux. However, instructions remains the same for any other distribution except for apt-get command.
Step # 1 Get Latest Linux kernel code
Visit http://kernel.org/ anddownload the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number. For example file inux-2.6.25.tar.bz2 represents 2.6.25 kernel version. Use wget command to download kernel source code:
$ cd /tmp $ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2[/code]
Note: Replace x.y.z with actual version number.Type the following command:
Step # 2 Extract tar (.tar.bz3) file# tar -xjvf linux-2.6.25.tar.bz2 -C /usr/src # cd /usr/srcBefore you configure kernel make sure you have development tools (gcc compilers and related tools) are installed on your system. If gcc compiler and tools are not installed then use apt-get command under Debian Linux to install
Step # 3 Configure kernel
development tools.# apt-get install gcc
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.Start compiling to create a compressed kernel image, enter:
Step # 4 Compile kernel$ make
Start compiling to kernel modules:$ make modules
Install kernel modules (become a root user, use su command):$ su - # make modules_installSo far we have compiled kernel and installed kernel modules. It is time to install kernel itself.
Step # 5 Install kernel# make install
It will install three files into /boot directory as well as modification to your kernel grub configuration file:
System.map-2.6.25
config-2.6.25
vmlinuz-2.6.25Type the following command at a shell prompt:
Step # 6: Create an initrd image# cd /boot # mkinitrd -o initrd.img-2.6.25 2.6.25
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.Open file using vi:
Step # 7 Modify Grub configuration file - /boot/grub/menu.lst# vi /boot/grub/menu.lsttitle Debian GNU/Linux, kernel 2.6.25 Default root (hd0,0) kernel /boot/vmlinuz root=/dev/hdb1 ro initrd /boot/initrd.img-2.6.25 savedefault boot
Remember to setup correct root=/dev/hdXX device. Save and close the file. If you think editing and writing all lines by hand is too much for you, try out update-grub command to update the lines for each kernel in /boot/grub/menu.lst
file. Just type the command:# update-grub
Neat. Huh?Just issue reboot command:
Step # 8 : Reboot computer and boot into your new kernel# reboot
相关文章推荐
- 在Debian 4.0rc3上编译内核2.6.24时加入Layer7模块笔记[防火墙中在TCP/IP第七层Layer7应用层阻挡QQ,MSN等软件的应用]
- 在Debian 4.0rc3上编译内核2.6.24时加入Layer7模块笔记--第二版
- 在Debian 4.0rc3上编译内核2.6.24时加入Layer7模块笔记[防火墙中在TCP/IP第七层Layer7应用层阻挡QQ,MSN等软件的应用]
- 在Debian 4.0rc3上编译内核2.6.24时加入Layer7模块笔记--第三版
- 在Debian 4.0rc3上编译内核2.6.24时加入Layer7模块笔记[防火墙中在TCP/IP第七层Layer7应用层阻挡QQ,MSN等软件的应用]
- Debian编译升级内核(could not load /lib/modules/2.6.28/modules.dep问题)
- 在IBM T43笔记本上安装debian etch 2.6内核
- Linux 2.6、4.3内核编译过程的感受与总结
- Linux 2.6内核的编译步骤及模块的动态加载
- Linux 2.6内核的编译步骤及模块的动态加载
- 模块编译KO文件Makefile 2.6内核通用
- 2.6内核的配置与编译
- linux2.6内核编译方法详述
- CRUX2.6安装经验--蛋疼的第一次内核编译
- Linux 2.6内核编译安装全景体验(上)
- sysfs: duplicate filename 's3c2440-nand' can not be created。linux2.6的内核编译中出现的问题
- debian或ubuntu下编译内核时的sys/types.h问题
- LINUX 2.6 内核下多C文件模块编译方法
- 编译 Linux2.6 内核总结
- 在Linux2.6内核(CentOS)中编译内核模块的一个例子