I recently decided to create a LiveCD to simplify downloading and flashing Raspberry Pi images.
I started off with the GParted ISO as that is already a small distribution, plus it has everything I needed for the PiParted distribution.
GParted comes in ISO form, so the first thing we need to do is mount the ISO file to get all the files that out of it. You’ll need to be root to mount the ISO file, or use sudo.
# mkdir -p ~/isodistro/iso
# mount -o loop gparted-live-0.16.1-1-i486.iso /mnt/iso
# cp -r /mnt/iso/* ~/isodistro/iso
You should see the following files inside
EFI EFI-imgs GParted-Live-Version GPL isolinux live syslinux utils
Inside the live
directory, you will see these files
filesystem.packages filesystem.squashfs initrd.img memtest vmlinuz
The one we want is filesystem.squashfs
, this file is what contains the main filesystem of the distribution.
As you can probably deduce from the file extension, this file is a squash fs file system. Which means that we can easily unsquash it.
# mkdir ~/isodistro/fs
# cp ~/isodistro/iso/live/filesystem.squashfs ~/isodistro/fs/
# cd ~/isodistro/fs
# unsquashfs filesystem.squashfs
This will create the squashfs-root
directory within the fs directory, and if we have a look in there…
# ls squashfs-root/
bin dev etc home initrd.img lib media mnt opt proc root run sbin selinux srv sys tmp usr var vmlinuz
Tada ! We have the root filesystem of GParted.
The startup scripts are located within etc/gparted-live/gparted-live.d
if you want to modify those.
Once the modifications have been made, you will need to pack it all back up, and repack the files into the ISO file.
mksquashfs ~/isodistro/fs/squashfs-root/* ~/isodistro/fs/filesystem.squashfs -comp xz
mv ~/isodistro/fs/filesystem.squashfs ~/isodistro/iso/live/
mkisofs -o youriso.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V youriso-live ~/isodistro/iso
That will create the ISO file for you, and hopefully you should be able to boot your newly customised GParted distribution !