====== References ====== The following links provide some basic background information to start with: * [[http://www.debian.org/doc/manuals/debian-reference/ch09.en.html#_the_kernel | Debian Reference Chapter 9.7 - The kernel]] * [[http://www.debian.org/doc/FAQ/ch-kernel.en.html | The Debian GNU/Linux FAQ Chapter 10 - Debian and the kernel]] * [[http://www.falkotimme.com/howtos/debian_kernel2.6_compile/ | Debian-Kernel-Compile-Howto]] a ====== Requirement / Prerequisite ====== * Extra x86 machine running Debian Etch distribution or other derivatives such as Knoppix and Ubuntu * Several GB of disk space * Install the packages needed for compiling a kernel: apt-get install kernel-package ncurses-dev fakeroot wget bzip2 sharutils ====== Getting Voyage Kernel Source ====== ===== Method 1: Apt-getting ===== Point /etc/apt/sources.list to www.voyage.hk, for latest kernel development deb http://www.voyage.hk/dists/experimental ./ for stable kernel or kernels used by voyage-0.4.x, deb http://www.voyage.hk/dists/0.4 ./ Don't forget to update the repository apt-get update To get kernel source, run apt-get install linux-source-2.6.x-voyage where x is the version number of the kernel source you wish to download. To search what kernels are in debian voyage apt repository before installing: apt-cache search linux-source ===== Method 2: Download deb source ===== Download the voyage kernel-source debian package from the following location: http://www.voyage.hk/dists/0.4/linux/ <= stable kernel, voyage-0.4 kernels For example, wget and install the kernel-source package by running "dpkg -i ", something like: wget http://www.voyage.hk/dists/0.4/linux/linux-source-2.6.20-voyage_4.0-2_all.deb dpkg -i linux-source-2.6.20-voyage_4.0-2_all.deb ====== Setting up Kernel Source Tree ====== ===== Extracting kernel source tarball ===== By either method, it will install the kernel source tarball to /usr/src. Extract the tarball by: cd /usr/src tar -jxf linux-source-2.6.20-voyage.tar.bz2 This will extract the voyage kernel source to linux-source-2.6.20-voyage ===== Downloading kernel configuration ===== Download the corresponding kernel config file from voyage.hk and put to /usr/src: wget http://www.voyage.hk/download/kernel_config/config-2.6.8-486-voyage_2.0-3 cp config-2.6.8-486-voyage_2.0-3 kernel-source-2.6.8-voyage/.config Kernel configuration files can be found [[http://www.voyage.hk/download/kernel_config/|here]]. ===== Patching kernel ===== You can now apply your own kernel patch to voyage kernel, here are the commands I use: cd kernel-source-2.6.8-voyage patch -p1 < Look at the output to see if the patch is rejected. (some of the later patches had to be applied with -p4 instead of -p1. ill-diffing?) ======= Building Kernel ======= ===== Enable kernel module and drivers ====== Most of the time, you will want to enable some modules compiled for the kernel. If so, run: make menuconfig find the module and enable it. ===== Edit makefile ====== Edit the makefile to specify the correct version information: EXTRAVERSION = -486-voyage (Not needed if you use --append-to-version!) target architecture (if you're cross-compiling) and compiler version (gcc-3.3 for 2.6.17-486-voyage): ARCH ?= $(SUBARCH) CROSS_COMPILE ?= HOSTCC = gcc-3ve.3 CC = $(CROSS_COMPILE)gcc-3.3 *Note: please add this to Makefile if have compiling problems CFLAGS_KERNEL = -fno-tree-scev-cprop ===== Building Debian kernel image ====== To build debian kernel image: make-kpkg --revision="2.0-3Custom" --append-to-version "-486-voyage" kernel-image --rootcmd fakeroot --initrd This is the command that will build the voyage kernel. You may want to modify the --revision and --append-to-version flags to specify the different revision and version of your choice. Read the output to see if the compilation fails. If no error spotted, the new debian kernel package can be found in /usr/src/. The kernel image should be named like kernel-image-2.6.8-486-voyage-2.0.3Custom_i386.deb. In some cases, if you have some compile problem, you could do a 'make' in the root of kernel-source and then do a debian style make-kpkg: fakeroot make-kpkg --append_to_version -486-voyage --revision=3.0-2Cust kernel_image --initrd this way has worked for me.. Remember to upgrade grub after the installation of the new kernel: update-grub ===== Building Debian kernel source ====== You might also want to build kernel source so that other people can further enhance the updated kernel. make-kpkg --revision="2.0-3Custom" --append_to_version "-486-voyage" kernel-source --rootcmd fakeroot Typically, this was usually run before building kernel image ======= Install debian kernel image ======= Copy the debian kernel package to voyage and install the kernel by running "dpkg -i". You will need to answer a couple of questions to complete the installation of the kernel image. After all, reboot the voyage linux to make it effective! ====== Other Notes ======= ===== Building kernel module in Debian way ====== Who knows? man make-kpkg ;-) ===== Building kernel module the nondebian way ====== Make the makefile changes above, then make You might also have luck with make path/to/module.ko Upload the module to your Voyage system then do insmod module.ko Check dmesg. If it didn't complain, and you have decent messages in dmesg, move the module to its proper location in /lib/modules/. Don't forget! you need to run: depmod before rebooting to check that the module is working. ===== Generating kernel patch for sharing ====== In voyage kernel build process, kernel patch is generated against the original debian kernel source. They are available at http://www.voyage.hk/download/kernel_patch/2.6/. kernel patch is generated using the following command: diff -Naur kernel-source-2.6.8 kernel-source-2.6.8-voyage | gzip -c > kernel-patch-2.6.8-voyage.patch.gz