Ubuntu Live CD Customization

Not sure what part of this failed, but my customized ISO file would not boot from USB flash.  No time now but I will try again and correct someday.

This was tested using Ubuntu 11.10 (Oneiric Ocelot)


sudo bash
cd
apt-get install squashfs-tools genisoimage
mkdir ~/livecdtmp
cp -a /ubuntu-11.10-desktop-amd64.iso ./livecdtmp/
cd livecdtmp/
mkdir mnt
mount -o loop ubuntu-11.10-desktop-amd64.iso mnt
rsync --exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
unsquashfs mnt/casper/filesystem.squashfs
mv squashfs-root edit
cp /etc/resolv.conf edit/etc/
cp /etc/hosts edit/etc/
mount --bind /dev/ edit/dev
chroot edit

mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts
export HOME=/root
export LC_ALL=C
dpkg-reconfigure tzdata

vi /etc/apt/sources.list

# /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ oneiric main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ oneiric main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ oneiric-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu/ oneiric-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ oneiric-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ oneiric-updates main restricted universe multiverse
# Google testing repository
deb http://dl.google.com/linux/deb/ testing non-free



wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
apt-get update
apt-get upgrade
apt-get install mc aptitude sipcalc vim ssh moc chromium-browser wine flashplugin-installer picasa vlc mozilla-plugin-vlc
apt-get -y install gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly
apt-get install ubuntu-restricted-extras
vi /etc/default/rcS

If you run Windows and do not like the clock wrong later:
vi /etc/default/rcS
Change UTC=yes to UTC=no
ntpdate us.pool.ntp.org

aptitude clean
rm -rf /tmp/* ~/.bash_history

rm -rf /tmp/* ~/.bash_history
rm /etc/hosts
rm /etc/resolv.conf
rm /var/lib/dbus/machine-id
dpkg-divert --rename --remove /sbin/initctl



umount /proc || umount -lf /proc
umount /sys
umount /dev/pts
exit
umount edit/dev



chmod +w extract-cd/casper/filesystem.manifest
chroot edit dpkg-query -W --showformat='${Package} ${Version}\n' > extract-cd/casper/filesystem.manifest
cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop
sed -i '/ubiquity/d' extract-cd/casper/filesystem.manifest-desktop
sed -i '/casper/d' extract-cd/casper/filesystem.manifest-desktop

rm extract-cd/casper/filesystem.squashfs
mksquashfs edit extract-cd/casper/filesystem.squashfs -b 1048576



printf $(sudo du -sx --block-size=1 edit | cut -f1) > extract-cd/casper/filesystem.size
#vim extract-cd/README.diskdefines
cd extract-cd
rm md5sum.txt
find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt
IMAGE_NAME="UBUNTU64"
mkisofs -D -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-11.10-desktop-amd64-custom.iso .


cp ../ubuntu-11.10-desktop-amd64-custom.iso /media/934B-8A3B/boot/iso/
vi /media/934B-8A3B/boot/grub/grub.cfg


menuentry "ubuntu-11.10-desktop-amd64-custom.iso" {
 loopback loop /boot/iso/ubuntu-11.10-desktop-amd64-custom.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-11.10-desktop-amd64-custom.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

df -kh
eject /media/934B-8A3B










menuentry "persistent rw ubuntu-11.10-desktop-amd64.iso" {
 loopback loop /boot/iso/ubuntu-11.10-desktop-amd64.iso
 linux (loop)/casper/vmlinuz boot=casper persistent rw iso-scan/filename=/boot/iso/ubuntu-11.10-desktop-amd64.iso noeject noprompt splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso" {
 loopback loop /boot/iso/KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso
 linux (loop)/boot/isolinux/linux boot=knoppix iso-scan/filename=/boot/iso/KNOPPIX_V6.7.1DVD-2011-09-14-EN.iso ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime
 initrd (loop)/boot/isolinux/minirt.gz
}





References:
https://help.ubuntu.com/community/LiveCDCustomization
http://www.gavinhollinger.com/2011/04/boot-multiple-iso-files-on-single-usb.html
https://help.ubuntu.com/community/RestrictedFormats


No comments: