Introduction to kernel compilation In debian (ubuntu)

Source: Internet
Author: User
Introduction to compiling the kernel under debian (ubuntu)-General Linux technology-Linux programming and kernel information. The following is a detailed description. 1) some necessary tools for compiling the kernel:
Apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
2) enter the directory where the kernel should be stored:
Cd/usr/src
3) Get the latest kernel from the official website
Wget http://www.kernel.org/pub/linux/kern....16.20.tar.bz2
(Finger@kernel.org to find the latest stable version number)
4) Move the kernel to/usr/src to create a shortcut
Tar jxvf linux-2.6.16.20.tar.bz2
Ln-s linux-2.6.16.20 linux
5) copy the Kernel configuration file used by the current system to the new kernel directory,
Cp/boot/config-2.6.8.2/usr/src/linux/. config
6) configure the kernel
A] Move the keyboard, select the Load an Alternate Configuration File item, and call. config to Load the kernel option according to this Configuration by default, reducing compilation difficulty;
B] modify your machine. I am a newbie, but I have changed a few places. You can go to the basic area to find reference posts.
C] Save and exit
7) Start Compilation
See the official debian document here.
[
Cd kernel-source-2.4.18 # If This Is Your kernel source code
Cp/boot/config-2.4.18. config # set the current configuration to the default configuration
Make menuconfig # customize according to your preferences
Make-kpkg clean # You must perform this step (per: man make-kpkg)
Fakeroot make-kpkg -- append_to_version-486 -- initrd \ -- revision = rev.01 kernel_image \ modules_image # modules_image can be pcmcia-cs.
$ Cd ..
# Dpkg-I kernel-image *. deb pcmcia-cs *. deb # Installation

]
My practices
Make-kpkg clean
Fakeroot make-kpkg -- revision = custom.1.0 kernel_image
The compilation process is a bit long (it may be that my machine is broken and it took more than 50 minutes). After the compilation, a deb package should be formed under/usr/src: kernel-image -*. deb

8) Next, install the new kernel:

Dpkg-I kernel-image-*. deb

9) create a memory image
Cd/boot
Mkinitrd-o/boot/initrd. img-2.6.16.20 2.6.16.20

10) Modify grub
Vi/boot/grub/menu. lst,
Information in menu. lst:
Title Debian GNU/Linux, kernel BRL. 12-1-386
Root (hd0, 0)
Kernel/vmlinuz-2.6.12-1-386 root =/dev/hda2 ro
Initrd/initrd. img-2.6.12-1-386
Savedefault
Boot
Check and enter new kernel boot Information
Title Debian GNU/Linux, kernel 2.6.16.20
Root (hd0, 0)
Kernel/vmlinuz-2.6.16.20 root =/dev/hda2 ro
Initrd/initrd. img-2.6.16.20
Savedefault
Boot

So far, the kernel upgrade is completed and started once successfully.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.