  Netbooting a 286 with a ramdisk
  Ken Yap, ken.yap@acm.org
  1 July 1997

  This document explains how I netbooted a ramdisk onto a 286
  ______________________________________________________________________

  Table of Contents


  1. Netbooting a 286 with a ramdisk

  2. How to do it

  3. What needs to be done to boot other OSes with ramdisk



  ______________________________________________________________________

  11..  NNeettbboooottiinngg aa 228866 wwiitthh aa rraammddiisskk


  I have booted a 286 diskless, using a boot ROM on a network card,
  sending an image of a ramdisk containing a DOS startup floppy disk.
  The 286 then ran programs from the ramdisk. This could be used to send
  programs like telnet, print spoolers, routers and other standalone
  utilities that you want to run on a diskless (and maybe headless and
  keyless) 286. Here are some ideas
  <http://www.geocities.com/SiliconValley/lab/9247/> for what you could
  run.



  The method could be generalised to other OSes that could run on a 286,
  e.g. ELKS <http://epocha.pd.mcs.net/Linux8086/>. See the discussion
  below for what needs to be done.




  22..  HHooww ttoo ddoo iitt



  1. Prepare a floppy containing a bootable DOS. I used Caldera's DR-DOS
     <http://www.caldera.com/dos/>, which is free for personal and
     charitable uses. You might also try FreeDOS
     <http://www.freedos.org/> but I have not tested it. Since the RAM
     available for ramdisk may be limited, in the case of a 286 with 1
     MB memory: 384k less the 64 kB High Memory Area, giving 320 kB, you
     probably want to create a 360 kB floppy. The commands are usually:
     format b:, then sys b:. (I assume your floppy is B: in all that
     follows.) You can also use mtools to manipulate a floppy image in a
     file but you have to get the boot block from DR-DOS or FreeDOS to
     pass to mformat.

  2. Copy all the programs you need to run from the ramdisk onto the
     floppy. Don't forget any configuration files needed. Also include
     an autoexec.bat (and perhaps config.sys) to start everything up.
     Don't worry about getting the configuration file contents right at
     this point; I will show you how to edit them from the host system.

  3. Take the floppy to a Linux <http://www.linux.org> system and using
     dd, copy the floppy image into a file. The command is: dd
     if=dev/fd1h360 of=floppyimage/.
  4. On the Linux system, set up mtools
     <http://wauug.erols.com/pub/knaff/mtools/> so that floppyimage can
     be manipulated as a DOS drive. The file you want to edit is
     probably /etc/mtools.conf. Alternatively, if you know how, you
     could set up the loopback device and mount the floppyimage as a DOS
     filesystem. Using mtools, you can copy configuration files between
     the "floppy" and your host system and edit them until you are happy
     with them.

  5. Get the Etherboot <http://www.slug.org.au/etherboot/> distribution,
     version 3.2 or higher, and make a boot PROM for the card of your
     choice. You may want to enable the ASK_BOOT option with a short
     timeout and ANS_DEFAULT=ANS_NETWORK.  This will enable you to boot
     the 286 normally if you need to fix anything. All network cards,
     even the very old ones, should accept a 8 kB boot PROM. The
     compressed 16 bit images in Etherboot are under 8 kB.  Burn it into
     a PROM or find someone to do it for you. If you are using a larger
     PROM, make sure you have burnt it in the right portion of the PROM,
     or burn multiple copies in the address space to be sure. See here
     <http://www.slug.org.au/etherboot/doc/html/README.html> for some
     things to watch out for.

  6. Set up bootp and tftp services on the server if you haven't
     already.

  7. In the same Etherboot distribution, compile the mknbi-dos program.
     Use the program to create a tagged image in the directory that
     tftpd fetches from, typically /tftpboot. The command is probably:
     mknbi -x -x -r floppyimage -o /tftpboot/286boot.  (The two -x flags
     print out verbose information.) Check that the /etc/bootptab entry
     for the 286 specifies 286boot as the file to load.

  8. On your 286, disable any floppies or hard disks in the CMOS
     configuration. Also set it to not require a keyboard, if you intend
     to run keyless. If the CMOS setup doesn't allow you to disable the
     keyboard, you have a problem.  One way out might be to attach an
     unloved keyboard, one that is just good enough to pass the probe
     from the BIOS.

  9. Now hit the reset switch and watch the boot PROM take over. It
     should find the bootp server and then the tftp server and load the
     floppyimage.  Then DOS will start reading autoexec.bat and execute
     the commands there.  Hopefully the last command there is the
     program you want to run all the time.

  10.
     Enjoy.

  Tip: You can do a mdir directly on the netboot image if you use the
  offset parameter of mtools. In $HOME/.mtoolsrc, put


  ______________________________________________________________________

  drive t: file="/tftpboot/dos.nb" offset=4096
  ______________________________________________________________________



  Then you can do






  ______________________________________________________________________

  mdir t:
  ______________________________________________________________________



  4096 is the sum of the header size (512) and the startup segment size
  (3584). It may be different for other versions of mknbi-dos.



  Caveat: For this trick, access other than reading only may not work.
  You may be able to rewrite things on the "disk" with mcopy, etc. but
  the declared size in the header will not get updated. If you wish to
  modify things you should work on the "disk" image, then rebuild with
  mknbi-dos.



  Caveat: If you do your arithmetic you will see that the amount of XMS
  memory in the typical 1 MB 286 is not quite enough to hold the whole
  of the 360 kB floppy.  After deducting the HMA, one is left with 320
  kB of XMS. Provided you don't fill the "floppy" to the brim and use up
  the last "sectors", you should be ok. One way to be safe is to make a
  320 kB "floppy" using 8 sectors per track instead of 9. And of course
  you could add more XMS and download larger "floppies".



  Hint: Using an executable compressor like lzexe or pklite might allow
  you to squeeze more programs onto the "floppy". See a site like
  Simtel.Net <http://www.simtel.net/simtel.net/> for such programs.



  Note: Of course, this technique works for 386s and higher. However you
  may want to consider netbooting Linux <http://www.linux.org> with an
  initial ramdisk instead of DOG.


  33..  WWhhaatt nneeeeddss ttoo bbee ddoonnee ttoo bboooott ootthheerr OOSSeess wwiitthh rraammddiisskk


  Essentially a version of mknbi similar to mknbi-dos needs to be
  written for that OS and filesystem. For example, for ELKS, the setup
  code in first.S would do validity checks for a Minix filesystem and
  mknbi would create a Minix ramdisk.



  I have not done this. Please let me (and the netboot community) know
  if you have success with this.













