creating a custom Ubuntu LiveCD

About me
Friends' pages:
Email me:
alex AT


I have been struggling the last few days to make a custom LiveCD with emc2 on it. It has been a daunting & frustrating process, but eventually (with lots of googling & especially help from very skilled people (Colin Watson & Ben Collins, to name but a few) I made it happen...

Note: these instructions are as of today outdated. They refer to Ubuntu Breezy Badger, and are not valid starting with Dapper Draker.

NNote: they might just work with Alternate CDs, but I never tried..

To keep others from trying this hard, I documented the process here (note: most this steps usually need a bit of tinkering till they work right, but if you are up for the whole process, then I bet you'll get them right on your machine):

A slightly easier approach (I found this out recently):

1. install & boot the kernel you wish to install on the d-i disk

2. install kernel-wedge (the kernel splitter, this turns your modules into udebs)
	$ apt-get install kernel-wedge

3. install a source for linux-kernel-di-i386-2.6 (this holds the rules to make the udebs)
	$ apt-get source linux-kernel-di-i386-2.6

4. prepare all is needed
	$ apt-get build-dep linux-kernel-di-i386-2.6

5. configure the process
   in linux-kernel-di-i386-2.6/kernel-version change the lines to read your current version:
	(in my case I had to use:
	#arch	version	flavour	installedname	suffix	build-depends
	i386	2.6.12	magma	2.6.12-magma	-	linux-image-2.6.12-magma (>= 2.6.12-magma-cjr12)

   next we generate the debian/control file:
	$ kernel-wedge gen-control > debian/control

6. start the splitting
	$ dpkg-buildpackage

   6.1 this actually caused a bit of problems for me, as some modules were missing 
   (open the modules/foo file which specifies them, and add a ' ?' at the end). 
	modules/i386/acpi-modules (*)
		fan ?
		thermal ?
	(*) this actually includes /usr/share/kernel-wedge/modules/i386/acpi-modules, but you get the idea

   6.2 another problem I had was that some modules weren't specified at all, 
   so they were pulled as dependencies into more than one udeb, causing an error at kernel-wedge check.
   I had to look for the name, for the udebs that ended up having it and at 'package-list',
   then I looked for a common package (in my case firmware-modules) and put the offending module in there
	/usr/share/kernel-wedge/modules/i386/firmware-modules reads 'firmware_class'

The step #6 I had to repeat quite a few times till I got it right, but unlike the hard way, you
don't compile anything so it goes fairly fast. In this process, I eventually downloaded a more recent 
linux-kernel-di-i386-2.6 package from SVN, and a more recent kernel-wedge from the debian repository.

7. build the CD (follow steps 8-12 from the 'Hard way')

The Hard way
1. get a fresh source for building kernels:
	$ apt-get source linux-source-2.6.12
   this will download 3 files 
   the linux-source-2.6.12 sources will be automatically extracted in the following dir:

2. get the adeos patch from, copy to linux-source-2.6.12/debian/patches/ 
   make file.dpatch from the .patch 
	(for that I added:
		#!/bin/sh -e

		. $(dirname $0)/DPATCH

	on top of the file, and renamed to .dpatch)

3. update debian/changelog using:
	$ dch -i

4. put the patch into debian/patches/00list-10.32 (the latest one, 
   if you made a new version with dch above, then copy the last 00list-* under this name, and edit):
	hal-linux-2.6.12-i386-r12.dpatch (I added this line as the last one)

5. disable the builds you don't want (I only wanted to build for i386 here):
	$ cd debian/config/i386
	$ mkdir disabled
	$ mv * disabled
	$ mv disabled/386 .

6. update the kernel configs:
	debian/config/i386/386 (for the 386 kernel)
	debian/config/i386/686-smp (for the 686-SMP kernel)

7. run debuild to build everything (prepare to wait a while..)

8. I got an error by debuild at some point:
	+vmlinux zone_table 0x00000000
	make: *** [build] Error 1
	debuild: fatal error at line 765:
	dpkg-buildpackage failed!

   after asking smarter people (Ben Collins), it seems I have an ABI bump, and I needed to run:
	$ echo "Yes" > debian/abi/i386.ignore

9. after you have the udebs built, you need to rebuild the vmlinuz & initrd image for d-i

   to do that you need to get debian-installer
	$ sudo apt-get build-dep debian-installer
	$ sudo apt-get source debian-installer

   next copy the udebs to debian-installer-version/build/localudebs/
   and configure debian-installer for the new version : 
	build/config/i386.cfg (put the kernel version here)

   build the new d-i images
	either using debuild, or (like me: 
	$ cd build/
	$ make build_cdrom_isolinux

10. get the fresh built files from

11. the next few steps are for an Ubuntu Live CD, so on your own CD they might differ
    copy the initrd, initrd.gz & vmlinuz to

    copy the udebs to the proper place

    rebuild the Packages
	$ apt-ftparchive packages pool/main > dists/breezy/main/debian-installer/binary-i386/Packages
	$ apt-ftparchive packages pool/main | gzip > dists/breezy/main/debian-installer/binary-i386/Packages.gz

    rebuild the Release
	$ rm dists/breezy/Release* (this also takes care of the .gpg)
	$ apt-ftparchive release dists/breezy > dists/breezy/Release

12. make the new iso & burn it