dnl	$OpenBSD: install,v 1.27 2009/05/13 18:38:29 miod Exp $

There are several ways to install OpenBSD onto a disk. The easiest way
in terms of preliminary setup is to use the OpenBSD ramdisk kernel that can
be booted from tape.

Alternatively, if the MACHINE is hooked up to a network, it is possible
to set up another machine as a server for diskless setup, which is a
convenient way to install on a machine whose disk does not currently
hold a usable operating system.
This is difficult to get set up correctly the first time, but easy to
use afterwards.  (See ``Installing using a diskless setup'' below).

Boot device restrictions:

The BUG firmware will not necessarily be able to boot from any device in
the system.

Depending on the BUG firmware version, the following limitations may apply:
- bootable SCSI tapes must have device ID 4 or 5.
- bootable SCSI disks must have device ID 0, 1, 2 or 3.
- only the first two MVME328 cards in a system (CLUN 6 and 7) can be
  used as the boot controller.

Booting from the Installation Media:

Prior to attempting an installation, everything of value on the target
system should be backed up.  While installing OpenBSD does not necessarily
wipe out all the partitions on the hard disk, errors during the install
process can have unforeseen consequences and will probably leave the system
unbootable if the installation process is not completed. Availability
of the installation media for the prior installation, such as a Motorola
SystemV/MACHINE tape is always a good insurance, should it be necessary
to "go back" for some reason.

After taking care of all that, the system should be brought down gracefully
using the shutdown(8) and/or halt(8) commands, which will eventually go
back to the ``BUG>'' prompt (it may be necessary to send a break if the
system is completely halted).

Booting from SCSI tape:

Bootable tapes can be booted with the following command at the prompt:

    187-Bug> BO xx yy

Where `xx' is the SCSI controller number (00 for the built-in SCSI
controller on MVME187 and MVME197), and `yy' is the encoding for the SCSI
device ID, which varies between controllers.

Recent BUG can list the available disk and tape controllers, using the
"IOT;H" command:

    I/O Controllers Available:
    CLUN  CNTRL-TYPE  CNTRL-Address  N-Devices
       0  VME187      $FFF47000      *
       6  VME328      $FFFF9000      *

In this example, the built-in controller, as well as an external MVME328
controller, are available.

The encoding for the drive ID is as follows:
- MVME187 and MVME197 built-in controller and MVME327A SCSI controller:
    'yy' is ten times the device ID.
- MVME328 SCSI controller:
    'yy' is eight times the device ID, written in hexadecimal
- MVME350 tape controller:
    'yy' is always zero, as this controller only supports one tape drive.

For example, booting from a tape drive using SCSI ID #5 will be done with:
    187-Bug> BO 00 50
using the MVME187 built-in controller, but with:
    187-Bug> BO 06 28
using an MVME328 board.

Note that OpenBSD/MACHINE can boot off any controller supported by the BUG,
even if it is not supported by OpenBSD.

Booting from Network:

OpenBSD/MACHINE can boot off any network card supported by the BUG, even
if the card itself is not supported by OpenBSD. Two network boot loaders
are provided: one for Sun-compatible diskless setup (bootparams and NFS
root), and a simpler version limited to TFTP support.

The Sun-compatible network bootloader currently only supports the MVME187
and MVME197 on-board interface, and will not be able to boot from any other
Ethernet controller. The tftp bootloader does not have this limitation and
will boot from any BUG-supported Ethernet controller.

If you plan to use the Sun-compatible bootloader, "netboot", it will be
necessary to set up a complete diskless client configuration on a server. If
the boot server is an OpenBSD system, the diskless(8) manual page will
provide detailed information on the process.

If the server runs another operating system, the setup instructions will
likely be available as part of the documentation that came with it (on
SunOS systems, add_client(8) and the Sun System/Networks administrators
guide constitute a good start; on Solaris systems, share(1M) is a good
starting point as well).

Using the TFTP-compatible bootloader, "tftpboot", only requires a TFTP
server to be installed on the network, with both the tftpboot file and
the kernel image (usually bsd.rd) available from it.

The list of BUG-supported Ethernet controllers is available with the
"NIOT;A" command. For example:

    187-Bug> NIOT;A
    Network Controllers/Nodes Supported
    CLUN  DLUN  Name      Address
       0     0  VME187    $FFF46000
       2     0  VME376    $FFFF1200
       3     0  VME376    $FFFF1400
       4     0  VME376    $FFFF1600
       5     0  VME376    $FFFF5400
       6     0  VME376    $FFFF5600
       7     0  VME376    $FFFFA400
      10     0  VME374    $FF000000
      11     0  VME374    $FF100000
      12     0  VME374    $FF200000
      13     0  VME374    $FF300000
      14     0  VME374    $FF400000
      15     0  VME374    $FF500000

The "NIOT;H" lists only the available controllers in the machine. For
example, on an MVME187 system with no external network card:

    187-Bug> NIOT;H
    Network Controllers/Nodes Available
    CLUN  DLUN  Name      Address
       0     0  VME187    $FFF46000

