creating a custom Ubuntu LiveCD

Home
Photography
Projects
About me
Robots
Publications
Friends' pages:
Chris
Jeff
John
Minu
Raeed
Email me:
alex AT joni.ro


Share

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). 
   example:
	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 
	(linux-source-2.6.12_2.6.12-10.32.dsc, 
	linux-source-2.6.12_2.6.12-10.32.tar.gz, 
	linux-source-2.6.12_2.6.12-10.32.diff.gz)
   the linux-source-2.6.12 sources will be automatically extracted in the following dir:
	`pwd`/linux-source-2.6.12-2.6.12/

2. get the adeos patch from gna.org, 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

		@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)
	etc.

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

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
	build/dest/cdrom:
	initrd.gz
	initrd.list
	vmlinuz

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
	install/

    copy the udebs to the proper place
	pool/main/l/linux-source-2.6.12

    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
	(follow https://wiki.ubuntu.com/LiveCDCustomizationHowTo) 



[æ]