
The ROCK Read-Only Linux                                        Clifford Wolf
========================                                           2000-10-05


0. Introduction
---------------

The ROCK Read-Only Linux is a "patch" to ROCK Linux which allows the system
to run on a read-only device (like a CD-ROM). All variable data is stored on
a ram-disk which is created on system startup.

Creating the read-only image is done in four steps:

  1.)   Installing a ROCK Linux System in a directory
  2.)   Apply the ROCK Read-Only Linux Patch
  3.)   Configure the system
  4.)   Create a bootable CD-ROM image


1. Installing a ROCK Linux System in a directory
------------------------------------------------

That's easy. First, create the target directory (e.g. /rock-ro-linux). Next
change to the directory which contains the ROCK Linux binaries (e.g.
/rock-linux/rock-<architecture>-<version>) and type:

  ./Install.bin . /rock-ro-linux

Now select all packages you want and install them. Don't run the setup scripts
except you know exactly what you are doing.


2. Apply the ROCK Read-Only Linux Patch
---------------------------------------

First extract the tar.bz2 file containing the ROCK Read-Only Linux somwhere
and change into the resulting rock-read-only directory. In that directory
simply type

  ./Install /rock-ro-linux

to make the needed changes to the system.


3. Configure the System
-----------------------

Make ant changes you like to do, but keep in might that almost everything
will be read-only when the system is running. Only /ram will contain a
read-write filesystem. A 'template' for /ram can be found in /ram-tpl, which
will be copied to /ram at the system boot.

I suggest to make at least the following changes:

  -  Set a root password in /etc/shadow
  -  Configure the network (/etc/conf/network)
  -  Enable/Disable system services (/etc/init.d/*)
  -  Link everything which might be changed when the system is running
     to /ram/<something> and create templates in /ram-tpl.
  -  Tune the /proc/sys/vm settings for a machine without swap and a
     possibly big ramfs (/etc/conf/kernel)
  -  Turn off unneccasarry logging (/etc/syslog.conf)

Document your changes in /etc/conf/NOTE - you _will_ need it some time
later and you won't remember if you don't write documentation!


4. Create a bootable CD-ROM image
---------------------------------

You can use any filesystem type for the ROCK Read-Only Linux. But in the most
cases you would like to create a bootable CD-ROM. First you need to create a
boot disk. I'm using the loopback device /dev/loop/4 and the mount point /mnt
here. I also simply take the kernel from /boot/vmlinuz and the resulting boot
image will have the filename boot-disk.img in your home directory:

 kickme:~# dd if=/dev/zero of=boot-disk.img bs=1k count=1440
 kickme:~# losetup /dev/loop/4 boot-disk.img
 kickme:~# mke2fs -qm0 /dev/loop/4
 kickme:~# mount /dev/loop/4 /mnt
 kickme:~# cp /boot/boot.b /boot/vmlinuz /mnt/
 kickme:~# vi /mnt/lilo.conf

    +>  disk=/dev/loop/4
    +>      bios=0x00
    +>      sectors=18
    +>      heads=2
    +>      cylinders=80
    +>
    +>  boot=/dev/loop/4
    +>  map=/mnt/map
    +>  install=/mnt/boot.b
    +>  compact
    +>
    +>  image=/mnt/vmlinuz
    +>          label=rock-read-only
    +>          append="root=/dev/cdroms/cdrom0"
    +>          read-only

 kickme:~# lilo -C /mnt/lilo.conf
 kickme:~# umount /mnt
 kickme:~# losetup -d /dev/loop/4

Now we need to copy the disk image to the ROCK Read-Only root, create the
CD-ROM Image and burn it on a CD (I'm using /dec/cdwriter here):

 kickme:~# cp boot-disk.img /rock-ro-linux/boot-disk.img

 kickme:~# mkisofs -b boot-disk.img -l -R -V 'ROCK Read-Only Linux' \
 > -v -o /rock-ro-linux.iso /rock-ro-linux/

 kickme:~# cdrecord dev=/dev/cdwriter speed=4 -v /rock-ro-linux.iso

That's it. Enjoy.


A. Hint's about the Kernel
--------------------------

The kernel you are going to use needs support for the 'ramfs' filesystem (in
addition the 'devfs', which is allways needed in ROCK Linux, and other drivers
you might need for your hardware).
