Netbooting a 286 with a ramdisk
Ken Yap, kenUNDERSCOREyap AT users PERIOD sourceforge PERIOD
net
14 September 1999
This document explains how I netbooted a ramdisk onto a 286 and used
it to run DOS applications.
______________________________________________________________________
Table of Contents
1. Netbooting a 286 with a ramdisk
2. How to do it
3. Various tips
4. What needs to be done to boot other OSes with ramdisk
______________________________________________________________________
11.. NNeettbboooottiinngg aa 228866 wwiitthh aa rraammddiisskk
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
for what you could
run.
The method could be generalised to other OSes that could run on a 286,
e.g. ELKS . See the discussion
below for what needs to be done.
22.. HHooww ttoo ddoo iitt
1. Prepare a floppy containing a bootable DOS. I used Caldera's DR-DOS
, which is free for personal and
charitable uses. _(_I_t _h_a_s _b_e_e_n _c_o_n_f_i_r_m_e_d _t_h_a_t _D_R_-_D_O_S _7_._0_3 _h_a_s
_c_h_a_n_g_e_d _i_n _s_o_m_e _w_a_y _t_h_a_t _n_e_t_b_o_o_t_i_n_g _f_a_i_l_s_; _r_e_a_s_o_n _i_s _s_t_i_l_l _u_n_k_n_o_w_n_.
_7_._0_2 _w_o_r_k_s_._) FreeDOS can also be netbooted and the kernel is loaded
from the tagged image rather than from the floppy image, which
means more space for applications or data. All the instructions are
in the mknbi directory that comes with the Etherboot
distribution. You can find a zip file
containing
the components of a tagged image that runs telnet on the diskless
client.
2. You can do nearly all manipluations on Linux using mtools
on a floppy image in a
file but you have to get the boot block from DR-DOS first to pass
to mformat. You can do this by extracting the first 512 bytes from
a formatted and sys'ed floppy. The DOS commands are: format b:,
then sys b:.
___________________________________________________________________
dd if=/dev/fd0 of=dosboot.bin bs=512 count=1
___________________________________________________________________
You also need the kernel files ibmbio.com and ibmdos.com; and com-
mand.com.
______________________________________________________________________
mattrib -rsh a:ibmbio.com a:ibmdos.com
mcopy a:ibmbio.com a:ibmdos.com a:command.com .
______________________________________________________________________
3. 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 320kB ramdisk floppy.
If you have more extended memory, then you can create larger
ramdisks, e.g. 720kB or even 1.44MB.
4. Set up a mapping between the floppy image and a drive letter by
editing .mtoolsrc, see the mtools man pages.
___________________________________________________________________
drive z: file="/tmp/floppyimage.320"
___________________________________________________________________
5. Create the floppy image and copy the boot block onto it in a file
using mformat (adjust the number of tracks, sectors and heads if
you are not using a 320kB format).
___________________________________________________________________
mformat -t 40 -s 8 -h 2 -B dosboot.bin -C z:
___________________________________________________________________
In what follows, when I write floppy, I mean the image in a disk file
referred to by z:.
6. Copy the DOS kernel files onto the floppy. In the case of DR-DOS
these are ibmbio.com, ibmdos.com, and command.com. The first two
are read-only hidden system files so use mattrib to set these
attributes.
7. Copy all the programs you need to run 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, you
can replace them at will on the ramdisk floppy.
8. Get the Etherboot distribution,
version 4.4 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. Most
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
for some
things to watch out for.
9. Set up bootp/DHCP and tftp services on the server if you haven't
already. Did I mention read the Etherboot documentation already?
10.
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 /tftpdir. The command is probably:
mknbi-dos -x -x -r floppyimage -o /tftpdir/dos.nb. (The two -x
flags print out verbose information.) Check that the /etc/bootptab
entry or the dhcpd.conf entry for the 286 specifies dos.nb as the
file to load. You may need the -f flag to disable checking if
mknbi-dos doesn't recognise your DOS version.
11.
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.
12.
Now hit the reset switch and watch the boot PROM take over. It
should find the bootp/DHCP server and then the tftp server and load
the tagged image. Then DOS will start executing, reading
autoexec.bat and running the commands there. Hopefully the last
command there is the program you want leave running.
13.
You may wish to look at the contributed program romid.exe in the
Etherboot distribution. This is meant to be run from autoexec.bat.
It returns the ID of the boot ROM installed in an environment
variable so that the appropriate packet driver
can be installed.
14.
Another program I like to invoke in autoexec.bat is pdclksml.com,
found here which
sets the PC clock using bootp and the UDP time service (port 37).
Things that I have netbooted in this fashion are:
+o NCSA telnet, using a version that gets most parameters by bootp. I
compressed the binary using lzexe to save space.
+o DOS Kermit 3.16, again using BOOTP. Kermit has better terminal
emulation than NCSA Telnet and is generally more polished but
requires a 720kB "floppy". Again I compressed the binary using
lzexe.
+o Non-spooling printer daemon.
+o DOS syslogd.
+o Network traffic monitors.
You can find these and other suggested applications here
.
33.. VVaarriioouuss ttiippss
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="/tftpdir/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 "floppy" 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 "floppy" image, then rebuild with
mknbi-dos.
Hint: As mentioned before, using an executable compressor like lzexe
or pklite might allow you to squeeze more programs onto the "floppy".
See a site like Simtel.Net for
such programs.
Note: Of course, this technique works for 386s and higher. However you
may want to consider netbooting Linux with an
initial ramdisk instead of DOG.
44.. WWhhaatt nneeeeddss ttoo bbee ddoonnee ttoo bboooott ootthheerr OOSSeess wwiitthh rraammddiisskk
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.