LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-09-2008, 11:57 AM   #1
angotia
LQ Newbie
 
Registered: Jul 2008
Posts: 1

Rep: Reputation: 0
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 ;-)

---------------------------------------------------------------

#!/bin/bash

# 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
clear
mkdir /image
mount -t auto /dev/cdrom /image
clear

# 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!"
exit
----------------------

END OF POST
 
Old 07-10-2008, 03:44 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Did you check SystemRescueCD?
It has a good documentation on how to create a custom CD from itself.
 
Old 07-10-2008, 03:59 AM   #3
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Here it is BTW:
http://www.sysresccd.org/Howto-advanced-customization
 
  


Reply

Tags
boot, iso, isolinux, kernel, minimal, ntfsclone, rootfs, shell script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a shell script to run Java program paultaylor Programming 7 11-12-2004 03:11 PM
How can I get the computer to boot up and run a program/game w/ bash script or C++? DaMan101 Programming 5 04-11-2004 03:22 PM
How can I get the computer to boot up and run a program/game w/ bash script or C++? DaMan101 Linux From Scratch 1 04-10-2004 12:23 AM
i want to run a script or program at boot time!! FreakboY Linux - Newbie 9 10-12-2003 08:03 AM
How do I automatically run at boot an X program or script cmisip Linux - General 4 01-05-2003 06:30 PM


All times are GMT -5. The time now is 09:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration