.\"	$NetBSD: install,v 1.38 2017/06/22 16:46:52 flxd Exp $
.\"
.\" Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Pp
To install or upgrade
.Nx ,
you need to first boot an installation
program and then interact with the menu-based program
.Ic sysinst .
The installation program actually consists of the
.Nx
kernel plus an in-memory file system of utility programs.
.Pp
The traditional procedure is to write the installation system to a floppy
disk set and then boot from the floppies.
However, there are six ways to boot the
.Nx*M
installation system.
Each approach loads the exact same installation bits.
The six paths are:
.Pp
.
.(bullet -offset indent
Floppy disk boot
.It
CD boot
.It
Hard Drive Boot
.It
Magnetic Tape Boot
.It
Existing Root FS Boot
.It
Network boot
.bullet)
.
.Pp
In all cases, you need to transfer a
bootable image of the installation system
from the
.Nx
CD or from an ftp site to the chosen media type.
Although booting from floppy is the usual path, the
hard drive boot is useful if you have another operating system (and a spare
drive) already installed, or if you don't mind swapping hard drives from
box to box.
CD and tape boots are nice and fast if you have a CD writer
or a tape format in common with another previously installed
.Ul
system.
Finally, most versions of SRM can locate the
.Nx
boot program
.Ic netboot
via bootp and download it via tftp.
.Ic netboot
then mounts the root file system
.Pq Pa /
via NFS and loads the kernel.
.Pp
Note that if you are installing or upgrading from a writable media,
the media can be write-protected if you wish.
These systems mount a root image from inside the kernel, and will not
need to write to the media.
If you booted from a floppy, the floppy disk may be removed from
the drive after the system has booted.
.Pp
.
.(bullet
Floppy disk boot
.Pp
The 3.5", 1.44 MB boot floppy set is found under the
.Nx*M
\*V distribution directory in
.Pa \*M/installation/floppy/
as three files called
.Pa disk1of3 ,
.Pa disk2of3 ,
and
.Pa disk3of3 .
You need to put these disk images on three floppy disks.
.Pp
If you have a
.Ul
system handy, you can do this with commands
like the following:
.Pp
.Dl # Ic "dd if=disk1of3 of=/dev/rfd0a bs=18k"
.Dl # Ic "dd if=disk2of3 of=/dev/rfd0a bs=18k"
.Dl # Ic "dd if=disk3of3 of=/dev/rfd0a bs=18k"
.Pp
If the
.Ul
system you are using is not a
.Nx
system, you will probably need to replace
.Li /dev/rfd0a
with the name of the floppy device on your particular system.
.Pp
If you have an
.Tn MS-DOS
or
.Tn Windows
system available, you can use
the
.Ic rawrite.exe
utility to transfer the image to a floppy
disk.
This utility is provided with the
.Nx Ns /i386
install tools, under
.Pa i386/installation/misc ;
a documentation file,
.Ic rawrite.doc
is available there as well.
.Pp
Once the floppy has been made, you simply need to put it in the
drive and type
.Pp
.Dl \*[Gt]\*[Gt]\*[Gt] Ic "B DVA0"
.Pp
.It
CD boot
.It
Hard Drive boot
.It
Magnetic Tape Boot
.Pp
All three of these media types use the same initial image:
.Pa \&.../installation/diskimage/cdhdtape
The image can be written to a hard drive partition with a command
like:
.Pp
.Dl # Ic "dd if=cdhdtape of=/dev/rsd0c bs=16k"
.Pp
To boot from a magnetic tape device such as
.Tn DAT
or
.Tn DLT ,
it is important
to create the tape image with 512-byte records.
Use a command like:
.Pp
.Dl # Ic "dd if=cdhdtape of=/dev/rst0 bs=512 conv=osync"
.Pp
If the host system is not
.Nx ,
the names of the destination devices are likely to be different.
Be sure to use a
.Dq raw partition
device that doesn't skip over labels!
.Pp
The use of CD-R devices varies greatly depending on the host OS
and host software; it isn't possible to give typical instructions here.
.Pp
.It
Existing Root FS Boot
.Pp
The installation subdirectory
.Pa instkernel/
contains
.Pa netbsd.gz ;
this is the same install kernel but without a bootable file system
image wrapped around it.
You can perform an complete reinstall by beginning it as an upgrade,
and booting this kernel in the normal way off the root file system
.Pq Pa /
of a previous installation.
.Pp
The gzipped image can be booted directly; it is not necessary to
uncompress it first.
.Pp
.It
Network Boot
.Pp
Booting
.Nx*M
\*V over a network requires a BOOTP or
DHCP server, a TFTP server and an NFS server.
(These are usually all run on the same machine.)
There are three basic stages to the boot:
.Pp
.
.
.(bullet
\*M console software sends a BOOTP request to get its
own address, the address of the TFTP server and the file to
download.
It downloads this file, which is the second stage bootstrap,
via TFTP and then executes it.
.It
The secondary boot program resends the BOOTP request, this
time also locating the NFS server and root path.
It mounts the root path via NFS and reads in and transfers to the kernel:
.Pa /netbsd .
.It
The kernel probes and configures the devices, and then sends
out another BOOTP request so it can find out its address, the NFS
server, and path.
It then mounts its root
.Pq Pa /
via NFS and continues.
.bullet)
.
.Pp
You will need to set up servers for BOOTP, TFTP and NFS.
.Pp
If you want to run a full system
from the network, untar the
.Nx
distribution into a directory on your server and NFS export that directory
to the client.
Make sure you put a kernel there as well, and create the device nodes in
.Pa /dev
with
.Ic sh ./MAKEDEV all .
Detailed instructions on netbooting can be found by visiting
.Lk http://www.NetBSD.org/docs/network/netboot/
.Pp
You'll want to map root to
.Li root
(rather than the default
.Li nobody )
when you export your root file system
.Pq Pa / .
A typical
.Pa /etc/exports
line on a
.Nx
system would be:
.Pp
.Dl /usr/export/\*M -maproot=0 myclient.mydom.com
.Pp
One option is to load just the install kernel over the network but then
proceed to a normal disk-based install and disk-based operation.
(Perhaps the \*M doesn't have a floppy drive, or you just don't
want to use a
.Tn Windows
system to make the floppy; we understand.)
.Pp
For this case, you still need to export an NFS root, but
the only thing it needs to have in it is the
.Li instkernel
image from the distribution.
.Pp
The gzipped image can be booted directly; it is not necessary to
uncompress it first.
.Pp
The console will be using TFTP to load the
.Nx
boot program,
so for the TFTP setup, you need to copy the second stage bootstrap,
.Ic netboot ,
into an appropriately named file such as
.Li boot.netbsd.\*M
in the directory used by your TFTP server.
If you extracted a full snapshot, you can get the netboot program from
.Pa /usr/mdec/netboot ;
if not, you can get this from the
.Pa installation/netboot
directory where you found the \*M distribution.
.Pp
For the BOOTP server you need to specify the:
.
.(bullet -compact -offset indent
hardware type (Ethernet)
.It
hardware address (Ethernet MAC address)
.It
IP address of the client
.It
subnet mask of the client
.It
address of of the TFTP/NFS server
.It
name of the second stage bootstrap loaded via TFTP
.It
path to the root for the client (mounted via NFS)
.bullet)
.
.Pp
Here's an example for a
.Ul
system running
.Ic bootpd :
.(disp
myhost.mydom.com:\
        :ht=ethernet:ha=0000c0391ae4:\e
        :ip=192.168.1.2:sm=255.255.255.0:\e
        :sa=192.168.1.1:bf=boot.netbsd.\*M:rp=/usr/export/\*M:
.disp)
.Pp
And here's an example for a
.Ul
system running the ISC
.Ic dhcpd :
.(disp
host axp {
        hardware ethernet 0:0:c0:39:1a:e4;
        fixed-address 192.168.1.2;
        option host-name "myhost.mydom.com";
        filename "boot.netbsd.\*M";
        option root-path "/usr/export/\*M";
        option domain-name-servers 192.168.1.1;
        option broadcast-address 255.255.255.0;
        option domain-name "my.domain";
}
.disp)
.Pp
The only Ethernet device the console on most \*M systems
knows how to boot from is the onboard Ethernet interface or a
.Tn DEC
Tulip (21040, 21041, 21140) PCI Ethernet card.
Some older SMC 100 Mbps cards that use this chip have been known to
work as well.
Many older systems will not be able to use the newer 2.0 stepping
of the 21140, however.
If your system appears not to be receiving packets, this may be the problem.
(You may or may not be able to update your firmware to fix this; see
.Lk http://www.NetBSD.org/ports/alpha/
for more information on this.)
In general, 10 Mb cards from manufacturers other than
.Tn DEC
will work, and 100 Mb cards not from
.Tn DEC
will not.
.Pp
Once you're set up, you should be able to boot with:
.Pp
.Dl \*[Gt]\*[Gt]\*[Gt] Ic "boot -proto bootp ewa0"
.Pp
You should permanently set your protocol to
.Tn BOOTP
with:
.Pp
.Dl \*[Gt]\*[Gt]\*[Gt] Ic "set ewa0_protocols bootp"
.Pp
The 3000 series of TURBOchannel systems and certain other models use
.Em old SRM ,
do not have a
.Fl proto
option and use different device names.
They also tend to not netboot very well so you probably don't
need to worry about this section.
However, if you want to give it a try, note the following differences:
.(bullet -offset indent
There is no
.Fl proto
argument, or
.Ic ewa0_protocols
variable.
Old SRM uses bootp if the device name is given as
.Sy ez0 .
.It
The use of the
.Xr setnetbootinfo 8
program will probably also be necessary, as it is unlikely that an SRM
from that era will properly communicate the ethernet HW address to the
boot program.
.It
Example:
.Pp
.Dl \*[Gt]\*[Gt]\*[Gt] Ic "boot ez0"
.bullet)
.bullet)
.
.
.Pp
.so ../common/sysinst
.
