2010年12月1日 星期三

customize LiveCD

1. put LiveCD iso to home directory


3. make a temporal directory for mount ISO
# mkdir /tmp/LiveCD/

4. mount LiveCD ISO
# mount -o loop ~/CentOS-5.5-x86_64-LiveCD.iso /tmp/LiveCD/

5. make a tempral directory for custom LiveCD (for pack back into ISO)
# mkdir -p ~/livecd/cd

6. copy all file except squashfs.img
# rsync --exclude=/LiveOS/squashfs.img -a /tmp/LiveCD/ ~/livecd/cd/

7. make a temporal directory for mounting squashfs.img
# mkdir /tmp/squashfs/

8. mount squashfs.img
# mount -t squashfs -o loop /tmp/LiveCD/LiveOS/squashfs.img /tmp/squashfs/

9. make a temporal directory for ext3fs
# mkdir ~/livecd/ext3fs/

10. copy all file of squashfs.img to ext3fs (there is an ext3fs.img)
# rsync -a /tmp/squashfs/ ~/livecd/ext3fs/

11. make a temporal directory for custom LiveCD's /
# mkdir ~/livecd/custom/

12. mount ext3fs.img
# mount -t ext3 -o loop ~/livecd/ext3fs/LiveOS/ext3fs.img ~/livecd/custom/

13. chroot to ~/livecd/custom
# chroot ~/livecd/custom

14. mount /proc and /sys
# mount -t proc none /proc/
# mount -t sysfs none /sys/

15. you can customize your new LiveCD Now!!

16. umount /proc and /sys and exit
# umount /proc/
# umount /sys/
# exit

17. create a new empty ext3fs file and import all files in custom/
# dd if=/dev/zero of=~/livecd/ext3fs.img bs=1M count=4096
# mkfs.ext3 ~/livecd/ext3fs.img
# mkdir ~/livecd/newfs
# mount -o loop ~/livecd/ext3fs.img ~/livecd/newfs
cp -dpR ~/livecd/custom/* ~/livecd/newfs

18. umount ext3fs and newfs
# umount ~/livecd/custom
# umount ~/livecd/newfs

19. replace original ext3fs to new ext3fs file
# cp -f ~/livecd/ext3fs.img ~/livecd/ext3fs/LiveOS/ext3fs.img

20. umount squashfs
# umount /tmp/squashfs

21. umount ISO
# umount /tmp/LiveCD/

22. pack squashfs.img
# mksquashfs ~/livecd/ext3fs ~/livecd/cd/LiveOS/squashfs.img

23. pack iso
# cd ~/livecd/cd
# mkisofs -r -V "CentOS-5.5-x86_64-LiveCD-Custom" -b isolinux/isolinux.bin -c isolinux/boot.cat -cache-inodes -J -l -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/CentOS-5.5-x86_64-LiveCD-Custom.iso .

Congratulation! you did it.

參考資料:
http://osdir.com/ml/linux.redhat.fedora.livecd/2008-07/msg00003.html
http://jeffreywt.com/open-source/linux/modifying-a-livecd-with-squashfs-tools

2 則留言:

  1. 大大 我按照你的做法但是 做好後卡在Boot的畫面無法進入 Orz~

    回覆刪除
  2. 使用virtualbox os cent 5.5 x64

    回覆刪除