1 minute read

Taken directly from: lists.alioth.debian.org

This is a little HOWTO about compile and use a custom kernel with
live-helper. After some issues, our CDs works so we decides to provides
this help here. Sorry if it's not the better way to do / better place
to purpose.

We are assuming that we use the kernel version 2.6.24. and we have
tested on Lenny with live-helper_1.0~a41.

Required: module-assistant, gcc, libncurses-dev (optionnal)
linux-source-2.6.24



1a) First, we need to fetch the kernel sources.
------------------------------------------------------------------
# aptitude install kernel-source-2.6.24
------------------------------------------------------------------
Sources are fetched in /usr/src/linux-source-2.6.24.tar.bz2

1b) Using vanilla sources should work too
------------------------------------------------------------------
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.tar.bz2
------------------------------------------------------------------


2) Extract sources
------------------------------------------------------------------
# cd /usr/src
# tar -xjf linux-source-2.6.24.tar.bz2
------------------------------------------------------------------


3) Configure the kernel
Switch to the sources directory.
------------------------------------------------------------------
# cd linux-source-2.6.24
------------------------------------------------------------------


3a) with menuconfig (you will need libncurses-dev)
------------------------------------------------------------------
# make menuconfig
------------------------------------------------------------------
Note: don't forget to save configuration

3b) You can also use the debian/ubuntu configuration, and work from it.
Configurations are usually stored in /boot and come with the
linux-image-* packages.
------------------------------------------------------------------
# cp /boot/config-2.6.24 ./.config
# make menuconfig (optionnal)
------------------------------------------------------------------


4) Build the kernel packages
Important: we need to append something something in our kernel version,
it will help avoiding conflits with the debian / ubuntu kernels and
select our kernel in the syslinux menu. It can be everything with
letters and numbers, like -foobar. in this howto, we will use -dlb.
Don't forget to add a revision too, it will be usefull for updates:
------------------------------------------------------------------
# fakeroot make-kpkg --initrd --revision=dlb.1.0 \
--append-to-version=-dlb kernel_image kernel_headers modules
------------------------------------------------------------------


5) Build the modules packages
We need to download some sources in order to get the live cd working.
We need the lzma, squashfs and aufs modules.
------------------------------------------------------------------
# aptitude install lzma-source squashfs-source aufs-source
------------------------------------------------------------------

Prepare work
------------------------------------------------------------------
# cd /usr/src
------------------------------------------------------------------

In most cases, we don't need this link, but It can help with broken
packages.
------------------------------------------------------------------
# rm -rf /usr/src/linux
------------------------------------------------------------------

link your source directory to /usr/src/linux
------------------------------------------------------------------
# ln -s linux-source-2.6.24 linux
------------------------------------------------------------------

build the modules with module-assistant
------------------------------------------------------------------
# m-a update
# m-a build -k /usr/src/linux-source-2.6.24 lzma
# m-a build -k /usr/src/linux-source-2.6.24 squashfs
# m-a build -k /usr/src/linux-source-2.6.24 aufs
------------------------------------------------------------------

6) Install the packages into our lh directory.
At this point, you should have some packages in /usr/src
Here is our /usr/src
------------------------------------------------------------------
debian:~#
ls /usr/src/
aufs-modules-2.6.24-dlb_0+20080129-1+dlb.1.0_i386.deb
aufs.tar.bz2
linux->linux-source-2.6.24
linux-headers-2.6.24-dlb_dlb.1.0_i386.deb
linux-image-2.6.24-dlb_dlb.1.0_i386.deb
linux-source-2.6.24
linux-source-2.6.24.tar.bz2
lzma-modules-2.6.24-dlb_4.43-12+dlb.1.0_i386.deb
lzma.tar.bz2
modules
squashfs-modules-2.6.24-dlb_3.3-3+dlb.1.0_i386.deb
squashfs.tar.bz2
------------------------------------------------------------------

Change to our live-helper directory
------------------------------------------------------------------
cd /home/user/LIVECD/
lh_config --syslinux-menu enabled # Plus eventually options
cp -v /usr/src/*.deb config/chroot_local-packages/
------------------------------------------------------------------

7) Configure live helper
Edit config/root with your favorite text editor. to avoid vi/emacs
trolls, we will use nano. =)
------------------------------------------------------------------
# nano config/chroot
------------------------------------------------------------------

set LH_LINUX_PACKAGES="none"
set LH_LINUX_FLAVOURS="dlb"
where dlb is the "append-to-version" from the step 3 without the first
dash.

Don't forget to add "--syslinux-menu enabled" to lh_config

Now you can lh_build your live CD/USB key and everything should be ok.