If the BUG does not support the NIOT command (MVME187 BUG prior to version
1.3 doesn't), then it has no support for netbooting.

If you know the IP address for the MACHINE and the TFTP server,
you can directly provide the boot loader's filename and the kernel name
on the commandline:

     187-Bug> NBO 00 00 netboot.mvme88k bsd.rd
     187-Bug> NBO 00 00 tftpboot.mvme88k bsd.rd

where, in this example, is the address of the MACHINE computer,
and the address of the diskless server.

Specifying both IP addresses as will cause them to be obtained
with reverse ARP (for the MACHINE address) and bootp or dhcp (for the
server address):

     187-Bug> NBO 00 00 netboot.mvme88k bsd.rd
     187-Bug> NBO 00 00 tftpboot.mvme88k bsd.rd

If you intend to netboot very often, these parameters can be made permanent
by filling the "NIOT" parameters and save them to NVRAM.

Be sure to provide the correct values for Controller LUN and Device LUN (as
listed in the "NIOT;H" output); also the "Boot File Load Address" and
"Boot File Execution Address" need to match (there is no reason to change
the default value of 001F0000). The "Boot File Name" must match the name
of the netboot file on the server (copying it as "netboot.mvme88k" or
"tftpboot.mvme88k" is usually a wise choice). Finally, "Argument File Name"
needs to be set to the kernel name: "bsd.rd" in order to boot the
installation miniroot, or "bsd" for the regular kernel.

Here are acceptable values for a 187 card using the built-in controller:

    187-Bug> NIOT
    Controller LUN =00? 
    Device LUN     =00? 
    Node Control Memory Address =01FF0000? 
    Client IP Address      = 
    Server IP Address      = 
    Subnet IP Address Mask = 
    Broadcast IP Address   = 
    Gateway IP Address     = 
    Boot File Name ("NULL" for None)     =? netboot.mvme88k
    Argument File Name ("NULL" for None) =? bsd.rd
    Boot File Load Address         =001F0000?
    Boot File Execution Address    =001F0000?
    Boot File Execution Delay      =00000000? 
    Boot File Length               =00000000? 
    Boot File Byte Offset          =00000000? 
    BOOTP/RARP Request Retry       =00? 
    TFTP/ARP Request Retry         =00? 
    Trace Character Buffer Address =00000000? 
    BOOTP/RARP Request Control: Always/When-Needed (A/W)=W? 
    BOOTP/RARP Reply Update Control: Yes/No (Y/N)       =Y? 

If you change the NIOT configuration, you will be asked whether you want to
make these changes permanent. Do not answer Y unless you plan to netboot
this board very often; be sure to have the ENV settings use a correct
address for the NIOT parameters block in this case. A valid setting is:

    Network Auto Boot Configuration Parameters Pointer (NVRAM) =
        00000000? FFFC0080

for example.

Once the NIOT parameters are set, it should be possible to boot the machine
from the server with a shortened NBO command:

    187-Bug> NBO 00 00

Installing using the tape or netboot procedure:


	Boot your machine from the installation media as described above.

	It will take a while to load the kernel especially from a slow
	network connection, most likely more than a minute.  If some action
	doesn't eventually happen, or the spinning cursor has stopped and
	nothing further has happened, either your boot media is bad, your
	diskless setup isn't correct, or you may have a hardware or
	configuration problem.




OpenBSDInstallPart6({:-CD-ROM, NFS, -:})



OpenBSDDISKInstall(,{:-only -:})





Net Boot or Diskless Setup Information:

The set up is similar to SunOS diskless setup, but not identical, because
the Sun setup assumes that the bootblocks load a kernel image, which then
uses NFS to access the exported root partition, while the OpenBSD bootblocks
use internal NFS routines to load the kernel image directly from the
exported root partition.

Please understand that no one gets this right the first try, since
there is a lot of setup and all the host daemons must be running and
configured correctly.  If you have problems, extract the diskless(8)
manpage, find someone who's been through it before and use the host
syslog and tcpdump(8) to get visibility of what's happening (or not).

Your MACHINE expects to be able to download a second stage bootstrap
program via TFTP after having acquired its IP address through RevARP when
instructed to boot "over the net". It will look for the filename specified
on the NBO commandline, or via the NIOT parameters.

Normally, this file is a symbolic link to an appropriate second-stage
boot program, which should be located in a place where the TFTP daemon
can find it (remember, many TFTP daemons run in a chroot'ed environment).
You can find the boot program in `/usr/mdec/netboot' in the OpenBSD/MACHINE

After the boot program has been loaded into memory and given control by
the BUG, it starts locating the machine's remote root directory through
the BOOTPARAM protocol. First a BOOTPARAM WHOAMI request is broadcast
on the local net. The answer to this request (if it comes in) contains
the client's name. This name is used in the next step, a BOOTPARAM GETFILE
request -- sent to the server that responded to the WHOAMI request --
requesting the name and address of the machine that will serve the client's
root directory, as well as the path of the client's root on that server.

Finally, this information (if it comes in) is used to issue a REMOTE MOUNT
request to the client's root filesystem server, asking for an NFS file
handle corresponding to the root filesystem. If successful, the boot
program starts reading from the remote root filesystem in search of the
kernel which is then read into memory.

Unpack `base{:--:}OSrev.tgz' and `etc{:--:}OSrev.tgz' on the server in the root directory
for your target machine. If you elect to use a separately NFS-mounted
filesystem for `/usr' with your diskless setup, make sure the "./usr" base
files in base{:--:}OSrev.tgz end up in the correct location. One way to do this is
to temporarily use a loopback mount on the server, re-routing <root>/usr to
your server's exported OpenBSD "/usr" directory. Also put the kernel and
the install/upgrade scripts into the root directory.

A few configuration files need to be edited:

		Add the IP addresses of both server and client.

		This files contains the client's hostname; use the same
		name as in <root>/etc/hosts.

		Enter the entries for the remotely mounted filesystems.
		For example:
			server:/export/root/client       /     nfs  rw 0 0
			server:/export/exec/MACHINE.OpenBSD /usr  nfs  rw 0 0