Monday, December 6, 2010

How to work with Squashfs filesystem

### Remaster the Squashfs-filesytems ###
Prepare the host
apt-get install squashfs-tools chroot
step1: mkdir /tmp/livecd
step2: mount -o loop *.iso /tmp/livecd & cp -r /tmp/livecd /tmp/live-cd
step3: mkdir squashfs
step4: mount -t squashfs -o loop filesystem.squashfs squashfs
step5: To Access the internet
step6: cp /etc/resolv.conf /etc/hosts ./squashfs/etc
step7: chroot ./squashfs & mount -t proc none /proc & mount -t sysfs none /sys & export HOME=/root
step8: apt-get install * & update sources.list
step9: apt-get clean & rm -rf /tmp & rm -f /etc/resolv.conf & rm -f /etc/hosts
step10: umount /proc/ & umount /sys/ & exit
step11: mksquashfs ./squashfs filesystem.squashfs
step12: update the md5sum & rebuild the Cd by mkisofs
step13:
IMAGE=/opt/Gyani/router_custom_i386.iso
BUILD=/opt/Gyani/router
mkisofs -r -V "VxGrid Enterprise Cloud" \
            -cache-inodes \
            -J -l -b isolinux/isolinux.bin \
            -c isolinux/boot.cat -no-emul-boot \
            -boot-load-size 4 -boot-info-table \
            -o $IMAGE $BUILD
step14: Done
Note: Make sure When we unpack and pack with Squashfs tools, If the live Cd is little old then it leads to some problem like the CD won't boot.
Reason: If the Squashfs tools version-4 and the kernel & initrd module version it support version 3 it leads to problem
Overcome: Either the squashfs tools can be installed downgradded one (3.*) or insert a module in initrd with new version of Squashfs tools

Note: Once you get the Chroot prompt, its nothing but another linux operating system.

No comments: