-   Linux - General (
-   -   Need guidance on creating minimal boot CD to load a few program and run a script (

angotia 07-09-2008 12:57 PM

Need guidance on creating minimal boot CD to load a few program and run a script
I am in a situation where I want to create a minimal boot CD to load a few program and run a shell script. I need someone to point me in the right direction, to get me kicked off. I have attempted to research this myself, but just can't seem to hone in on it..

Here is some background on what I have done. I have created a custom NTFS image for a business using the ntfsprogs (ntfsclone) software package. The way it is implemented now is, I use a clonezilla boot CD which I have customized (changed things like, the squashfs, startup services and custom install scripts) that will boot up and run my script and reboot the computer fully unattended. At that point it runs a few windows scripts and process is completed.

The thing I don't like about it for one is I didn't create the boot CD ;-)
Second thing is it loads way too much stuff for what I need it for. I want to load only enough stuff to get the system up with the ntfsprogs package loaded and be able to unlzma it, I don't need network, usb support, ect...

I have dissected and few boot CD's to see how they are built and have seen things like a one single embedded netbsd file that loads everything and is very small (I like that idea, because I am trying to make this as small and fast as possible so I can fit my 650 MB image on the CD also). I was unable to locate any info on creating one, that would pertain to my application. I have also seen something I am a bit more familiar with which is a few files like isolinux, initrd and a kernel, which I don't know enough about to create from the ground up.

What I need is some guidance on what road I need to go down. The CD is going to be used on mostly Dell computers made within the past few years, with IDE and SATA HD's. I have been running linux for somewhere around 4 years now and as long as I have a direction and can get this done. The only thing the CD needs to boot into is this very simple script (see below). I just want to say THANK YOU for anyone who is attempting to help out or has read this entire post ;-)



# Automaticly detect hda or sda
xda="`file "$arg"|fdisk -l|awk '{print $1}'|grep \/dev\/|sed 's/[1234567890]//'|sed 's/\/dev\///'|sort -u`"

# mount 2K-FINAL on CD root to /image
mkdir /image
mount -t auto /dev/cdrom /image

# Apply new MBR
echo "Creating MBR"
dd if=/image/2K-FINAL/mbr.img bs=446 count=1 of=/dev/$xda

# Partition drive to 1 entire NTFS partition
echo "Creating NTFS Partition"
echo ,,7,* | sfdisk -D /dev/$xda

# Create NTFS File System
echo "Creating NTFS File System"
mkntfs -Q -q /dev/$xda1

# Start image of Windows 2K
echo "Applying Windows 2K Image"
unlzma -c /image/2K-FINAL/2K-SMALL-LZMA.img.lzma | ntfsclone --restore-image --overwrite /dev/$xda1 -

# Resize Partition to fill disk
echo "Resizing NTFS Partition"
echo y | ntfsresize /dev/$xda1

# Resting NTFS Journal File & Scheduling An NTFS Consistency Check
echo "Resting NTFS Journal File & Scheduling An NTFS Consistency Check"
ntfsfix /dev/$xda1

# Unmount CD and Reboot
echo "All Done! Shutting Down & Rebooting"
echo "If Your Quick Enough, Remove the CD!"
cd /
fuser -km /dev/cdrom
eject /dev/cdrom
reboot -f -i
echo "See ya!"


Agrouf 07-10-2008 04:44 AM

Did you check SystemRescueCD?
It has a good documentation on how to create a custom CD from itself.

Agrouf 07-10-2008 04:59 AM

Here it is BTW:

All times are GMT -5. The time now is 10:25 AM.