6. Several ways of obtaining the bootloader's code

We have spoken so far about the client and server's configuration for operation after the BOOTP request has been issued by the client, but the first problem is that most computers are not able to behave as BOOTP clients by default. We will see in this section how to fix this.

6.1. BOOTP or DHCP capable NICs

This is the most simple case: some network cards provide a supplement to the BIOS, containing a BOOTP or DHCP client, so just setup them for BOOTP or DHCP operation in the BIOS, and you're done.

6.2. Local floppy or hard drive

These cases are also quite simple: the kernel is loaded from a local drive, and all the kernel has to do is to obtain its network parameters from BOOTP, and mount its root filesystem over NFS; this should not cause any problem. By the way, a local hard drive is a good place to leave a /var, /tmp, and a /dev...

If you have a local hard drive, all you have to do is to use lilo or your favourite boot loader as usual. If you use a floppy, you can use a bootloader or simply write the kernel on the floppy: a kernel is directly bootable.This enables you to use a command like the following:
      # dd if=zImage of=/dev/fd0 bs=8192
    

6.3. Creating ROMs for the clients

Many network cards include a slot in which one can insert an EPROM with additional BIOS code. This enables one to add, for instance, BOOTP capabilities to the BI0S. To do so, you will first have to find how to enable the EPROM socket. You may need a jumper or a special software to do so. Some cards like the 3Com 905B have slots for EEPROMs which enable one to change the software in the EEPROM in place. In appendix, you'll find the information about EPROM and various types of memory chips.

For a list of EPROM burner manufacturers visit the Yahoo site and go to economy->company->Hardware->Peripherals->Device programmers or check out the old Diskless-HOWTO List of EPROM burner manufacturers section.

If you choose to create your own ROMS, you will have to load a BOOTP or DHCP capable software in the ROM, and then, you will be in the case of BOOTP or DHCP capable NICs described above.

You will also need to find the proper EPROM size and speed for your NIC. Some methods to do so are provided in appendix, because the NICs manufacturers often do not provide this information.

6.3.1. LanWorks BootWare PROMs

This information may save you time. In order to make LanWorks BootWare(tm) PROMs to correctly start up a linux kernel image, the "bootsector" part of the image must be modified so as to enable the boot prom to jump right into the image start address. The net-bootable image format created by netboot/etherboot's `mknbi-linux' tool differs and will not run if used with BootWare PROMs.

A modified bootsector together with a Makefile to create a BootWare-bootable image after kernel compilation can be found at:

Refer to the README file for installation details. Currently, only "zImage"-type kernels are supported. Unfortunately, kernel parameters are ignored.

This section was initially written by Jochen Kmietsch for the Diskless-HOWTO, email to: for any questions.

6.4. Local CDROM

This section was originally written by Hans de Goede for the Diskless-root-NFS-HOWTO. I modified it slightly in order to reflect some differences between this document and the Diskless-root-NFS-HOWTO.

Much of the above also goes for booting from cdrom. Why would one want to boot a machine from cdrom? Booting from cdrom is interesting everywhere one wants to run a very specific application, like a kiosk, a library database program or an internet cafe, and one doesn't have a network or a server to use a root over nfs setup.

6.4.1. Creating a test setup

Now that we know what we want to do 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 650�MB 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 necessary 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 with isofs and cdrom support compiled in.

  • Configure the test setup as described above with the root filesystem mounted read only.

  • Verify that the test setup automagically boots 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 will be sourced at the beginning of rc.sysinit to create /var:
                    #/var
                    echo Creating /var ...
                    mke2fs -q -i 1024 /dev/ram1 16384
                    mount /dev/ram1 /var -o defaults,rw
                    cp -a /lib/var /
                  

  • Edit /test/etc/rc.sysinit, comment the lines where the root is remounted rw, and add the following 2 lines directly after setting the PATH:
                    #to boot from cdrom
                    . /etc/rc.d/rc.iso
                  

  • Copy the following to a script and execute it to make a template for /var and create /tmp and /etc/mtab links.
    
                #!/bin/sh
                    echo tmp
                    rm -fR /test/tmp
                    ln -s var/tmp /test/tmp
    
                    ###
                    echo mtab
                    touch /test/proc/mounts
                    rm /test/etc/mtab
                    ln -s /proc/mounts /test/etc/mtab
    
                    ###
                    echo var
                    mv /test/var/lib /test/lib/var-lib
                    mv /test/var /test/lib
                    mkdir /test/var
                    ln -s /lib/var-lib /test/lib/var/lib
                    rm -fR /test/lib/var/catman
                    rm -fR /test/lib/var/log/httpd
                    rm -f /test/lib/var/log/samba/*
                    for i in `find /test/lib/var/log -type f`; do
                      cat /dev/null > $i;
                    done
                    rm `find /test/lib/var/lock -type f`
                    rm `find /test/lib/var/run -type f`
    
                  

  • 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:
                    # mount -o remount,rw /
                  

6.4.2. Creating the CD

If you need more information than you can find below, please refer to the CD-Writing-HOWTO.

6.4.2.1. Creating a boot image

First of all, boot into the working 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 and syslinux.cfg.

  • Cp the kernel-image from the test partition to boot.img.

  • Edit syslinux.cfg so that it contains the following, of course replace zImage by the appropriate 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 automagically free /dev/loop0 so free it by typing:
                    # losetup -d /dev/loop0
                  

6.4.2.2. 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 and make sure it's on a partition with enough free space.

  • Now generate the image by typing:
                      # mkisofs -R -b boot.img -c boot.catalog -o boot.iso /test
                    

6.4.2.3. Verifying the iso image

  • Mounting the image through the loopbackdevice by typing:
                      # mount boot.iso somewhere -o loop -t iso9660
                    

  • Umount boot.iso:
                      # umount somewhere
                    

  • If your /etc/mtab is a link to /proc/mounts umount won't automagically free /dev/loop0 so free it by typing:
                    # losetup -d /dev/loop0
                  

6.4.2.4. Writing the actual CD

Assuming that you've got cdrecord installed and configured for your cd-writer type:
            # cdrecord -v speed=<desired writing speed> dev=<path to your writers generic scsi device> boot.iso
          

6.4.3. Boot the cd and test it

Well the title of this paragraph says it all;)