wiki:HackISO

Version 1 (modified by cedric_neal, 5 years ago) (diff)

--

This tutorial is picked from http://blog.nicolargo.com/2008/02/creer-un-os-live-sur-cd-et-cle-usb.html

In my case, I use Ubuntu to perform it !

First we need a Xubuntu ISO and +2 GB in your partition !

Please use 'sudo' or root account to execute these commands.

Some packages :

# apt-get install mkisofs squashfs-tools fakeroot gfxboot syslinux

We mount the ISO into a directory :

 # mount -o loop Xubuntu.iso /DIR_CD

We mount the root FS into a directory :

 # mount -t squashfs -o loop,ro /DIR_CD/casper/filesystem.squashfs /DIR_ROOT_ORIG

Now, /DIR_ROOT_ORIG is the / from Live CD.

We create a new filesystem (2 GB) :

# dd if=/dev/zero of=Hikarunix_root.ext2 bs=1M count=2147
# mke2fs Hikarunix_root.ext2

We mount it !

# mkdir /DIR_ROOT_NEW
# mount -o loop Hikarunix.ext2 /DIR_ROOT_NEW

We move all /DIR_ROOT_ORIG to /DIR_ROOT_NEW

# mv /DIR_ROOT_ORIG/* /DIR_ROOT_NEW/

Preparation for chroot stuff :

# cp /etc/resolv.conf /DIR_ROOT_NEW/etc
# mount -t proc -o bind /proc /DIR_ROOT_NEW/proc
# mount -t sys -o bind /proc /DIR_ROOT_NEW/sys
# mount -t devpts -o bind /proc /DIR_ROOT_NEW/dev/pts

Now, chroot provide a shell in the Live CD :

# chroot /DIR_ROOT_NEW /bin/bash

We can make what we want... X software can be execute with DISPLAY modification TODO : Modify the /etc/apt/source.list

# aptitude update
# aptitude upgrade
# aptitude install XXX

Then,

# exit

# umount /DIR_ROOT_NEW/proc
# umount /DIR_ROOT_NEW/sys
# umount /DIR_ROOT_NEW/dev/pts
# rm /DIR_ROOT_NEW/etc/resolv.conf

Update MANIFEST file from Live CD :

# chroot /DIR_ROOT_NEW dpkg-query -W –showformat=’${Package} ${Version}\n’ > /DIR_CD/casper/filesystem.manifest

Fill with empty character :

# dd if=/dev/zero of=/DIR_ROOT_NEW/dummy
# rm /DIR_ROOT_NEW/dummy

Create a new filesystem.squashfs

# rm livecd/casper/filesystem.squashfs
# cd /DIR_ROOT_NEW
# mksquashfs . /DIR_CD/casper/filesystem.squashfs

Finally, the ISO :

# mkisofs -o Hikarunix.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -r -V “Hikarunix Live CD” -cache-inodes -J -l livecd