From the information I have found a point of view, there are two ways to compile the Linux kernel.
I would like to talk about the new method, this method is very simple. Anyway, I was a success. Of course, these operations need to be root user. My first CD-ROM Minimum system Debian-etch4.3 installed. Before kernel compiled in such a system, but also need to install some kits.
To complete the kernel compilation, Debian4.3 also need to install the package as follows:
# apt-get install gcc
# apt-get install make
# apt-get install libc6-dev
# apt-get install bzip
# apt-get install ncurse-dev
# apt-get install initrd-tools ## if you want to use the mkinitrd command, you must install this package
With these packages, you should be able to compile the kernel using traditional methods.
If you want to use a new method to compile the kernel, you also need the following packages:
# apt-get install kernel-package
# apt-get install apt-get install fakeroot
After installing the kernel-package package, I suggest that when the compiler encountered any problems when you open this file to see: / usr / share / kernel-package / docs / README
well above preparations, we embark on the next steps to compile and install the kernel
will copy the kernel source file to the relevant directory, then unzip it. I will copy the source code to the next / usr / src directory
# tar xvf Linux-2.6.28.tar.bz2
# cd /usr/src/Linux-2.6.28
make some cleanup. Of course, after you extract the first compilation, you can not do these
# make clean
# make mrproper
The current kernel configuration as a template
# cp /boot/config-2.6.18-6-k7 .config
the first not to make any changes to the kernel configuration file directly start compiling. If you press the Configure compilation config-2.6.18-6-k7 normal start of the new kernel, then the kernel configuration. Because I was related operations in character mode interface menu, so use the following command:
# make menuconfig
appears kernel configuration interface, it can make the appropriate selection based on their computer's hardware. start compiling
# make-dpkg clean
# fakeroot make-kpkg --initrd Linux_image
The above two commands right after the execution, we will see such a debian package in / usr / src directory:
Linux-image-2.6.28_2.6.28-10.00.Custom_i386.deb
install this package, you can complete the installation of the new kernel.
# dpkg -i Linux-image-2.6.28_2.6.28-10.00.Custom_i386.deb
The above command automatically modify menu.lst file, to which the following contents:
title Debian GNU / Linux, kernel 2.6.28
root (hd0,4)
kernel /boot/vmlinuz-2.6.28 root = / dev / hda5 ro
initrd /boot/initrd.img-2.6.28
savedefault
title Debian GNU / Linux, kernel 2.6.28 (single-user mode)
root (hd0,4)
kernel /boot/vmlinuz-2.6.28 root = / dev / hda5 ro single
initrd /boot/initrd.img-2.6.28
savedefault
to restart the computer, you can see the GRUB boot screen has been modified. Select Run menu kernel 2.6.28, Linux to see whether the normal start.
Let us look at the traditional methods. When I use this method to compile the kernel, we had some trouble. In fact, I compiled under 2.4.X kernel debian3.1 environment, although there are some twists and turns, but ultimately successful. I direct that the process of compiling the command needed to run it. I will copy the Linux-2.6.28.tar.bz2 to under / usr / src directory.
# tar xvf Linux-2.6.28.tar.bz2
# cd /usr/src/Linux-2.6.28
# make clean
# make mrproper
# make
# make modules_install
# cp -v / arch / i386 / boot / bzImage /boot/vmlinuz-2.6.28
# cd ../../..
# cp System.map /boot/System.map-2.6.28
# mkinitramfs -o /boot/initrd.img-2.6.28 2.6.28
# cp .config /boot/config-2.6.28
Of course, but also to modify /boot/grub/menu.lst, add the following content:
title Debian GNU / Linux, kernel 2.6.28
root (hd0,4)
kernel /boot/vmlinuz-2.6.28 root = / dev / hda5 ro
initrd /boot/initrd.img-2.6.28
savedefault
to finish the work, restart the computer and see if you can normally enter the Linux system.
Several problems I encountered during compilation:
1, the traditional method of compiling the kernel, after the start-up display 'Unpacking initramfs ... Kernel panic - not syncing: bad gzip magic numbers' error, the boot process will not proceed.
After several experiments, I think it is making use mkinitrd command initrd.img files related problems. I use the command make mkinitramfs initrd.img file, you can start properly. Operating in the following format:
# mkinitramfs -o /boot/initrd.img-2.6.28 2.6.28
In the above command, -o /boot/initrd.img-2.6.28 generate initrd.img-2.6.28 specifies the output file path,
2.6.28 drive module subsequent to the path specified under the space after the /lib/modules/2.6.28 added initrd.img-2.6.28 file. Without this parameter, added initrd.img-2.6.28 file is the current version of the driver module. For example, the Linux operating system kernel version If you are currently running a 2.6.18, then, / lib / 2.6.18 will have a subfolder modules, although the following command is to generate initrd.img file version 2.6.28 , but is actually under the driver module /lib/modules/2.6.18 added:
# mkinitramfs -o /boot/initrd.img-2.6.28
far as I understand, I think initrd.img files generated by the conventional method generates an error because the compiler kernel method is now circulating on the Internet is based on a very low kernel version, in these versions, the compressed file to start initrd format, so those data are used to teach you generate initrd.img mkinit. In later versions of the kernel compile options, instead of the original with initramfs initrd, use mkinitrd command to generate initrd.img file format will naturally produce an error, it is necessary to generate initrd.img replaced mkinitrd command mkinitramfs command. initramfs kernel compilation options in the Options menu position (Linux-2.6.28) are:
General Setup
| --- [M] Initial RAM filesytem and RAM disk (initramfs / initrd) support
2, let the kernel recognize USB devices
To compile options the following options are selected:
Device Drivers
| -SCSI device support
{M} | -SCSI device support
*** SCSI support type (disk, tape, CD-ROM) ***
| -SCSI disk support
[*] | -USB support
| -Support for Host-side USB
*** Miscellaneous USB options ***
[*] | -USB device filesystem
[*] | -USB device class-devices (DEPRECATED)
*** USB Host Controller Drivers ***
[*] | -EHCI HCD (USB 2.0) support
[*] | -OHCI HCD support
[*] | -UHCI HCD support
*** NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may al
*** see USB_STORAGE Help for more information ***
[*] | -USB Mass Storage support
3, let the kernel recognize SATA hard drive
kernel configuration options into the menu mode, select the following content:
Device Drivers
| -SCSI device support
{M} | -SCSI device support
*** SCSI support type (disk, tape, CD-ROM) ***
| -SCSI disk support
Serial ATA (prod) and Parallel ATA (experimental) drivers
[*] | -ATA ACPI Support
[*] | -SATA Port Multiplier support
| -AHCI SATA support
[M] | -ATA SFF support |