The following are user-contributed instructions. Some edits to this wiki page are needed.
All Linux vendors have their own ways and requirements to get a framework in place to build a custom kernel, and Owl is no different, though you may actually find it easier doing it 'the Owl way' compared to other distributions.
Firstly, it is assumed you are already on Owl, and that you have the default set of packages installed. This will include all the items that are necessary in order to generate a kernel package. (
What's “a kernel package”? We don't have one on Owl currently.) You should already have the sources installed (either copied from the CD, or taken via CVS) for the general system in /usr/src/world.
Within /usr/src/world, you should place the kernel sources into a subdirectory called 'kernel'. Here's the simplest way (substitute your own favourite Owl mirror) that I do this:
owl!root:/usr/src/world# su - build owl!build:~$ mkdir kernel owl!build:~$ cd kernel/ owl!build:~/kernel$ lftp ftp://ftp.mathematik.uni-marburg.de/pub/mirror/openwall/Owl/current/kernel/ cd ok, cwd=/pub/mirror/openwall/Owl/current/kernel lftp ftp.mathematik.uni-marburg.de:/pub/mirror/openwall/Owl/current/kernel> mirror -L . `linux-2.6.18.tar.bz2' at 15097860 (36%) 154.6K/s eta:3m [Receiving data] .... (Time elapses, packets move around the world) .... Total: 1 directory, 0 files, 4 symlinks New: 4 files, 0 symlinks 52320728 bytes transferred in 348 seconds (146.9K/s) lftp ftp.mathematik.uni-marburg.de:/pub/mirror/openwall/Owl/current/kernel> exit
Maybe omit the mkdir and cd, and instead use mirror -Lev kernel in lftp. Also, ftp.fr.openwall.com is usually faster.
We are now ready to start to build the kernel! The next step will provide you with a default kernel, with the same options enabled as per the kernel used on the live CD. Simply enter the following command to initiate the build process:
owl!build:~$ make buildkernel
The output will look similar to the below:
owl!build:~$ make buildkernel
test -d native/Owl/build || make checkout
ln -s native/Owl/build/{*.conf,.rpm*} . 2> /dev/null || :
BRANCH=Owl native/Owl/build/buildkernel.sh
15:33:58: Removing stale temporary files if any
15:33:58: Unpacking linux-2.6.18.tar.bz2
15:34:29: Applying patch-128.2.1.el5.028stab064.8-combined.bz2
15:34:43: Applying linux-2.6.18-128.2.1.el5.028stab064.8-owl0.2.diff.gz
15:34:46: Installing dot-config-i386 from owl-cdrom
15:34:46: Configuring kernel
15:34:50: Building kernel image for i386
15:38:53: Copying kernel image
15:38:53: Copying header files
15:38:54: Removing temporary files
owl!build:~$
The kernel image, and associated System.map can be found in the subdirectory /usr/src/world/kernel-work/
owl!build:~$ ls -l kernel-work/boot/* -rw-r--r-- 1 build sources 1149842 Jan 14 15:38 kernel-work/boot/System.map -rw-r--r-- 1 build sources 2857032 Jan 14 15:38 kernel-work/boot/bzImage
You can then install the new kernel (as root!)
owl!root:/usr/src/world/kernel-work/boot# cp /boot/bzImage /boot/bzImage.old owl!root:/usr/src/world/kernel-work/boot# cp /boot/System.map /boot/System.map.old owl!root:/usr/src/world/kernel-work/boot# install -m 0600 bzImage System.map /boot/
You will probably want to edit your /etc/lilo.conf and add in the old entries, for example my /etc/lilo.conf contains:
boot=/dev/sda root=/dev/sda2 read-only lba32 ###prompt timeout=5 menu-title="Openwall GNU/*/Linux boot menu" menu-scheme=kw:Wb:kw:kw image=/boot/bzImage label=linux image=/boot/bzImage.old label=linux.old
And then, ensure you run /sbin/lilo to install the new kernel to the bootloader, etc.
owl!root:/# /sbin/lilo Added linux * Added linux.old
The default kernel configuration file is actually stored in a file in the the owl-cdrom directory within the sources. You should be extremely careful if you wish to edit this file by hand, it will almost certainly never work. You are far better off generating your own config from the kernel sources using 'make menuconfig', and replacing this file with the one of your choosing.
owl!build:~/native/Owl/packages/owl-cdrom$ ls -l dot-config-* -rw-r--r-- 1 build sources 39020 Nov 22 23:15 dot-config-i386 -rw-r--r-- 1 build sources 35199 Nov 23 03:43 dot-config-x86_64
The buildkernel target was originally meant for use when building Owl ISOs only (which is why the kernel config file is being taken from the owl-cdrom package). We could want to recommend another procedure for custom kernel builds, especially with non-default configs.
owl-users postings to consider when editing/completing this wiki page: 1 2.
Pre- and post-reboot actions/checklist for remote Linux servers