install revision 1.9
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. If your Sparcstation
5is hooked up in a network you can find find a server and arrange for a
6diskless setup which is a convenient way to install on a machine with
7a single disk attached. Alternatively, you could use SunOS (booted from
8a local disk) and install NetBSD onto a second disk. For the latter method,
9skip to the section "Installing from SunOS" below.
10
11
12Installing using a diskless setup.
13
14First, you must setup a diskless client configuration on a server. If
15you are using a NetBSD system as the boot-server, have a look at the
16diskless(8) manual page for guidelines on how to proceed with this.
17If the server runs another operating system, you'll have to consult
18documentation that came with it (on SunOS systems, add_client(8) is a
19good start).
20
21Your Sparcstation expects to be able to download a second stage bootstrap
22program via TFTP after havinf acquired its IP address through RevARP when
23instructed to boot "over the net". It will look for a filename composed of
24the machine's IP address followed by the machine's architecture, separated
25by a period. For example, a sun4c machine which has been assigned IP
26address 130.115.144.11, will make an TFTP request for `8273900B.SUN4C'.
27Normally, this file is symbolic link to an appropriate second-stage
28boot program, which should be located in a place where the TFTP daemon
29can find it (remember, many TFTP daemons run in a chroot'ed environment).
30You can find the boot program in `/usr/mdec/boot' in the NetBSD/sparc
31distribution. Unfortunately, it is necessary to install this file
32differently for sun4 and sun4c clients: the sun4 version needs to have its
33`a.out' header stripped off (otherwise the machine will crash), while the
34sun4c version must retain it (otherwise the PROM will complain).
35
36Here's an example to illustrate this whole mess:
37
38    server# cd /<client-root-dir>/usr/mdec
39    if client is a sun4:
40	server# set SKIP=1
41	server# set KARCH=SUN4
42    else
43	server# set SKIP=0
44	server# set KARCH=SUN4C
45    server# dd if=boot of=/tftpboot/boot.sparc.netbsd.$KARCH skip=$SKIP bs=32
46    server# cd /tftpboot
47    server# ln -s boot.sparc.netbsd.$KARCH 8273900B.$KARCH
48
49Note: some versions of Openboot ROMs (sun4c) seem to require that the
50boot program size is nicely rounded. Therefore it may be necessary to
51strip(8) off the symbol table.
52
53
54As noted above in the section `Preparing your System for NetBSD Installation',
55you have several options when choosing a location to store the installation
56filesets. However, the easiest way is to put the *.tar.gz files you want
57to install into the root directory for your client on the server.
58
59Next, unpack `base.tar.gz' and `etc.tar.gz' on the server in the root 
60directory for your machine. If you elect to use a separately NFS-mounted
61filesystem for `/usr' with your diskless setup, make sure the "./usr" base
62files in base.tar.gz end up in the correct location. One way to do this is
63to temporarily use a loopback mount on the server, re-routing <root>/usr to
64your server's exported NetBSD "/usr" directory. Also put the kernel and the
65install/upgrade scripts into the root directory.
66
67A few configuration files need to be edited:
68
69	<root>/etc/hosts
70		Add the IP addresses of both server and client.
71
72	<root>/etc/myname
73		This files contains the client's hostname; use the same
74		name as in <root>/etc/hosts.
75
76	<root>/etc/fstab
77		Enter the entries for the remotely mounted filesystems.
78		For example:
79			server:/export/root/client       /     nfs  rw 0 0
80			server:/export/exec/sun4.netbsd  /usr  nfs  rw 0 0
81
82Now you must populate the the `/dev' directory for your client. If you server
83runs SunOS 4.x, you can simply change your working directory to `<root>/dev'
84and run the MAKEDEV script: `sh MAKEDEV all'.
85
86On SunOS 5.x systems, MAKEDEV can also be used, but there'll be error
87messages about unknown user and groups. These errors are inconsequential
88for the purpose of installing NetBSD. However, you may want to correct them
89if you plan to the diskless setup regularly. In that case, you may re-run
90MAKEDEV on your NetBSD machine once it has booted.
91
92Boot your workstation from the server by entering the appropriate `boot'
93command at the monitor prompt. Depending on the PROM version in your machine,
94this command takes one of the following forms:
95
96	> b le()netbsd -s		# for sun4 monitors
97	ok boot le()netbsd -s		# for version 1 OpenBOOT ROMs
98	ok boot net netbsd -s		# for version 2 OpenBOOT ROMs
99
100This will boot the NetBSD kernel in single-user mode.
101
102[[
103NOTE: the latter two examples assume you operate the OpenBOOT ROM in
104"new command mode". If your machine comes up and gives you a `>' prompt
105instead of `ok', type:
106
107    >n					# enter native OpenBOOT mode
108    ok setenv sunmon-compat? false	# make it permanent
109    ok
110]]
111
112If you use a diskless setup with a separately NFS-mounted /usr filesystem,
113mount /usr by hand now:
114
115netbsd# mount /usr
116
117At this point, it's worth checking the disk label and partition sizes on
118the disk you want to install NetBSD onto. NetBSD understands SunOS-style
119disklabels, so if your disk was previously used by SunOS there will be
120a usable label on it. Use `disklabel -e <disk>' (where <disk> is the
121device name assigned by the NetBSD kernel, e.g. `sd0') to view and
122modify the partition sizes. A comfortable size for the root filesystem
123partition is about 20MB; a good initial size for the swap partition is
124twice the amount of physical memory in your machine (though, unlike
125SunOS 4.x, there are no restrictions on the size of the swap partition
126that would render part of your memory unusable). A full binary installation
127takes about 60MB in `/usr'. Make all your partitions start and end on
128cylinder boundaries.
129
130NOTE: if you are installing on a SCSI disk that does *not* have a SunOS
131or NetBSD label on it, you may still be able to use disklabel(8) but you'll
132have to create all partitions from scratch. If your disk is listed in
133`/etc/disktab', you may use the entry (which in most cases only defines
134a `c' partition to describe the whole disk) to put an initial label on
135the disk.
136
137Here follows an example of what you'll see while in the dislabel editor.
138Do not touch any of the parameters except for the `label: ' entry and
139the actual partition size information at the bottom (the lines starting
140with `a:', `b:', ...).
141
142The size and offset fields are given in sector units. Be sure to make
143these numbers multiples of the of the number of sectors per cylinder:
144the kernel might be picky about these things, but aside from this you'll
145have the least chance of wasting disk space.
146Partitions on which you intend to have a a mountable filesystem, should
147be given fstype `4.2BSD'. Remember, the `c' partition should describe
148the whole disk.
149The `(Cyl. x - y)' info that appears after the hash (`#') character is
150treated as a comment and need not be filled in when altering partitions.
151
152Special note: the line containing `8 partitions:' is best left alone,
153even if you define less then eight partitions. If this line displays
154a different number and the program complains about it (after you leave
155the editor), then try setting it to `8 partitions:'.
156
157
158<BEGIN SAMPLE DISKLABEL SCREEN>
159netbsd# disklabel sd2
160 # /dev/rsd2c:
161type: SCSI 
162disk: SCSI disk
163label: Hold Your Breath
164flags:
165bytes/sector: 512
166sectors/track: 64
167tracks/cylinder: 7  
168sectors/cylinder: 448
169cylinders: 1429
170rpm: 3600
171interleave: 1
172trackskew: 0
173cylinderskew: 0
174headswitch: 0           # milliseconds
175track-to-track seek: 0  # milliseconds
176drivedata: 0
177
1788 partitions:
179#        size   offset    fstype   [fsize bsize   cpg]
180  a:    50176        0    4.2BSD        0     0     0   # (Cyl.    0 - 111)
181  b:    64512    50176      swap                        # (Cyl.  112 - 255)
182  c:   640192        0   unknown                        # (Cyl.    0 - 1428)
183  d:   525504   114688    4.2BSD        0     0     0   # (Cyl.  256 - 1428)
184<END SAMPLE DISKLABEL SCREEN>
185
186
187If you are upgrading a NetBSD installation, start the upgrade script:
188
189netbsd# sh upgrade.sh
190
191else, start the installation script:
192
193netbsd# sh install.sh
194
195
196These scripts will do most of the work of transferring the system from the
197tar files onto your disk. You will frequently be asked for confirmation
198before the script proceeds with each phase of the installation process.
199Occasionally, you'll have to provide a piece of information such as the
200name of the disk you want to install on or IP addresses and domain names
201you want to assign. If your system has more than one disk, you may want
202to look at the output of the dmesg(8) command to see how your disks
203have been identified by the kernel.
204
205The installation script goes through the following phases:
206
207	- determination of the disk to install NetBSD on
208	- checking of the partition information on the disk
209	- creating and mounting the NetBSD filesystems
210	- setup of IP configuration
211	- extraction of the distribution tar files
212	- installation of boot programs
213
214
215Now try a reboot.  (If needed, swap your scsi id's first).  Initially
216I'd suggest you "boot sd()netbsd -bs", then try multiuser after that.
217if you boot single-user the NetBSD incantation to make the root
218filesystem writable is
219
220    netbsd# mount -u /dev/sd0a /
221
222The Sun monitor normally tries to load a file called "vmunix". On
223OpenBOOT ROM systems you can change it to load NetBSD instead using
224the following commands:
225
226On version 1 OpenBOOT ROMs:
227    >n
228    ok setenv boot-from sd(0,0,0)netbsd
229    ok
230
231On version 2 OpenBOOT ROMs:
232    ok setenv boot-file netbsd
233    ok setenv boot-device /sbus/esp/sd@0,0
234
235
236Congratulations, you have successfully installed NetBSD RELEASE.  When you
237reboot into NetBSD, you should log in as "root" at the login prompt.
238There is no initial password, but if you're using the machine in a
239networked environment, you should create yourself an account and
240protect it and the "root" account with good passwords.
241
242Some of the files in the NetBSD RELEASE distribution might need to be
243tailored for your site.  In particular, the /etc/sendmail.cf file will
244almost definitely need to be adjusted, and other files in /etc will
245probably need to be modified.  If you are unfamiliar with UN*X-like
246system administration, it's recommended that you buy a book that
247discusses it.
248
249
250
251Installing from SunOS.
252
253You need a SunOS machine to install NetBSD.  You also need at
254least the following pieces:
255
256    the *.tar.gz files you want to install (as a minimum, base.tar.gz)
257    gzip (GNU gzip) SunOS binary
258    gtar (GNU tar) SunOS binary
259    the "install.sh" script
260    a "/boot" file from a SunOS machine that matches your machine type
261	(e.g. sun or sun4c)
262    a kernel, most likely "/netbsd"
263
264All these pieces, except "/boot", are supplied in the NetBSD/sparc
265distribution.
266
267You need to format and partition the disk using SunOS (since
268NetBSD/sparc uses SunOS disk labels.)  Give yourself adequate
269partition sizes.  Here is an example layout:
270
271    partition    size   offset	  will be..
272    sd2a        28140        0	  /
273    sd2b        16170    28140	  swap
274    sd2c       204540        0	  `whole disk'
275    sd2g       160230    44310	  /usr
276
277BTW, These are not recommended sizes.  They simply match the first
278(tiny) disk that NetBSD/sparc ran on.
279
280Use SunOS to newfs the partitions which will have filesystems on them.
281(NetBSD's filesystem format is identical to SunOS).
282
283    sunos# newfs /dev/rsd2a
284    [... lots of output]
285    sunos# newfs /dev/rsd2g
286    [... lots of output]
287
288NOTE: If you are able to, there is a performance benefit from
289newfs'ing using NetBSD.  If you newfs using the NetBSD newfs command,
290be sure to use the -O flag for your / partition, so that newfs will
291use the 4.3BSD filesystem format, rather than the new 4.4BSD filesystem
292format.  If you forget, you will not be able to boot -- the SunOS boot
293blocks do not understand the extended 4.4BSD filesystem format.
294
295Mount those partitions in a tree formation, under /mnt; ie:
296
297    sunos# df
298    Filesystem            kbytes    used   avail capacity  Mounted on
299    [...]
300    /dev/sd2a              11501       0   11501     0%    /mnt
301    /dev/sd2g             179529       0  179529     0%    /mnt/usr
302
303Place a standard SunOS "/boot" program in /mnt (your new root
304partition), and use the SunOS command "installboot" to make it work.
305The installboot man page says to do something like this:
306
307    sunos# cp /boot /mnt/boot
308    sunos# /usr/mdec/installboot -vlt /mnt/boot /usr/mdec/bootsd /dev/rsd2a
309
310You can now extract the provided "*.tar.gz files onto your disk.  The
311provided script, "install_from_sunos.sh" will help you:
312
313    sunos# ls -FC
314    base.tar.gz      etc.tar.gz       man.tar.gz       secr.tar.gz
315    comp.tar.gz      games.tar.gz     misc.tar.gz      text.tar.gz
316    install.sh       netbsd.id3_scsi
317    sunos# ./install_from_sunos.sh
318    [...]
319
320This script NEEDS gzip and gtar (GNU gzip and GNU tar) on your
321execution path!  The tar files are in a "new format" that includes
322directory information, and SunOS tar will not read them.  Statically
323linked versions of these programs for SunOS are supplied in the
324distribution.
325
326After the files have been extracted, repair /mnt/etc/fstab to match
327your actual disk layout.  (Minus the "/mnt" component of each path, of
328course :-)
329
330Now proceed to reboot the machine as described above in "Installing
331using a diskless setup".
332