Bootable CD - Hello World! ========================== Public domain ******************************************************************************** ### livecd-maker-0.1 #!/bin/bash # Bootable CD - Hello World! ########### # cleanup # ########### mkdir -p livecd cd livecd rm -rf * ############# # initrd.gz # ############# dd if=/dev/zero of=initrd bs=1024k count=1 mke2fs -F -m0 -b 1024 initrd mkdir initrdDIR mount -t ext2 -o loop initrd initrdDIR rm -rf initrdDIR/lost+found/ ######## # /dev # ######## mkdir initrdDIR/dev mknod initrdDIR/dev/console c 5 1 ########### # linuxrc # ########### cat << EOF > linuxrc.c #include void main() { printf("\n\nHello World! \n"); for(;;); } EOF cc -static linuxrc.c -o initrdDIR/linuxrc rm -rf linuxrc.c umount initrdDIR rm -rf initrdDIR gzip -9 initrd ############ # isolinux # ############ mkdir isolinux mv initrd.gz isolinux cp /usr/src/syslinux-3.36/isolinux.bin isolinux/ cp /boot/vmlinuz isolinux/vmlinuz # isolinux.cfg cat << EOF > isolinux/isolinux.cfg default hw label hw kernel vmlinuz append initrd=initrd.gz EOF # boot.cat find . -type f -exec md5sum {} \; > isolinux/boot.cat ################ # make ISO9660 # ################ mkisofs -pad -l -r -J -v -V "IRanuX" -b isolinux/isolinux.bin \ -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \ -hide-rr-moved -o cdimage.iso . cd .. mv ./livecd/cdimage.iso . rm -rf livecd ******************************************************************************** ### Write ISO image to CDRW #!/bin/bash echo "Insert an empty CD and press any key . . ." read cdrecord -v speed=4 -dev ATAPI:/dev/hdd blank=all cdrecord -v -eject speed=4 -dev ATAPI:/dev/hdd -data cdimage.iso ******************************************************************************** ### ISOLINUX # cd /usr/src/ # wget -q http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.36.tar.bz2 # tar -jxf syslinux-3.36.tar.bz2 # ls -lh syslinux-3.36/isolinux.bin -rw-rw-r-- 1 1026 1026 11K 2007-02-11 00:17 syslinux-3.36/isolinux.bin ******************************************************************************** ### Road Map Stage 1 - Building a livecd that contain complete linux distribution Stage 2 - Building a script for Installing linux from livecd to hard disk Stage 3 - Building a configuration script ******************************************************************************** ### Documentation From Power Up To Bash Prompt : http://tldp.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html The Linux Bootdisk HOWTO : http://tldp.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html How To Build a Minimal Linux System from Source Code : http://axiom.anu.edu.au/~okeefe/p2b/buildMin/buildMin.html ******************************************************************************** _BY: Pejman Moghadam_ _TAG: iranux_ _DATE: 2008-04-11 16:38:36_