Live CD Customization- How ToHow To Customize the New
Ubuntu Live CD
Here we try to explain how to build a customized Ubuntu LiveCD based on the new Live CD infrastructure (first used in the HoaryHedgehog development cycle). The method will be to modify an already existing CD and re-build it. This way is less flexible, but avoids most of the (really unnecessary) complexity of building CDs? from scratch. Why? Well, because some people want to create specialized Live CDs? to show off a particular application or localized to a certain language. If you can think of anything else that can be done, put it on the wiki. System Setup and Requirements ▪
About 3 gigabytes of available disk
space
▪
cloop-utils
- tools to compress and decompress the filesystem image
▪
mkisofs
▪
An Ubuntu kernel, version
2.6.9-7
or later (for the
cloop
module)
Copy and paste: $ sudo apt-get install cloop-utils mkisofs $ echo "Kernel version is" $(dpkg-query -W --showformat '${Version}' linux-image-$(uname -r)) The Process First you will need to extract the loopback compressed file system image - Cloop, so we would be able to customize it as we see fit - this could usually mean setting up packages and software we would like to have available from the LiveCD, presetting some of its configuration and more. After all our good work is done, we would put everything back, and a new LiveCD is born. Simple. The Extraction Process NOTE: Before starting make sure your locale is unset, this just makes life easier. i.e. LANG="" Grab a CD image from from http://cdimage.ubuntu.com/ and put it into an empty directory. Make sure it is a Hoary image (Warty uses a different system). 1.
Mount the image() as a loop
device:
$ mkdir mnt
$ sudo mount hoary-live-i386.iso mnt
-o loop
2.
Extract everything except the
compressed filesystem to a temporary directory:
$ rsync
--exclude=/casper/filesystem.cloop -a mnt/ extracted_cd
3.
Then we uncompress and extract the
compressed filesystem:
$ extract_compressed_fs
mnt/casper/filesystem.cloop > extracted_fs
(Cup of tea time, because this takes a
while)
1.
After all this, we are done with the
original CD and can unmount it (maybe also delete it if you are short of disk
space):
$ sudo umount mnt
Customizations To do the customizations we mount the now uncompressed filesystem image, use chroot to do our modifications and then start putting everything back together again. Preparing the chroot 1.
So, to mount the uncompressed filesystem we
do:
$ sudo mount extracted_fs mnt -o
loop
2.
Mounting proc and sysfs can also be a
good idea:
$ sudo mount -t proc proc
mnt/proc
$ sudo mount -t sysfs sysfs
mnt/sys
3.
If you want to transfer data from your
home directory, the easiest way is a bind mount:
$ sudo mount -o bind /home
mnt/home
NOTE: Obviously saving space on the
compressed filesystem is a a good idea, so during these customizations some
parts of the filesystem can be temporarily mounted with tmpfs and unmounted
later. That way a lot of space can be saved. Some good targets for these mounts
are var/log var/run var/cache/apt var/lib/apt tmp. Just remember to unmount them
all before unmounting
extracted_fs!!!
Language Localizations TODO - ▪
Pre-installing a language pack and
associated locale support
▪
Pre-seeding a default language
▪
Helping to translate with
Rosetta
Updating Specific Packages 1.
If you need to test an additional package on
a live CD, it's this easy:
$ sudo chroot mnt/
/bin/sh
# cd
dir-holding-all-packages/
# dpkg -BOGiE
*.deb
This will only update packages that are already installed on the live CD, but have newer versions available. Installing Additional Packages A common use for a LiveCD is to show off an application, normally not already installed on the CD. NOTE: The default user is created on
startup, so if you want to copy a file to the default users home directory, you
could place the file in
mnt/etc/skel.
1.
Copy in
resolv.conf:
$ sudo cp /etc/resolv.conf
mnt/etc
2.
If the packages you wish to add are
not available with the default
sources.list,
you may modify it, or copy in your own:
$ sudo vi
mnt/etc/apt/sources.list
3.
Finally, we chroot into the chroot and
install some packages, updating the apt cache along the way, and making sure to
purge instead of just remove anything we want to get rid of:
$ sudo chroot mnt
/bin/bash
# apt-get update
# apt-get install banana
deadly-weapon
# apt-get clean
# dpkg --purge
foobaz
# exit
4.
Re-generate the manifest to reflect
any changes you have made:
$ sudo chroot mnt dpkg-query -W
--showformat='${Package} ${Version}\n' >
extracted_cd/casper/filesystem.manifest
GNOME Customizations A list of GNOME-specific customizations (changing gconf keys, making GDM colors match, etc.) is at the GNOME Wiki. Closing up the chroot 1.
Make sure to unmount everything mounted when
setting up the chroot (tmp?? var/log??):
$ sudo umount
mnt/proc
$ sudo umount mnt
Putting the CD back together OK, almost done. We only have to pack up the CD. 1.
First compress the compressed filesystem and
put it back on the CD (Another cup of tea required here):
$ create_compressed_fs extracted_fs
65536 | sudo dd of=extracted_cd/casper/filesystem.cloop
2.
Then generate md5sum.txt
file:
$ cd extracted_cd && find .
-type f -print0 | xargs -0 md5sum > md5sum.txt
3.
Then we re-build the cd.
NOTE:
This procedure is specific to the
Intel x86 (i386) and x86_64 (amd64) live CDs?.
Other architectures, such as PowerPC and IA64,
will require different command line options.
$ sudo mkisofs -r -V "Custom Ubuntu
Live CD" \
-cache-inodes
\
-J -l -b
isolinux/isolinux.bin \
-c isolinux/boot.cat
-no-emul-boot \
-boot-load-size 4
-boot-info-table \
-o
custom-hoary-live-i386.iso extracted_cd
And we are done! More information The LiveCD is based on the Ubuntu installer and uses its infrastructure to bootstrap the system. An additional installer component (casper) is used to load the live environment after bootstrap is complete. Perhaps you can find more information here: LiveCDDesign, LiveCD. Or look at the code by downloading casper and the debian installer (apt-get source casper debian-installer). NOTE: no source code modifications of any kind are necessary in order to customize live environment (for example, installing additional packages). This is purely informational. Posted: Tue - April 12, 2005 at 10:27 PM |
Quick Links
Calendar
Categories
Archives
Statistics
Total entries in this blog:
Total entries in this category: Published On: Apr 12, 2005 10:29 PM |
||||||||||||||