# http://www.timntina.com/debian-cobalt-kernel-compile
#-------------------------------------------------------------------------------
# install necessary packages for kernel compiling
apt-get install build-essential kernel-package gcc libncurses5 libncurses5-dev bin86 gawk ncurses-dev initramfs-tools
apt-get install bzip2
# download linux kernel source
cd /usr/src
wget 'http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.3.tar.bz2'
# unpack the kernel source
tar -jxvf linux-2.6.24.3.tar.bz2
# rename so you can see it has been patched...
mv linux-2.6.24.3 linux-2.6.24.3-raq4
# link to the source directory for building the kernel & change into
ln -s linux-2.6.24.3-raq4 linux
cd linux
# download and apply kernel patch
wget 'http://cobalt.timntina.com/kernel/2.6.24.3-cobalt3-tw/linux-2.6.24.3-cobalt3-tw.patch'
patch -p1 < linux-2.6.24.3-cobalt3-tw.patch
# get working config file for 2.6.24.3 with cobalt options, netfilter and support for a few of the author's devices
wget 'http://cobalt.timntina.com/kernel/2.6.24.3-cobalt3-tw/linux-2.6.24.3-cobalt3-tw.config'
cp linux-2.6.24.3-cobalt3-tw.config .config
#-------------------------------------------------------------------------------
# add *optional* trailing version information
# open makefile for editing... use your favorite text editor
vi Makefile
# at the top, you will find the variables which build the full version information.
# find the variable EXTRAVERSION & add anything to the end that you'd like.
# whatever you add here will show up with `uname -r` when running the new kernel.
# EXTRAVERSION = .3-raq4
#-------------------------------------------------------------------------------
# prep to compile
# during the oldconfig step, you may be asked a series of questions regarding
# support for different options. most components can be built statically
# (included in the kernel) or as a module. this step will also add options that
# have been added since your previous config to the new one. the menuconfig step
# will give you a set of menus that will allow you to browse through the
# different categories of options as well as add or remove them.
make oldconfig
make menuconfig
make-kpkg clean
# compile kernel (tim wiley)
# change --revision to anything you want. this will show up in the debian package name.
# i usually go with the date & my revision number.
make-kpkg --initrd --revision='2007.03.02-1' kernel_image kernel_headers modules_image
# -or-
# compile kernel (ubuntu)
# insert any text you like in place of custom in the 'append-to-version=-' string.
# i used jtuttle# where # is the incrementing version i tried. you should not have to
# make any changes in menuconfig, just use the tab key to select the exit option and save it.
# the last line is the command that compiles the kernel. it takes a long time, it took
# exactly one hour for my kernel to compile.
make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers modules_image
# install kernel packages that were just compiled (kenel-image, kernel-headers)
# this includes the loadable .o modules, etc... this dpkg installation will install
# a bzImage vmlinuz-2.6.24.3-raq4 kernel to the /boot directory. the bzImage will not
# be a suitable kernel for the cobalt bootstrap, it can safely be deleted if desired.
cd /usr/src
dpkg -i kernel-image-2.6.24.3-raq4_2007.03.02-1_i386.deb
dpkg -i kernel-headers-2.6.24.3-raq4_2007.03.02-1_i386.deb
# create vmlinux
cd /usr/src/linux
make vmlinux modules modules_install # this is indeed unnecessary!
strip vmlinux
bzip2 -c vmlinux > /boot/vmlinux-2.6.24.3-raq4.bz2
# the kernel can not be any larger than 1800k when compressed, so you'll want to
# check it before moving on.
du /boot/vmlinux-2.6.24.3-raq4.bz2
# 1448 vmlinux-2.6.24.3-raq4.bz2 (kernel is 1448k, so below 1800k)...
# if your bzipped kernel is larger than 1800k, you should try removing support for
# certain options that aren't necessary or build some options as modules.
# re-create bootloader links
# since the cobalts don't have a bootloader, they load generic files from the
# boot partition. so we're going to create links to our new kernel for the boot ROM.
cd /boot
rm vmlinux.bz2 initrd.img System.map
ln -s vmlinux-2.6.24.3-raq4.bz2 vmlinux.bz2
ln -s initrd.img-2.6.24.3-raq4 initrd.img
ln -s System.map-2.6.24.3-raq4 System.map
# reboot
shutdown -r now
#-------------------------------------------------------------------------------
# ubuntu how-to branches somewhat after the kernel is compiled...
# install the kernel, if you are asked about stopping due to initrd, say 'no' and
# continue. there may be another question here to answer 'no' to.
cd /usr/src
dpkg -i kernel*
# create vmlinux
cd /usr/src/linux
make vmlinux modules modules_install
strip vmlinux
bzip2 vmlinux
cp vmlinux.bz2 /boot
# confirm that the kernel is less than 1800kb. kb=M*1024
du --si /boot/vmlinux.bz2
# make initial ram disk (initrd) by substituting the name you gave to your kernel.
cd /boot
mkinitramfs -o /initrd.img-2.6.19.2-jtuttle2 2.6.19.2-jtuttle2
#-------------------------------------------------------------------------------
Additional instructions to reference on kernel building:
http://gentoo.404ster.com/texts.php?action=view&id=6
Configure Kernel Option and Compile:
# make vmlinux modules modules_install
# strip vmlinux
# bzip2 vmlinux
# cp vmlinux.bz2 /boot/
#-------------------------------------------------------------------------------