Subject: installation tips [long]
To: None <port-pmax@NetBSD.ORG>
From: Arne H. Juul <arnej@pvv.unit.no>
List: port-pmax
Date: 12/30/1995 23:58:26
  Hi everybody,
I've finally got around to doing a bit work on NetBSD/pmax again.
First on my list was doing a complete reinstall on my DECstation
3100, to test the installation procedure and miniroot a bit better
than I've been doing in the past.  So, here's a (hopefully) complete
checklist for those who want to install NetBSD/pmax.
  The first person to actually use and give feedback on this checklist
will win a free beer! (You have to come to Trondheim and get it though).

  YOU NEED:

A DECstation. I've done most of my work on a 3100.

Ultrix installed on the machine.  Actually, I have DecOSF/1, but I don't
think there should be any differences because of that.  If you don't have
ultrix you will need to tell us what you've got and maybe someone can
help you, but this checklist assumes ultrix.

Two disks - one for running Ultrix, one for installing NetBSD on.

Another machine on the net where you can put the tar files and
either NFS export the disk (preferred) or make an .rhosts files for
rcp-ing.

The ultrix version of the disklabel program, from:
	ftp.unit.no:/pub/NetBSD/arch/pmax/tools/disklabel.tar.gz
The boot blocks, from:
	ftp.unit.no:/pub/NetBSD/arch/pmax/tools/rzboot  and  .../bootrz
The miniroot image, from:
	ftp.unit.no:/pub/NetBSD/arch/pmax/miniroot-1.1+tar+gzip+mount_ffs.gz
