Ubuntu 编译 Linux 内核

http://ubuntuforums.org/showthread.php?t=43065&highlight=kernel+2.6.12

HOWTO: Kernel compilation on UBUNTU

I thought to write this HowTo, since the kernel compile process on Ubuntu is made easier because this distro is debian-based.
First of all, download the kernel package you like from kernel .org or from the Ubuntu repositories.
If you want the official kernel patched by the Ubuntu Team, just type:
Code:

sudo apt-get install linux-tree


In this case we'll use the latest stable vanilla kernel version available.
For the compile process you'll need the following packages on Ubuntu:
Code:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install kernel-package    //used for  "make-kpkg"
sudo apt-get install gcc
sudo apt-get install libncurses5
sudo apt-get install libncurses5-de
sudo apt-get install libqt3-mt-dev

Now untar the package:
Code:

cd /usr/src

sudo tar --bzip2 -xvf linux-2.6.12.tar.bz2

Create the following symlink:
Code:

sudo ln -s /usr/src/linux-2.6.12 /usr/src/linux
cd /usr/src/linux

Now you can start customizing your kernel configuration; there two way, the first one is graphical, the second one pseudo-graphical:
Code:

sudo make xconfig
Or:

Code:

sudo make menuconfig

Then, after having finished the customization, we have to start the compile process:
Code:

sudo make-kpkg clean
sudo make-kpkg --initrd --append-to-version=-custom kernel_image modules_image

The revision flag is optional and is just useful to edit the kernel name showed through uname -r. You can write whatever you want instead of "-custom".

There's also another interesting and useful flag, that is --initrd . The vanilla kernel is not enable yet to make use of initrd properly, and in fact there's a patch for this. The Ubuntu official kernel is a vanilla kernel patched with some patches among which there's the one for initrd. So, if you are compiling a vanilla kernel , you should take --initrd out; otherwise, if you are compiling a Ubuntu kernel , you can make use of initrd and you probably would that.

Note that now you'll have a .deb package in /usr/src ready to be installed as any other package through a simple double-click.
Grub will be updated automatically.
So, just type:
Code:

sudo dpkg -i kernel-image-2.6.12-custom_10.00.Custom_i386.deb


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值