Build Kernel
Thursday, 13. October 2005, 22:45:25
Kernel Build HOWTO
The Linux kernel under Debian
Creating custom kernels with Debian's kernel-package system
Debian-Kernel-Compile-Howto (Kernel 2.6)
Debian-Kernel-Compile-Howto (Kernel 2.4)
First try
My current linux kernel is 2.6.8, but I found out that some old code that I need for the testbed can not compile with this version. So I decide to install kernel 2.4.27 in the same machine (coexisting with 2.6.8). My steps are as follows:
apt-get kernel-source-2.4.27
cd /usr/src
tar -jxf kernel-source-2.4.27.tar.bz2
ln -s kernel-source-2.4.27 linux
cd linux
make xconfig
# Load 2.6.8 configuration file from /boot/config-2.6.8-2-386.
# Yes, it works here!
make-kpkg --append-to-version -2-386 kernel_image
# It really takes time on the Dell C800 Laptop.
# Find something interesting to do while
# the computer is doing its job!
cd /usr/src
dpkg -i kernel-image-2.4.27-2-386_10.00_Custom_i386.deb
# /boot/, /boot/grub/menu.lst, /lib/modules/
# have been updated automatically!
# Create a ramdisk of your new kernel
# (otherwise your system will most likely not boot):
# And change the /boot/grub/menu.lst to include the
# initrd for the new kernel
mkinitrd -o /boot/initrd.img-2.4.27-2-386 2.4.27-2-386
rm linux
reboot
Unfortunately, after a long time of waiting, system failed to boot. Kernel stopped at cs: IO port probe.
It seems that 2.4 kernel has problem with pcmcia support.
Then I checked the Linux PCMCIA Information Page and the following tutorial: Creating custom kernels with Debian's kernel-package system. The following is particularly useful
"Third-party modules" is the term I use for kernel modules with source code outside the kernel source tree. An example is "pcmcia-cs", which many laptop users need for the latest PCMCIA support.
To use pcmcia-cs, apt-get the "pcmcia-source" package; the source tarball should be in /usr/src. As a normal user, expand the source tarball to /usr/src/modules/pcmcia-cs. If you don't already have a modules directory one will be created.
When you configure your kernel, disable PCMCIA support. (If you have PCMCIA support enabled, pcmcia-cs won't build drivers.) If you want to use wireless LAN, enable it under "Network device support" but don't select any devices.
When you are ready to build your kernel, add "modules_image" to your command line:bash:/usr/src/linux$ fakeroot make-kpkg --append-to-version=.030401 \ kernel_image modules_image
(As you learn more and more the make-kpkg command line gets longer and longer.)
After your kernel-image .deb is made, make-kpkg will go to /usr/src/modules and build a modules .deb for each subdirectory, with the same version and --append-to-version as your kernel. Install the modules-image .debs after you install the kernel-image .deb.
That's it. Could this get any easier?
Second try
apt-get install pcmcia-source cd /usr/src tar -jxf pcmcia-cs.tar.bz2 ln -s kernel-source-2.4.27 linux cd linux make xconfig #disable PCMCIA support make-kpkg clean make-kpkg --append-to-version=-bob1 kernel_image modules_image cd /usr/src dpkg -i kernel-image-2.4.27-bob1_10.00_Custom_i386.deb dpkg -i pcmcia-modules-2.4.27-bob1_3.2.5-10+10.00.Custom_i386.deb
Finally, system can boot! However, USB mouse did not work and the PCMCIA card did not work. Frustrated! And piconet-dsr and kernel-aodv can not compile in the new 2.4.27 kernel neither. Maybe I should wait for the testbed code from Dr.Buchegger to decide how to proceed. I plan to figure out how to use pcmcia-cs module in 2.4.27 kernel and maybe recompile the kernel another time.

How to use Quote function: