Much of the above also goes for booting from cdrom. Since I wanted to document
howto boot from cdrom anyway, I document it in here to avoid typing a lott
of the same twice.
Why would one want to boot a machine from cd-rom? Booting from cdrom is
interesting everywhere where one wants to run a very specific application,
like a kiosk, a library database program or an intenet cafe, and one doesn't
have a network or a server to use a root over nfs setup.
The basic principle is wants again simple, boot with a cdrom as root. To
make this possible we'll use the rockridge extension to put a unix like filesystem
on a cd and the Eltorito extension to make cd's bootable.
Things can't be that simple
Ofcourse this setup also has a few problems. most are the same as above:
We'll need write access to: /dev, /var & /tmp.
We'll just use the same solutions as with root over nfs (see above):
For /dev we'll use Devfs
For /var and /tmp we'll use a shared ramdisk of 1mb. It's shared to use
the space as effeciently as possible. /tmp is replaced by a symlink to /var/tmp
to make the sharing possible.
Populating the ramdisk with tarballs or template dirs, works equally well.
But with template dirs it's much easier to make changes, thus we'll use template
dirs.
Some apps need write access to /home.
Put the homedir of the user's who will be running the application in /var,
and populate it wiht the rest of /var every boot.
/etc/mtab needs to be writable:
Create a link to /proc/mounts and create an empty file mounts in /proc,
see above.
Now that we know what we want todo and how, it's time to create a test
setup:
For starters just take one of the machines which you want to use and put
in a big disk and a cd-burner.
Install your linux of choice on this machine, and leave a 650mb partition
free for the test setup. This install will be used to make the iso-image and
to burn the cd's from, so install the nescesarry tools. It will also be used
to restore any booboo's which leave the test setup unbootable.
On the 650 mb partition install your linux of choice with the setup you
want to have on the cd, this will be the test setup
Boot the test setup.
Compile a kernel as described in Section 3.1, follow all the steps, the
changes need for devfs are still needed! At step 3 of Section 3.1 put in the
following:
isofs compiled in
devfs compiled in
cdrom support compiled in
everything else you need either compiled in or as module.
Configure the test setup:
Create the user which we'll be running the application.
Put it's homedir in /var.
Install the application if needed.
Configure the application if needed.
Configure the user so that the application is automagicly run after login.
Configure linux so that it automaigcly logs in the user.
Configure anything else which needs configuring.
Test that the test setup automagicly boots into the apllication and everything
works.
Boot the main install and mount the 650 mb partition on /test of the main
install.
Put the following in a file called /test/etc/rc.d/rc.iso, this file we'll
be sourced at the begining of rc.sysinit to create /var
Remove the creation of /etc/issue* from /test/etc/rc.local it will only
fail.
Now boot the test partition again, it will be read only just like a cdrom.
If something doesn't work reboot to the working partition fix it, try again
etc. Or you could remount / rw ,fix it then reboot straight into to test partition
again. To remount / rw type:
First of all boot into the workign partition. To create a bootable cd we'll
need an image of a bootable floppy. Just dd-ing a zimage doesn't work since
the loader at the beginning of the zimage doesn't seem to like the fake floppydrive
a bootable cd creates. So we'll use syslinux instead.
Get boot.img from a redhat cd
Mount boot.img somewhere through loopback by typing:
mount boot.img somewhere -o loop -t vfat
Remove everything from boot.img except for:
ldlinux.sys
syslinux.cfg
Cp the kernel-image from the test partition to boot.img.
Edit syslinux.cfg so that it contains the following, ofcourse replace zImage
by the appropiote image name:
default linux
label linux
kernel zImage
append root=/dev/<insert your cdrom device here>
Umount boot.img:
umount somewhere
If your /etc/mtab is a link to /proc/mounts umount won't automagicly free
/dev/loop0 so free it by typing:
losetup -d /dev/loop0
Creating the iso image
Now that we have the boot image and an install that can boot from a readonly
mount it's time to create an iso image of the cd:
Copy boot.img to /test
Cd to the directory where you want to store the image make sure it's on
a partition with enough free space.