The binary files, from:
	ftp.unit.no:/pub/NetBSD/NetBSD-1.1/pmax/binary/*
	
All of these are available from ftp.netbsd.org or gregorio.stanford.edu
as well, and you can use the snapshot binaries Jonathan just made
instead of 1.1 if you want to.



   YOU DO:


-* 1 *-
   Make a disklabel (partition table) for the target disk.

   You need to know the disk geometry (well, you can cheat, but
preferably it should be the "correct" geometry).
You can run the following ultrix program:

#include <sys/devio.h>
#include <sys/ioctl.h>

main(){
  DEVGEOMST g;
  ioctl(0, DEVGETGEOM, &g);
  printf("size %d:  sec/trk %d, trk/cyl %d, cyl %d  (attr %d)\n",
         g.geom_info.dev_size,
         g.geom_info.nsectors,
         g.geom_info.ntracks,
         g.geom_info.ncylinders,
         g.geom_info.attributes);
}

   Like this:
lise1:/tmp# ./a.out < /dev/rrz1a
size 1954050:  sec/trk 71, trk/cyl 15, cyl 1928  (attr 0)

   The easiest way to use the disklabel program is to start with
a disk label for some disk and then modify it to suit.  I wanted to
install on rz2 which is really a rz25 or rz26 disk, and here's what
I ended up with:

# /dev/rrz2c:
type: SCSI
disk: rz25
label: 
flags:
bytes/sector: 512
sectors/track: 62
tracks/cylinder: 9
sectors/cylinder: 558
cylinders: 1492
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0 

4 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:    72540        0    4.2BSD     1024  8192    16   # (Cyl.    0 - 129)
  b:     5580    72540      swap                        # (Cyl.  130 - 139)
  c:   832527        0    unused     1024  8192         # (Cyl.    0 - 1491*)
  d:   754407    78120    4.2BSD     1024  8192    16   # (Cyl.  140 - 1491*)

   You can start with this. You should modify these fields:
sectors/track, tracks/cylinder, sectors/cylinder, cylinders, and all the
partitions of course.  You may also update the 'disk' field as you wish.

Here I've used a=root, b=swap, d=/usr.  You're free to use d-h for whatever
you want of course, and many people prefer to have g=/usr, but if you
know what you want you probably also understand how to get it.  Rembember
to increase from '4 partitions' to '8 partitions' in the file if you'll use
more than a-d though (this has bitten me more than once).

   Note that the sizes and offset should be whole multiples of cylinders,
like here.  I'll assume from now that you've saved your disklabel file 
as "rz2.ok" (feel free to use a more original name if you want though :-)


-* 2 *-
   Label the disk.

   Under ultrix, using the ultrix version of the 'disklabel' program.
The command should probably look like this:

./disklabel -R -r rz2 rz2.ok

[This means: -R = restore from file, -r = raw device write,
 rz2 = /dev/rrz2c = the disk,  rz2.ok = the file name with the saved label.]

It may complain that your partitions are outside the disk, the math
is wrong, or fields are missing, but hopefully this will be easy to
understand and fix.


-* 3 *-
   Write the bootblocks.
   Again under ultrix, using the ultrix version of the
'disklabel' program.  The command should probably look like this:

./disklabel -B -b ./rzboot -s ./bootrz rz2

-* 4 *-
   Make a 'swapped' label.

   Copy the label file to a new name:
cp rz2.ok rz2.swp
   And edit the new file to swap the names of the 'a' and 'd' partitions.
   Then write the new label:
./disklabel -R -r rz2 rz2.swp

   This is so we can have a temporary small root file system on the
going-to-be /usr partition.

-* 5 *-
   Write the miniroot to disk.

   You need to write this into what's now the 'a' partition but actually
starts somewhere on the middle of the disk.  You can use the offset
from the disklabel, so with the disklabel shown above that would be:

dd if=miniroot-1.1+tar+gzip+mount_ffs of=/dev/rz2c bs=512 seek=78120

-* 6 *-
   Boot the new miniroot.

   Halt ultrix then either
boot -f rz(0,2,0)netbsd
   or
boot 3/rz2/netbsd
   (or something like that, depending on your machine type).
   If this works, the rest should be easy :-)

-* 7 *-
   Make a new root file system.

   The one you've booted from now is temporary, the real one is now
named 'd' (rz2d in my case).  So,
   newfs /dev/rrz2d
   mount /dev/rz2d /a

-* 8 *-
   Transfer the files to the "real" root file system.

   I used this command:

pax -rwXvp e / /a

   This should also work:

(cd /; tar clf - .) | (cd /a; tar -xvBpf -)

   [Maybe we could drop pax from the miniroot.  What do you think?]
Afterwards do:

umount /a

-* 9 *-
   Bring the machine up in ultrix again.  There's no 'halt' on the
miniroot so... use the switch.  [Should the miniroot have halt and reboot?]

-* 10 *-
   disklabel with the non-swapped label again like in 2.

./disklabel -R -r rz2 rz2.ok
   Halt ultrix and boot NetBSD again, this time with the right (and
   much bigger) root partition.

boot -f rz(0,2,0)netbsd

-* 11 *-
   Get the right file systems.

   First mount the new root partition read-write:
mount -u /dev/rz2a /
   Then make a new /usr file system and mount that:
newfs /dev/rrz2d
mount /dev/rz2d /usr

-* 12 *-

   Get the binary files (tarballs). 1.1 has:

base.tar.gz etc.tar.gz comp.tar.gz games.tar.gz misc.tar.gz
man.tar.gz text.tar.gz

You'll need to use rcp or NFS mount to get them.  If rcp, first
make some directory (like /usr/tmp) and go there.

Anyway, you will need to configure the network:

ifconfig le0 inet 192.0.0.33 netmask 0xffffff80 
route add default 192.0.0.1

(insert the right numbers yourself). 

For NFS, you should probably mount like this:

mount -o -P 192.0.0.10:/netbsd/disk /a

(insert the correct ip address and file system of your NFS server).

[Why isn't -P (privileged port) default?  It's annoying to have to say it
 explicitly all the time.]

For rcp, you'll have to make a .rhosts file with 'my.netbsd.machine root' in,
then just rcp 192.0.0.10:/netbsd/disk/*.tar.gz /usr/tmp

-* 13 *-
   Unpack the tar files.

   I used this command:

for x in *.tar.gz; do (cd /; gzip -d | tar --unlink -xvBpf -) < $x; done

[If pax had something like --unlink we could use pax here, too.]

-* 14 *-
   You should now have a complete NetBSD installation.  Here are some
things to be aware of:
   a) /etc/fstab will need editing.  [This file as distributed should
probably be renamed /etc/fstab.rz0 ?]
   b) /usr/include -- some files are wrong in the 1.1 "binary" release.
This doesn't matter until you start compiling things of course, and then
you'll probably want to get the full sources and reinstall the includes
anyway.
   c) strip -- the included strip in the 1.1 "binary" release is GNU
strip, which doesn't cooperate with NetBSD's install program.  There's
a patch for "install" you can use, or you can use the 'elf2elf' strip
program instead.
   d) if you haven't used NetBSD before: there are lots of configuration
files in /etc (like /etc/myname, /etc/mygate, /etc/hostname.le0,
/etc/netstart, and so on) you will need to look at and probably modify.



Well, that's a first shot on an installation guide.  Hope this helps somebody!

  -  Arne H. J.