NetBSD-5.0.2/distrib/notes/sparc/prep

.\"	$NetBSD: prep,v 1.24.2.2 2009/04/25 23:16:35 snj Exp $
.
.Ss2 Configuring your PROM
.
Before you start, you should configure your PROM. There are three
categories of PROM:
.Dq sunmon
(sometimes called Restricted Prompt, sun monitor, or old command mode),
OpenBoot PROM 1, and OpenBoot PROM 2.
The sun4 machines only have sunmon. Some of the early sun4c models
default to sunmon but have OpenBoot PROM 1.
The later sun4c models and all sun4m models have OpenBoot PROM 2.
.Pp
First, you need to stop your system from automatically booting when
powered on. Pressing the
.Key STOP
key (sometimes called the
.Key L1
key, found on the left side of your keyboard) and the
.Key a
key will halt your system and give you a PROM prompt. If you are using a
Tadpole SPARCbook, you press the
.Key Pause
and
.Key a
keys. If you are using a serial console, send a
.Dq BREAK
signal from your terminal (the method of sending
.Dq BREAK
varies from terminal to terminal).
.Pp
If the ethernet address of your \*M system is
.Li ff:ff:ff:ff:ff:ff ,
then your NVRAM battery is dead and you will have trouble using
ethernet (among other problems).  Read the Sun NVRAM/Hostid FAQ.
.Lk http://www.squirrel.com/squirrel/sun-nvram-hostid.faq.html
.Pp
If you have a valid ethernet address and you plan to netboot, write down
your system's ethernet address.
.Pp
Next, you should set your system to always use the OpenBoot PROM
(sometimes called
.Dq "new command mode" )
if it defaults to sunmon. The
.Nx
kernel relies on some of the functionality provided by the OpenBoot PROM.
If your machine gives you a `\*[Gt]' prompt instead of an `ok' prompt,
type:
.Pp
.(disp
.No \*[Gt] Ic n
.No ok Ic "setenv sunmon-compat? false"
.No ok
.disp)
.Pp
Next, if you are using any security features of OpenBoot PROM, you should
turn them off \(em
.Nx
can't deal well with this.
.Pp
.(disp
.No ok Ic "setenv security-mode none"
.disp)
.Pp
If you are using a serial console, the
.Nx*M
installer defaults to using 9600 bps, 8N1 settings.  You may want to 
configure your system and serial terminal like this prior to booting the 
installer.  Additionally, a new installation of
.Nx*M
will default to these settings as well.
.Pp
The OpenBoot PROM 1 machines (SPARCstation/server 1, SPARCstation/server 1+,
IPC, and SLC) have an odd SCSI quirk you should be aware of.
There are three SCSI addressing schemes used by your
system: SCSI target ID (set by physical jumpers on the device), PROM
.Sq unit
number (set by OpenBoot PROM 1, based on its SCSI target ID), and the name
you reference within an operating system (set by the kernel, based on the PROM
.Sq unit
number).
.Pp
Sun shipped these systems with the internal drives set to SCSI target IDs
3 and 1.  The default value of the OpenBoot PROM variable
.Sq Li sd-targets
is
.Sq Li 31204567.
This variable maps how the OpenBoot PROM 1 assigns
.Sq unit
numbers based on the SCSI target ID.
Thus the device at SCSI target ID 3 is considered
.Sq unit
0, and the SCSI device at target ID 0 is
.Sq unit
3.  When you type
.Dq Ic boot scsi(0,0,0) ,
the OpenBoot PROM will boot from
.Sq unit
0 (which is SCSI target ID 3, the internal hard drive).  The
.Tn SunOS
kernel is hard-wired to map
.Li sd0
to SCSI target 3, and
.Li sd3
to SCSI target 0.
.Bl -column -offset indent PROM\ Unit# SCSI\ Target SunOS\ name
.It Em PROM\ Unit# Ta Em SCSI\ Target Ta Em SunOS\ name
.It \~\~\~0 Ta \~\~\~3 Ta \~\~\~sd0
.It \~\~\~1 Ta \~\~\~1 Ta \~\~\~sd1
.It \~\~\~2 Ta \~\~\~2 Ta \~\~\~sd2
.It \~\~\~3 Ta \~\~\~0 Ta \~\~\~sd3
.It \~\~\~4 Ta \~\~\~4 Ta \~\~\~st0
.It \~\~\~5 Ta \~\~\~5 Ta \~\~\~st1
.It \~\~\~6 Ta \~\~\~6 Ta \~\~\~cdrom
.El
.Pp
The
.Nx*M
.Li GENERIC
kernel does not wire things down as does
.Tn SunOS .
It names the disks in the order
that the SCSI targets are probed (01234567). If you only have one disk,
it is always
.Li sd0
regardless of its SCSI target ID or its PROM
.Sq unit
number, and there are no problems. If you have two disks, one at
SCSI ID 2
.Pf ( Sq unit
2) and SCSI ID 3
.Pf ( Sq unit
0), then they are recognized as
.Li sd0
and
.Li sd1
respectively. This can be a problem if you are not
aware of it, particularly when creating an fstab.
.Pp
There are two approaches to fixing this problem: changing the
mapping that OpenBoot PROM 1 does, and changing the
.Nx
kernel configuration.
To get OpenBoot PROM 1 to number the SCSI
.Sq unit
numbers the same as the SCSI target IDs, you need to run this command:
.Pp
.(disp
.No ok Ic "setenv sd-targets 01234567"
.disp)
.Pp
This may, however, cause problems if you were to later attempt to use
.Tn SunOS
on this machine or if you reset the OpenBoot PROM variables.
.Pp
The other approach is to use a
.Nx
kernel that matches the PROM's odd target mapping by treating
.Sq unit
0 (i.e. SCSI target ID 3) as
.Li sd0
and
.Sq unit
3 (i.e. SCSI target ID 0) as
.Li sd3 .
The
.Li GENERIC_SCSI3
kernel performs this target mapping, but the
.Li GENERIC
and
.Li INSTALL
kernels do not.
.Pp
.(Note
This is also a concern when you start building your own customised kernels.
.Note)
.Pp
The machines with OpenBoot PROM 2 (SPARCstation/server 2,
ELC, IPX, and all sun4m models) have a similar SCSI target mapping in the
form of a
.Ic devalias
entry.  That is, the device alias
.Ic disk
is shorthand for the disk at SCSI ID 3 on the internal SCSI controller.
Normally, the
.Ic disk
device alias is what the PROM uses as the default boot device, i.e. in the
absence of a
.Ar device
argument to the
.Ic boot
command.
Note that there are also pre-configured device alias entries for
.Ic disk0,
.Ic disk1,
.Ic disk2
and
.Ic disk3 ,
which are in fact a one-to-one mapping to the SCSI targets
.Ic 0
to
.Ic 3
.Pq all on the internal SCSI controller .
.Pp
Again, it may be advantageous to use a fixed
.Dq SCSI target
to
.Dq Nx "" disk unit
mapping in your kernel configuration file (such as is done in the
.Li GENERIC_SCSI3
kernel) to ensure that your disks remain showing up at the same
.Nx
device unit numbers even if you add disks to your system at a later time.
.
.Ss2 Determining how to access your SCSI disk from the PROM
.
sunmon and OpenBoot PROM 1 use an archaic
.Li sd( Ns Ar c,u,p Ns Ic \&)
syntax to address SCSI devices. OpenBoot PROM 2 uses a more intuitive
syntax using device aliases.
.Pp
To calculate the parameters for sunmon and OpenBoot PROM 1:
.(tag xcc -offset indent
.It Ar c
specifies the SCSI controller number (first is 0, second is 1, ...)
.It Ar u
the hexadecimal number obtained from evaluating
the expression
.Em (8 * TARGET) + LUN
.It Ar p
the partition number from which to boot
.Pf ( Sq Li 0
=
.Sq Li a ,
.Sq Li 1
=
.Sq Li b ,
etc.)
.tag)
.Pp
Therefore, to boot from the swap partition on the internal hard drive
(first SCSI bus, target 0, lun 0, partition 1), one would use:
.Pp
.(disp
.No ok Ic "boot sd(0,0,1)"
.disp)
.Pp
To boot from a CD-ROM (first SCSI bus, target 6,
lun 0, partition dynamically determined), one would use:
.Pp
.(disp
.No ok Ic "boot sd(0,30,)"
.disp)
.Pp
And, to boot from a kernel named
.Li netbsd-GENERIC
on the fourth partition
.Pf ( Sq Li d ,
often the
.Pa /usr
partition) on an external hard drive (first SCSI bus, target 2, lun 0,
partition 3), one would use:
.Pp
.(disp
.No ok Ic "boot sd(0,10,3)netbsd-GENERIC"
.disp)
.Pp
Now, for OpenBoot PROM 2, SCSI devices are specified by an OpenBOOT
.Ic devalias
which provides simple mnemonics for the full path to the device. Type
.Ic devalias
in OpenBoot PROM 2 to get a list of all of the available aliases.
Just the alias and partition are necessary when booting.
.Pp
Therefore, to boot from the swap partition on the internal hard drive
(OpenBoot PROM 2 assumes the internal hard drive is at target 3), one would
use:
.Pp
.(disp
.No ok Ic "boot disk:b"
.disp)
.Pp
To boot from a CD-ROM (OpenBoot PROM 2 assumes the CD-ROM is at target 6),
one would use:
.Pp
.(disp
.No ok Ic "boot cdrom"
.disp)
.Pp
And, to boot from a kernel named
.Li netbsd-GENERIC
on the fourth partition
.Pf ( Sq Li d ,
often the
.Pa /usr
partition) on an external hard drive (target 2, partition 3), one would use:
.Pp
.(disp
.No ok Ic "boot disk2:d netbsd-GENERIC"
.disp)
.Pp
The full device path specifier for OpenBoot PROM 2 depends on how OpenBoot
PROM 2 recognizes
your SCSI controller. Typically, one would use something like:
.Pa /sbus/esp/sd@ Ns Ar t,p
where t is the SCSI target and p is the partition number.
.
.Ss2 Determining how to boot from an SBUS card
.
Some SBUS cards have firmware that lets you use them as a boot device.
These cards do not automatically create a
.Ic devalias
entry, so you must traverse the device tree to figure out what the
OpenBoot PROM calls your card.  You will be using OpenBoot PROM commands
at the `ok' prompt. First `cd' to the top of the device tree and list the
nodes there.  The following is the procedure to boot from an HME card in a
SPARC Classic.
.(disp
.No ok Ic "cd /"
.No ok Ic "ls"
ffd3b790 TI,TMS390S10@0,f8fffffc
ffd2d254 virtual-memory@0,0
ffd2d198 memory@0,0
ffd2b65c obio
ffd2b310 iommu@0,10000000
ffd2b2a0 openprom
ffd24af0 aliases
ffd24abc options
ffd24a88 packages
.disp)
Usually, you can simply type in the name before the at (@) sign and the
OpenBoot PROM will fill in the rest.
.(disp
.No ok Ic "cd iommu"
.No ok Ic "ls"
ffd2b454 sbus@0,10001000
.No ok Ic "cd sbus"
.No ok Ic "ls"
ffd467e8 cgthree@3,0
ffd42a1c SUNW,hme@1,8c00000
ffd4297c le@0,c00000
ffd40d28 ledma@4,8400010
ffd40c9c SUNW,bpp@4,c800000
ffd40c00 audio@4,1300000
ffd3dc68 espdma@4,8400000
.No ok Ic "cd SUNW,hme"
.No ok Ic "ls"
.No ok Ic "pwd"
/iommu@0,10000000/sbus@0,10001000/SUNW,hme@1,8c00000
.disp)
OK, now we know the path to the HME device in this example.  Now, we need
to determine if it's capable of booting.  If it is, it will have the
.Ic word
`open'.
.(disp
.No ok Ic "words"
reset         seek          load          open          close
watch-net     selftest      obp-selftest  write         read
preamble-32   enable-link-pulse           disable-link-pulse
force-speeds  reset-transceiver           use-bit-bang-mode
use-frame-mode              dump-phys     transfer-speed=10
transfer-speed=100          mii-write     mii-read
create-rev-id
.disp)
Great!
Also, in case you're interested in further details about your
hardware, you can use the `.attributes' command.
.(disp
.No ok Ic ".attributes"
hm-rev                   00000022
version                  1.18
model                    SUNW,501-2919
device_type              network
intr                     00000037  00000000
interrupts               00000004
address-bits             00000030
max-frame-size           00004000
reg                      00000001  08c00000  00000108
                         00000001  08c02000  00002000
                         00000001  08c04000  00002000
                         00000001  08c06000  00002000
                         00000001  08c07000  00000020
name                     SUNW,hme
ok
.disp)
So, when it's time to type in a boot command, use the shortened version of the
.Ic pwd
command.  In this example, you'd type:
.(disp
.No ok Ic "boot /iommu/sbus/SUNW,hme"
.disp)
And when the kernel is done booting, it may not automatically use your
card as the root device -- you may need to type in the
.Nx*M
name for
that device:
.(disp
root on sd0a dumps on sd0b
no file system for sd0 (dev 0x700)
cannot mount root, error = 79
.No "root device (default sd0a):" Ic "?"
use one of: fd0[a-h] le0 le1 hme0 sd0[a-h] halt
.No "root device (default sd0a):" Ic "hme0"
.No "dump device:" Ic "hme0"
.No "file system (default generic):" Ic "nfs"
root on hme0
.disp)
.
.Ss2 Deciding on partition sizes
.
If you're installing
.Nx*M
for the first time it's a good idea
to look at the partition sizes of disk you intend installing
.Nx*M
on.
.Pp
A minimal installation of
.Nx
requires about 100 MB.
A full installation requires considerably more.
A good initial size for the swap partition is twice the amount
of physical memory in your machine (unlike
.Tn SunOS 4.x ,
there are no restrictions on the size of the swap partition that would render
part of your memory unusable).
.Pp
Note that there are limitations on the size of the root partition for
various models.
.Pp
On sun4 machines, the
.Nx
sparc boot loader can only boot from RAID partitions that start at the
beginning of the disk.
.Pp
On sun4 and early PROM version sun4c machines, the PROM can only boot from
the first 1Gb of the disk.
.Pp
On later PROM version sun4c and early PROM version sun4m machines, the PROM
can only boot from the first 2Gb of the disk.
.Pp
On later PROM version sun4m machines, the PROM can only boot from the first
4Gb of the disk.
.
.Ss2 Configuration of network interfaces
.
Some network devices (i.e. the built-in
.Em le
interface on sun4m machines)
allow a choice between operating on a UTP or a AUI port once the
.Nx
kernel is running. The
.Em le
driver supports automatic detection of the port which is actually connected to
the wire. Additionally, some of the Fast ethernet devices (such as
.Em be ,
.Em hme ,
.Em qec ,
and
.Em qfe )
support selection of various speeds and options.
The default is to attempt to automatically detect the speed.
.Pp
If automatic detection is not available or not working properly in your
environment, you may have to specify the type connection using the
.Ic media
parameter of
.Xr ifconfig 8 .
During installation, you'll get the opportunity to specify the appropriate
medium. Use
.Li 10base5
or
.Li AUI
to select the AUI connector, or
.Li 10baseT
or
.Li UTP
to select the UTP connector.
Fast ethernet interfaces default to
.Li auto ,
which usually does not detect properly and runs at
.Sq 10BaseT
speed.
The options are
.Li 10baseT ,
.Li 10baseTX ,
and
.Li auto .
The
.Em hme
and
.Em qfe
interfaces also allow
.Li 10baseT-FDX
and
.Li 100baseT-FDX .