Creating a Bootable CD Using a LinuxLink classic RFS

Perform the following steps to boot directly from a CD-ROM device and then re-map the directories that are writable by the user into RAM disk.

  1. Download and install a full x86 Intel Pentium distribution from TimeSys. This involves the following tasks:
    1. Log in to LinuxLink and select the Repository button.
    2. On the Repository page, select INTEL-Pentium from the drop-down menu at the top of the page.
    3. Click Reference Distribution for IA-32 PC Compatible Systems.
    4. Save the latest version of the timesys-i686-x86p3-basic--std-<version>-install.tgz installation archive file.
    5. Unpack the file:
      tar zvxf timesys-i686-x86p3-basic\
         --std-<version>-install.tgz
    6. Follow the installation instructions found in Getting Started with Linux on an x86-Compatible System, which is included in the distribution.
  2. Download and unpack the latest version of the syslinux utility. This involves the following tasks:
    1. From the http://www.kernel.org/pub/linux/utils/boot/syslinux/ web site, save the latest version of the following file:
      syslinux-<version>.tar.bz2
    2. Unpack the file:
      tar xjf syslinux-<version>.tar.bz2
  3. Compile your kernel with the correct options for your target board (for example, the correct network driver, video driver, and so on). The kernel must contain all of the drivers that the board needs, because this set of instructions does not include steps which allow the kernel to load modules via the depmod command.
  4. Make a copy of the root filesystem (RFS) that is included in the Intel Pentium TimeSys distribution:
    mkdir ~/iso
    cp -a /opt/timesys/linux/6.1/i686-std/rfs/* ~/iso
  5. Copy syslinux into the RFS directory:
    mkdir ~/iso/isolinux
    cp -a ~/syslinux-<version>/isolinux.bin ~/iso/isolinux
  6. Copy the kernel into the syslinux boot directory:
    cp <location of kernel> ~/iso/isolinux/bzImage
  7. Create a very basic syslinux configuration file:
    echo “default bzImage root=/dev/hdc” > ~/iso/isolinux.cfg

    On most systems, /dev/hdc is the CD-ROM drive. If it is different, change the value now. If necessary, consult the syslinux documentation to determine how to have multiple boot parameters. For a generalized solution, you need to create an initial RAM disk that discovers the CD-ROM device.

  8. Change to the following directory:
    cd ~/iso/etc/
  9. In the inittab file, update the system initialization process to run the CD staging script at startup by modifying the line starting with si::sysinit to match the following:
    si::sysinit:/staging/cd-startup
  10. Update the following file:
    cd ~/iso/etc/init.d/rcS

    At the end of this file, the setup.sh script is called. Change the following lines from:

    if [ -x /sbin/setup.sh ]
      then
      /sbin/setup.sh
    fi

    to become:

    echo -n "Running 'ldconfig' : "
    /sbin/ldconfig
    echo "Done"
  11. Create a staging directory and populate it with files:
    mkdir ~/iso/staging
    cd ~/iso/etc
    tar cf ../staging/etc.tar *
    cd ~/iso/var
    tar cf ../staging/var.tar *
    cd ~/iso/home
    tar cf ../staging/home.tar *  
  12. Create device nodes typically used in desktop systems. You will need to create /dev/null and device nodes for any other devices on your board:
    mknod ~/iso/dev/null c 1 3
    mknod ~/iso/dev/console c 5 1
    
    mknod ~/iso/dev/hdc b 22 0

    At a minimum, you’ll need to create the device node used to mount the root filesystem in step 7. If you need to create a device, but don’t know the device number, examine the /dev directory on a running system.

  13. Create a file named cd-startup in the staging directory, which contains the following information:
    #! /bin/sh
    
    # create file systems on the ramdisks
    /sbin/mke2fs -q -m 0 /dev/rd/1
    /sbin/mke2fs -q -m 0 /dev/rd/2
    /sbin/mke2fs -q -m 0 /dev/rd/3
    /sbin/mke2fs -q -m 0 /dev/rd/4
    
    # mount over read-only area with ram disks
    # do etc first, as sometimes mount wants to write to /etc/mtab
    mount -n /dev/rd/4 /etc
    cd /etc
    tar xf /staging/etc.tar
    
    mount -n /dev/rd/1 /home
    mount -n /dev/rd/2 /var
    mount -n /dev/rd/3 /tmp
    
    # from the staging area, restore cached copies of the dirs
    cd /var
    tar xf /staging/var.tar
    cd /home
    tar xf /staging/home.tar
    
    # transfer control to the rest of the init
    /etc/init.d/rcS
  14. Update the mode of the cd-startup file so that it can be run:
    chmod +x ~/iso/staging/cd-startup
  15. Create the ISO filesystem image:
    mkisofs -joliet-long -r -R -o ~/image.iso \
    -b isolinux/isolinux.bin \
    -c isolinux/boot.cat \
    -no-emul-boot -boot-load-size 4 -boot-info-table \
    ~/iso
  16. Burn the ISO image onto the CD:

    Note

    You will probably need to update the device (-dev=0,0,0) so that it points to the CD device on your system.

    sudo cdrecord -v -eject -dev=0,0,0 ~/image.iso