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