install revision 1.12
1Installing NetBSD is a relatively complex process, but if you have
2this document in hand it shouldn't be too much trouble.
3
4There are several ways to install NetBSD onto a disk. The easiest way
5in terms of preliminary setup is to use the NetBSD miniroot that can
6be booted off your local disk's swap partition. Alternatively, if your
7Sparcstation is hooked up in a network you can find a server and arrange
8for a diskless setup which is a convenient way to install on a machine
9whose disk does not currently hold a usable operating system (see the
10section `Installing using a diskless setup' below).
11
12
13Installing using the NetBSD miniroot.
14
15The miniroot is a self-contained NetBSD filesystem holding all utilities
16necessary to install NetBSD on a local disk. It is distributed as a plain
17file designed to be transferred to a raw disk partition from which it can
18be booted using the appropriate PROM command. Usually, the miniroot will
19be loaded into the swap partition of a disk. If needed, you can use any
20other unused partition, but remember that the partition will then not
21available during the installation process.
22
23Loading the miniroot onto your raw partition is simple. On NetBSD as well
24as SunOS you use a command like:
25
26	# dd if=miniroot-RELEASE.fs of=/dev/rsd0b bs=20b conv=sync
27
28(here `/dev/rsd0b' is assumed to be your swap partition). There's a
29potential problem here if /dev/rsd0b is actually in use as a swap
30partition by your currently running system. If you don't have another
31disk or partition to spare, you can usually get away with running this
32command anyway after first booting into single-user mode to ensure a
33quiet system.
34
35After transferring the miniroot to disk, bring the system down by:
36
37	# halt
38
39Then boot the miniroot by typing the appropriate command at the PROM:
40
41	> b sd(,,1)netbsd -s			# for sun4 monitors
42	ok boot sd(,,1)netbsd -s		# for version 1 OpenBOOT ROMs
43	ok boot disk:b netbsd -s		# for version 2 OpenBOOT ROMs
44
45If you've loaded the miniroot onto some other disk than `sd0' adapt
46the boot specifier accordingly, e.g.:
47
48	ok boot disk1:b netbsd -s
49
50to boot from SCSI disk target 1 from a version 2 OpenBOOT ROM.
51If you have to use the old-style `sd(c,u,p)' syntax to boot from a
52SCSI disk, you can calculate the parameters as follows:
53
54	`c'	- specifies the controller number
55	`u'	- the hexadecimal number obtained from evaluating
56		  the expression `(8 * TARGET) + LUN'
57	`p'	- the partition number from which to boot (0=`a', 1=`b', etc).
58
59
60The monitor boot command will cause the NetBSD kernel contained in the
61miniroot image to be booted. After the initial probe messages you'll be
62asked to start the install or upgrade procedure. Proceed to the section
63`Running the installation scripts' below.
64
65Installing using a diskless setup.
66
67First, you must setup a diskless client configuration on a server. If
68you are using a NetBSD system as the boot-server, have a look at the
69diskless(8) manual page for guidelines on how to proceed with this.
70If the server runs another operating system, you'll have to consult
71documentation that came with it (on SunOS systems, add_client(8) is a
72good start).
73
74Your Sparcstation expects to be able to download a second stage bootstrap
75program via TFTP after having acquired its IP address through RevARP when
76instructed to boot "over the net". It will look for a filename composed of
77the machine's IP address followed by the machine's architecture, separated
78by a period. For example, a sun4c machine which has been assigned IP
79address 130.115.144.11, will make an TFTP request for `8273900B.SUN4C'.
80Normally, this file is a symbolic link to an appropriate second-stage
81boot program, which should be located in a place where the TFTP daemon
82can find it (remember, many TFTP daemons run in a chroot'ed environment).
83You can find the boot program in `/usr/mdec/boot' in the NetBSD/sparc
84distribution. Unfortunately, it is necessary to install this file
85differently for sun4 and sun4c clients: the sun4 version needs to have its
86`a.out' header stripped off (otherwise the machine will crash), while the
87sun4c version must retain it (otherwise the PROM will complain).
88
89Here's an example to illustrate this whole mess:
90
91    server# cd /<client-root-dir>/usr/mdec
92    if client is a sun4:
93	server# set SKIP=1
94	server# set KARCH=SUN4
95    else
96	server# set SKIP=0
97	server# set KARCH=SUN4C
98    server# dd if=boot of=/tftpboot/boot.sparc.netbsd.$KARCH skip=$SKIP bs=32
99    server# cd /tftpboot
100    server# ln -s boot.sparc.netbsd.$KARCH 8273900B.$KARCH
101
102Note: some versions of Openboot ROMs (sun4c/sun4m) seem to require that the
103boot program size is nicely rounded. Therefore it may be necessary to
104strip(8) off the symbol table.
105
106After the boot program has been loaded into memory and given control by
107the PROM, it starts locating the machine's remote root directory through
108the BOOTPARAM protocol. First a BOOTPARAM WHOAMI request is broadcast
109on the local net. The answer to this request (if it comes in) contains
110the client's name. This name is used in next step, a BOOTPARAM GETFILE
111request -- sent to the server that responded to the WHOAMI request --
112requesting the name and address of the machine that will serve the client's
113root directory, as well as the path of the client's root on that server.
114
115Finally, this information (if it comes in) is used to issue a REMOTE MOUNT
116request to the client's root filesystem server, asking for an NFS file
117handle corresponding to the root filesystem. If successful, the boot
118program starts reading from the remote root filesystem in search of the
119kernel which is then read into memory.
120
121
122As noted above in the section `Preparing your System for NetBSD Installation',
123you have several options when choosing a location to store the installation
124filesets. However, the easiest way is to put the *.tar.gz files you want
125to install into the root directory for your client on the server.
126
127Next, unpack `base.tar.gz' and `etc.tar.gz' on the server in the root 
128directory for your machine. If you elect to use a separately NFS-mounted
129filesystem for `/usr' with your diskless setup, make sure the "./usr" base
130files in base.tar.gz end up in the correct location. One way to do this is
131to temporarily use a loopback mount on the server, re-routing <root>/usr to
132your server's exported NetBSD "/usr" directory. Also put the kernel and the
133install/upgrade scripts into the root directory.
134
135A few configuration files need to be edited:
136
137	<root>/etc/hosts
138		Add the IP addresses of both server and client.
139
140	<root>/etc/myname
141		This files contains the client's hostname; use the same
142		name as in <root>/etc/hosts.
143
144	<root>/etc/fstab
145		Enter the entries for the remotely mounted filesystems.
146		For example:
147			server:/export/root/client       /     nfs  rw 0 0
148			server:/export/exec/sun4.netbsd  /usr  nfs  rw 0 0
149
150Now you must populate the the `/dev' directory for your client. If you server
151runs SunOS 4.x, you can simply change your working directory to `<root>/dev'
152and run the MAKEDEV script: `sh MAKEDEV all'.
153
154On SunOS 5.x systems, MAKEDEV can also be used, but there'll be error
155messages about unknown user and groups. These errors are inconsequential
156for the purpose of installing NetBSD. However, you may want to correct them
157if you plan to use the diskless setup regularly. In that case, you may re-run
158MAKEDEV on your NetBSD machine once it has booted.
159
160Boot your workstation from the server by entering the appropriate `boot'
161command at the monitor prompt. Depending on the PROM version in your machine,
162this command takes one of the following forms:
163
164	> b le()netbsd -s		# for sun4 monitors
165	ok boot le()netbsd -s		# for version 1 OpenBOOT ROMs
166	ok boot net netbsd -s		# for version 2 OpenBOOT ROMs
167
168This will boot the NetBSD kernel in single-user mode.
169
170[[
171NOTE: the latter two examples assume you operate the OpenBOOT ROM in
172"new command mode". If your machine comes up and gives you a `>' prompt
173instead of `ok', type:
174
175    >n					# enter native OpenBOOT mode
176    ok setenv sunmon-compat? false	# make it permanent
177    ok
178]]
179
180If you use a diskless setup with a separately NFS-mounted /usr filesystem,
181mount /usr by hand now:
182
183netbsd# mount /usr
184
185At this point, it's worth checking the disk label and partition sizes on
186the disk you want to install NetBSD onto. NetBSD understands SunOS-style
187disklabels, so if your disk was previously used by SunOS there will be
188a usable label on it. Use `disklabel -e <disk>' (where <disk> is the
189device name assigned by the NetBSD kernel, e.g. `sd0') to view and
190modify the partition sizes. See the section `Preparing your System for
191NetBSD Installation' above for suggestions about disk partition sizes.
192Make sure all your partitions start and end on cylinder boundaries.
193
194NOTE: if you are installing on a SCSI disk that does *not* have a SunOS
195or NetBSD label on it, you may still be able to use disklabel(8) but you'll
196have to create all partitions from scratch. If your disk is listed in
197`/etc/disktab', you may use the entry (which in most cases only defines
198a `c' partition to describe the whole disk) to put an initial label on
199the disk.  DO NOT USE `disklabel -r ...' TO INITIALIZE YOUR DISK LABEL;
200THIS WILL LEAD TO UNPREDICTABLE RESULTS. This deficiency will be fixed
201in a next release.
202
203Here follows an example of what you'll see while in the dislabel editor.
204Do not touch any of the parameters except for the `label: ' entry and
205the actual partition size information at the bottom (the lines starting
206with `a:', `b:', ...).
207
208The size and offset fields are given in sector units. Be sure to make
209these numbers multiples of the of the number of sectors per cylinder:
210the kernel might be picky about these things, but aside from this you'll
211have the least chance of wasting disk space.
212Partitions on which you intend to have a mountable filesystem, should
213be given fstype `4.2BSD'. Remember, the `c' partition should describe
214the whole disk.
215The `(Cyl. x - y)' info that appears after the hash (`#') character is
216treated as a comment and need not be filled in when altering partitions.
217
218Special note: the line containing `8 partitions:' is best left alone,
219even if you define less then eight partitions. If this line displays
220a different number and the program complains about it (after you leave
221the editor), then try setting it to `8 partitions:'.
222
223
224<BEGIN SAMPLE DISKLABEL SCREEN>
225netbsd# disklabel sd2
226 # /dev/rsd2c:
227type: SCSI 
228disk: SCSI disk
229label: Hold Your Breath
230flags:
231bytes/sector: 512
232sectors/track: 64
233tracks/cylinder: 7  
234sectors/cylinder: 448
235cylinders: 1429
236rpm: 3600
237interleave: 1
238trackskew: 0
239cylinderskew: 0
240headswitch: 0           # milliseconds
241track-to-track seek: 0  # milliseconds
242drivedata: 0
243
2448 partitions:
245#        size   offset    fstype   [fsize bsize   cpg]
246  a:    50176        0    4.2BSD        0     0     0   # (Cyl.    0 - 111)
247  b:    64512    50176      swap                        # (Cyl.  112 - 255)
248  c:   640192        0   unknown                        # (Cyl.    0 - 1428)
249  d:   525504   114688    4.2BSD        0     0     0   # (Cyl.  256 - 1428)
250<END SAMPLE DISKLABEL SCREEN>
251
252
253If you are upgrading a NetBSD installation, start the upgrade script:
254
255netbsd# sh upgrade.sh
256
257else, start the installation script:
258
259netbsd# sh install.sh
260
261
262Running the installation scripts.
263
264The installation scripts will do most of the work of transferring the
265system from the distribution sets onto your disk. You will frequently be
266asked for confirmation before the script proceeds with each phase of the
267installation process.
268
269Occasionally, you'll have to provide a piece of information such as the
270name of the disk you want to install on or IP addresses and domain names
271you want to assign. If your system has more than one disk, you may want
272to look at the output of the dmesg(8) command to see how your disks
273have been identified by the kernel.
274
275The installation script goes through the following phases:
276
277	- determination of the disk to install NetBSD on
278	- checking of the partition information on the disk
279	- creating and mounting the NetBSD filesystems
280	- setup of IP configuration
281	- extraction of the distribution tar files
282	- installation of boot programs
283
284
285Now try a reboot.  Initially I'd suggest you "boot sd()netbsd -bs", then
286try multiuser after that. If you boot single-user the NetBSD incantation
287to make the root filesystem writable is
288
289    netbsd# mount -u /dev/sd0a /
290
291The Sun monitor might have been setup to instruct the boot program to load
292a file called "vmunix". On OpenBOOT ROM systems you can change it to load
293"netbsd" instead using the following commands:
294
295On version 1 OpenBOOT ROMs:
296    >n
297    ok setenv boot-from sd(0,0,0)netbsd
298    ok
299
300On version 2 OpenBOOT ROMs:
301    ok setenv boot-file netbsd
302    ok setenv boot-device /sbus/esp/sd@0,0
303
304
305Congratulations, you have successfully installed NetBSD RELEASE.  When you
306reboot into NetBSD, you should log in as "root" at the login prompt.
307There is no initial password, but if you're using the machine in a
308networked environment, you should create yourself an account and
309protect it and the "root" account with good passwords.
310
311Some of the files in the NetBSD RELEASE distribution might need to be
312tailored for your site.  In particular, the /etc/sendmail.cf file will
313almost definitely need to be adjusted, and other files in /etc will
314probably need to be modified.  If you are unfamiliar with UN*X-like
315system administration, it's recommended that you buy a book that
316discusses it.
317
318