.\"	$NetBSD: install,v 1.4 2021/12/05 04:47:17 msaitoh Exp $
.\"
.\" Copyright (c) 2010 Microsoft Corp.
.\" Copyright (c) 2010 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.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"        This product includes software developed by the NetBSD
.\"        Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\"    contributors may be used to endorse or promote products derived
.\"    from this software without specific prior written permission.
.\"
.\" 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.
.\"
.
.(Note
There may be updates to this procedure available from the
.Nx*M
web page at
http://www.NetBSD.org/ports/\*M/ .
.Note)
.Pp
To install or upgrade
.Nx ,
you need to first boot an installation
program and then interact with the screen-menu program
.Ic sysinst .
The installation program actually consists of the
.Nx
kernel plus
an in-memory file system of utility programs.
.Pp
From most convenient to least convenient, the installation methods
are:
.(enum
Installation from an existing
.Nx
system by booting the
install kernel from an existing root file system
.Pq Pa / .
See the
.Sx Installing from an existing system
section later in these INSTALL notes.
.It
Copying a bootable diskimage onto the beginning of a disk and installing
onto that disk.
See the
.Sx Install via diskimage
section later in these INSTALL notes.
.It
Booting the install kernel over the network and installing onto a local
disk.
See the
.Sx Install via netboot install kernel
section later in these INSTALL notes.
.It
Using a helper machine with a CompactFLASH controller to copy the bootable
diskimage onto the beginning of a disk, and moving the disk to the
target machine.
See the
.Sx Install via diskimage
section later in these INSTALL notes.
.It
For BEE3 machines that do not have local disk storage, you
will need to set up an NFS server with a diskless root file system for
trimmed-down network install kernel and run the installation system from
the NFS root file system. NFS is also your only option for user storage.
See the
.Sx Install via diskless boot
section later in these INSTALL notes.
.enum)
.Pp
You should familiarize yourself with the hardware configuration on your machine or simulator.
Be sure you know how to print the configuration of your machine,
and how to boot from disk or network, as appropriate.
.Pp
To boot from disk, use:
.Pp
.(tag 12n -offset indent -compact
.It "All systems:"
.Ic "/netbsd"
.tag)
.Pp
To boot via TFTP, use 
.(tag 12n -offset indent -compact
.It "boot:"
.Ic "tftp"
.tag)
.Pp
You will also need to know the total size (in sectors) and the
approximate geometry of the disks you are installing onto, so that you
can label your disks for the
.Bx
fast file system (FFS).
The kernel should correctly detect the disk geometry. The
.Ic sysinst
tool will suggest these as the default.
.Pp
If you're installing
.Nx*M
for the first time it's a very
good idea to pre-plan partition sizes for the disks on which you're
installing
.Nx .
Changing the size of partitions after you've installed is difficult.
If you do not have a spare bootable disk, it may be simpler to re-install
.Nx
again from scratch.
.Pp
Assuming a classic partition scheme with separate
.Pa /
(root)
and
.Pa /usr
file systems, a comfortable size for the
.Nx
.Pa /
partition is about 64 MB.
A good initial size for the swap partition is twice the
amount of physical memory in your machine.
The default swap size is 64 MB, which
is adequate for doing a full system build.
A full binary installation, with X11R7 takes about 700 MB in
.Pa /usr ;
a 1 GB
.Pa /usr
should be ample.
.
.Ss2 Install via a NetBSD CD-ROM
.
You can obtain the disk image or diskless boot tar file from the
.Nx \*V
.Tn CD-ROM .
.Pp
To mount the CD-ROM from a
.Nx*M
host, type
.Pp
.Dl # Ic "mount -r -t cd9660 /dev/cd" Ns Ar X Ns Ic "c /mnt"
.Pp
where
.Ar X
is the ID of the CD-ROM.
.Pp
The diskimage file can be found on the CD-ROM at the following location
(relative to the mount point of the CD)
.Pp
.Dl Pa \*M/installation/diskimage/diskimage.gz
.Pp
and the diskless boot tar file can be found at
.Pp
.Dl Pa \*M/installation/netboot/diskimage.\*[setsuffix]
.Pp
Once you have located these files, continue on to either
.Sx Install via netboot install kernel ,
.Sx Install via diskless boot ,
.Sx Install via diskimage
or
.Sx Installing from an existing system
section later in the INSTALL notes.
.
.Ss2 Installing from an existing system
.
.Pp
Using the bootloader you can boot the kernel located in:
.Pp
.Dl Pa \*M/binary/kernel/netbsd-INSTALL.gz
.Pp
Then boot using:
.Pp
.(tag 12n -offset indent -compact
.It "All systems:"
.Ic "/netbsd-INSTALL"
.tag)
.Pp
then continue to the
.Sx Once you've booted the diskimage
section
.
.Ss2 Install via diskimage
.
The diskimage file is in
.Pp
.Dl Pa \*M/installation/diskimage/diskimage.gz .
.Pp
It is shipped compressed and is around 1620 kbytes, uncompressing to
exactly 2100 kbytes.
.Pp
To install the diskimage onto disk
.Li ace Ns Ar X
on a
.Nx*M
system, do:
.Pp
.Dl # Ic "disklabel -W /dev/race" Ns Ar X Ns Ic "c"
.Dl # Ic "gunzip -c diskimage.gz\ |\ dd of=/dev/race" Ns Ar X Ns Ic "c bs=10240"
.Pp
On
.Nx Ns /i386,
the
.Dq raw disk partition
is the
.Sq Li d
partition, so do:
.Pp
.Dl # Ic "disklabel -W /dev/rsd" Ns Ar X Ns Ic "d"
.Dl # Ic "gunzip -c diskimage.gz\ |\ dd of=/dev/rsd" Ns Ar X Ns Ic "d bs=10240"
.Pp
On
.Nx ,
be sure to use
.Ic disklabel -W
to enable writing to the label
area of the disk.
If you forget this and/or use the
.Sq block
device, the
.Ic dd
command may silently fail.
.Pp
Then boot using:
.Pp
.(tag 12n -offset indent -compact
.It "All systems:"
.Ic "/netbsd"
.tag)
.Pp
then continue to the
.Sx Once you've booted the diskimage
section.
.
.Ss2 Install via netboot install kernel
.
Booting
.Nx*M
\*V install kernel over a network requires a BOOTP
or DHCP server and a TFTP server.
(These are usually all run on the same machine.)
There are two basic stages to the boot:
.Pp
.
.(bullet
The \*M boot loader sends a BOOTP request to get its own address, the
address of the TFTP server and the file to download.
.It
It downloads the file name obtained from BOOTP, which is the install
kernel, via TFTP and then executes it.
.bullet)
.
.Pp
You will need to set up servers for BOOTP and TFTP.
.Pp
For the BOOTP server you need to specify the:
.Pp
.
.(bullet -compact
hardware type (Ethernet)
.It
hardware address (Ethernet MAC address)
.It
IP address of the client
.It
subnet mask of the client
.It
address of the TFTP server
.It
name of the kernel loaded via TFTP
.bullet)
.
.Pp
Here's an example for a
.Ul
system running
.Ic bootpd :
.(disp
myhost.mydom.com:\e
	 :ht=ethernet:ha=08002b123456:\e
	 :ip=192.168.1.2:sm=255.255.255.0:\e
	 :sa=192.168.1.1:bf=netbsd-INSTALL:\e
	 :rp=/usr/export/\*M:
.disp)
.Pp
And here's an example for a
.Ul
system running the ISC
.Ic dhcpd :
.(disp
host \*M {
	hardware ethernet 08:0:2b:12:34:56;
	fixed-address 192.168.1.2;
	option host-name "myhost.mydom.com";
	filename "netbsd-INSTALL";
	option domain-name-servers 192.168.1.1;
	option broadcast-address 255.255.255.0;
	option domain-name "my.domain";
	option root-path "/usr/export/\*M";
}
.disp)
.Pp
For the TFTP server, You will need to copy the
.Ic netbsd-INSTALL
kernel to the directory used by the TFTP server.
.Pp
Then boot using TFTP as described earlier.
.Pp
and continue to the
.Sx Once you've booted the diskimage
section.
.
.Ss2 Install via diskless boot
.
The file
.Pa \*M/installation/netboot/diskimage.tar.gz
contains a suitable set of files for installing on an NFS server to set
up a diskless root filesystem.
(It is a tar copy of the contents of an
installation ramdisk file system contained in the install kernel.)
You will need to find an NFS server, unpack the tarfile, and setup
BOOTP/dhcp service for your \*M.
Instructions for setting up an NFS server and diskless booting are on the
.Nx*M
netboot
webpage at
.Lk http://www.NetBSD.org/ports/\*M/netboot.html
.Pp
Since the system install utility,
.Ic sysinst ,
requires a read/write root,
installing via diskless boot is only feasible if your NFS server exports
the diskless root read-write.
If this is not possible, you should
install via other of the other installation procedures.
.Pp
Once you have booted the kernel, continue to the
.Sx Once you've booted the diskimage
section.
.
.Ss2 Once you've booted the diskimage
.
Once you've booted the installation kernel you will need to
select your terminal type.
Use
.Ic vt100
for a serial console with a vt100-compatible terminal emulator, such as PuTTY, or
.Ic xterm
or
.Ic xterms
for a
.Xr tip 1
or
.Xr cu 1
connection running in an
.Xr xterm 1 .
.Pp
The system will then start the
.Ic sysinst
program.
.so ../common/sysinst
