Introduction (i386-specific), Diskless NetBSD HOW-TO

There are several ways to load the NetBSD kernel for 'diskless'
operation:

Via netboot rom

You will need a BIOS supporting boot from network and a matching
network card. This is becoming more popular in new PCs, especially
ones with build in network adapters. Setup a server on the
network (see
diskless(8))
and modify your BIOS settings to try the network boot first.

If your BIOS does not support this, but you have a network card
supported by NetBSD's 'netboot' bootloader, you can boot to
DOS (see the discussion about dosboot.com below) and
use 'netboot.com' to load your kernel over the network.
To generate a suitable 'netboot.com' cd to
/usr/src/sys/arch/i386/stand/netboot, edit the
Makefile to define the options for your network adapter
and run "make netboot.com".

Via PXE

If your hardware is capable of netbooting using PXE, it first tries to
acquire an IP address using the Dynamic Host Configuration protocol
(DHCP). The dhcpd server uses the ethernet address (MAC) of the client
machine to determine its IP address and a bootloader filename. If this
request is successful, PXE expects to be able to download a second-stage
boot program via the Trivial File Transfer Protocol (TFTP). It will do
this by setting up a TFTP connection to the server that answered the
earlier DHCP request, and asking for the file name returned by the server.
The second-stage boot program then loads the kernel using NFS from the
server and path specified by the DHCP request.

There are two PXE bootloader files available in
the /usr/mdec/ directory of base.tgz from the NetBSD
distribution. pxeboot_ia32.bin should be used for most cases,
since pxeboot_ia32_com0.bin will force the client to use its
first serial port as the console. The serial console PXE file may be
necessary for embedded systems (such as the Soekris line of hardware)
which only have a serial console. Use 9600 8N1 settings.

GRUB is a boot loader,
that is capable of booting different OS types and some of them
via network. GRUB itself is loaded from disk or network using a
PXE or NBI (such as Etherboot)
loader. Etherboot & GRUB supports many different NICs,
more than the NetBSD's 'netboot'
bootloader does. Note you'd need to use GRUB version 0.90 or later.
GRUB and Etherboot require GCC and GNU Binutils
2.9.1 or later. They can be compiled on any system,
they don't need to be compiled on NetBSD host.

You'd need to setup environment so that EtherBoot would load and execute
appropriate GRUB image, and configure GRUB so that it would load NetBSD
kernel. The necessary steps are outlined below.

Put appropriate EtherBoot EPROM image to your EPROM.

Build GRUB 0.90. You need to configure it with options
--enable-diskless
and --enable-* appropriate for your NIC

Put built GRUB stage2/nbgrub image on TFTP server.

Configure dhcpd for the diskless machine, dhcpd
entry could look like this:

GRUB doesn't pass boot information to NetBSD. Thus, if you want
to be able to autoboot NetBSD, you'd need to configure kernel's
root explicitly, like:

config netbsd root on ? type nfs

Then, build the kernel and put it on TFTP server as configured
in GRUB configuration file.

If you want to use serial console, you'd need to configure both
GRUB and kernel to use it. To use serial line for GRUB,
uncomment the serial and
terminal entries in above example GRUB configuration.
To use serial
line as NetBSD console, add option like

options "CONSDEVNAME=\"com\"",CONADDR=0x2f8,CONSPEED=57600

to your kernel configuration.

That should be it!

From floppy disk

The kernel on the floppy may be configured to mount
the root filesystem over the network by using this in your kernel
config file:

NetBSD compiles a special version of the bootloader into a
small DOS program, called "dosboot.com". This is
located in /usr/mdec on installed systems or in the base.tgz
set. To use, copy both dosboot.com and your kernel
onto a FAT (msdos) partition, and boot to DOS.

Windows 95 or 98

Press F8 while the string "Loading Windows XX" is displayed
to enter the boot menu. The menu items displayed there will
depend on your installation.

You may need to avoid loading the HIMEM.SYS driver and the
EMM386.SYS driver. In this case choose "Step-by-step
confirmation" and answer all questions with "n" or ESC.

Hold down the SHIFT key when the computer is booting to
skip config.sys and autoexec.bat.

At the DOS prompt, change into the directory where you have
put "dosboot.com" and the kernel. Enter "dosboot" to
boot "netbsd", or "dosboot filename" if your kernel
file has a different name.

The dosboot utility is able to handle extended memory, as provided by
the HIMEM.SYS driver. Unfortunately this gets into the way if NetBSD
is going to make calls to the APM BIOS. There is no problem if you don't
have an APM BIOS, or your NetBSD kernel does not use it (no
"apm0 at mainbus0"). If you are going to use APM, don't load HIMEM.SYS
when using dosboot.

If you wish to create a customised version of dosboot.com, cd
to /usr/src/sys/arch/i386/stand/dosboot, edit the
Makefile for special options (serial console, ...)
and run "make".