红联Linux门户
Linux帮助

Build a kernel in Ubuntu

发布时间:2007-10-22 00:23:23来源:红联作者:compat
1. Install some relative packages

sudo apt-get install build-essential fakeroot kernel-package libncurses5-dev libgtk2.0-dev libglib2.0-dev libglade2-dev

libncurses5-dev for menuconfig, libgtk2.0-dev libglib2.0-dev libglade2-dev for gconfig

2. Download the kernel package and unzip it to /usr/src, and cd to this path

3. Patch new kernel

Download the patch, for example, patch.bz2

sudo bzip2 -dc /usr/src/patch.bz2 | patch -p1 --dry-run

sudo bzip2 -dc /usr/src/patch.bz2 | patch -p1

remember, your are in /usr/src/(your new kernel folder) now

the first command is just a test, the next one make effort to your new kernel

4. Config, maybe a current-config file is a good choice

sudo cp /boot/config-`uname -r` ./.config

sudo make menuconfig

then, choose "Load an Alternate Configuration File", choose ".config", and "OK", when you exit, it alarm "Do you wish to save your new kernel configuration?", choose "yes"

5. Build the kernel

sudo make-kpkg clean

sudo fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers

with --append-to-version= option, you can add some custom description to your new kernel, remember with a '-' ahead.

6. Install new kernel

now new kernel has been built and you can install it to your OS, two new deb packages are now in /usr/src

sudo dpkg -i *.deb

then, check is any changed in /boot/grub/menu.lst

7. Reboot your machine

Now you can reboot your machine with new kernel

Enjoy it!
文章评论

共有 4 条评论

  1. aaa12 于 2011-12-21 13:54:59发表:

    thank you for you share for information!

  2. lbjventure1 于 2011-09-18 10:39:37发表:

    :0w5ty(1

  3. chaipeng 于 2011-08-17 12:26:06发表:

    老鸟!!!

  4. chengweiwei 于 2011-05-20 15:44:57发表:

    (3):os你出现的错误呢?