Open Firmware (OF)
An introduction for users
By Andrew J. Brehm (andrew@netneurotic.de),
last read September 26th 2003.
Use at your own risk.
[0] terminology
[1] fundamentals
[2] input/output
[3] booting
[4] further information
Open Firmware is a standardized software for PowerPC boot ROMs. Most PCI/AGP PowerPC machines use Open Firmware.
Some information that cannot be found here, can be found at http://developer.apple.com/technotes/tn/tn1061.html hopefully.
Note that all the information below is to my knowledge correct but
might not apply to newer models, most probably including the Power Mac
G5 and very new eMacs and iMacs. I do not know what changes to OF were
made by Apple to avoid the booting of Mac OS 9 on newer Macs.
Examples of Open Firmware machines:
Examples of machines that do NOT use Open Firmware:
Chances are when you have a PowerPC machine you have an Open Firmware
machine.
TERMINOLOGY
alt (the "alt" or "option" key)
meta (the "meta" or "command" or "Apple" key)
ctrl (the "control" or "strg" key)
esc (the "escape" key)
OF (Open Firmware)
OF console (Open Firmware console)
console (Open Firmware console or UNIX console)
Darwin (Apple's Darwin OS or MacOS X)
GNU (usually Linux)
alt+meta ("alt" and "meta" key pressed simultaneously)
alt+alt (also "alt" and "meta" key pressed simultaneously)
OF variable (a variable the value of which is stored in nvram)
nvram (the battery-powered non-volatile RAM of the machine)
PReP (PowerPC Reference Platform, an older type of IBM PowerPC
machines)
CHRP (Common Hardware Reference Platform, a newer type of IBM PowerPC
machines)
Old World (non-colorful Apple PowerMacs and clones)
New World (colorful Apple PowerMacs, like iMac or PowerMac G4, and any
newer Apple machine)
nwo (New World Order)
CHAPTER I - accessing open firmware and other fundamentals
There are three methods to access OF (assuming that it is configured to use keyboard and screen).
And there are four methods to configure OF (and change the values of
OF variables).
I assume IBM's AIX has an equivalent command, but I do not have access
to an AIX machine to test it. In most cases one of the three methods
above
will do. You will have to be root to use these commands (under Darwin
or
GNU).
And there is a way to reset all OF variables to default values (which usually make a lot more sense than experimental values that one wants to get rid of):
--> Press alt+alt+r+p during the boot chime (and the machine
should work again)
The commands setenv, nvsetenv, and nvram should work this way (VAR is the OF variable, VALUE is what you set it to):
Remember to put quotes ("") around a variable or value that consists of
weird string (aka a string made of several words or something alike).
(There is also a command "printenv" which lists all variables and
their current values.)
CHAPTER II - nvram variables in general, auto-boot?, input-device, output-device
There are many OF variables, but the most interesting ones are these:
In order to access the OF console and be able to see it and type something meaningful, input-device and output-device must be set to something useful (on many machines it is by default, on some it is not).
In order to boot an operating system boot-device should be set to something meaningful. By default it is set to "boot the first OS you find" on many machines, which is fine.
In order to access the OF console input-device and output-device should be set to something meaningful.
New World machines are usually configured correctly. Old World machines might have to be configured.
Under a Darwin or GNU console enter either (under Darwin, as root)
nvram input-device=kbd
or (under GNU, as root)
nvsetenv input-device kbd
This should almost always work. (It does require the alias "kbd" to be set to the correct path to the keyboard, which it usually is.)
It is a bit more complicated for the output device though.
On my UMAX Pulsar 2330 (S900), with an ATI Mach64 PCI graphics adapter, the value for output-device should be set to "/bandit/ATY,XCLAIMVR". For some machines "/chaos/control" might work, or so I have heard. I have never tried.
Thus, enter this (under Darwin, as root)
nvram output-device="/bandit/ATY,XCLAIMVR"
or (under GNU, as root)
nvsetenv output-device "/bandit/ATY,XCLAIMVR"
(You might as well always put quotes around the values to prevent accidents.)
Sometimes
nvram output-device=screen
or
nvsetenv output-device screen
might also work. (It does require the alias "screen" to be set correctly though, which it might be.)
And as I mentioned above
nvram output-device="/chaos/control"
or
nvsetenv output-device "/chaos/control"
might indeed also work.
SUMMARY
Chapter III - booting the machine, boot-device, the boot manager
When nvram is reset to its default values, the variable boot-device usually contains the value of the default boot device.
What exactly the default boot device is depends on the model of the machine.
There are five distinct methods to boot a (PCI-based CHRP) PowerPC machine:
1. PreP bootstrap partition
The operating system installer will (hopefully) install and configure a boot loader (or a kernel) on that partition which will then automatically be booted by OF (default settings).
2. Macintosh ROM
Old World machines have a Macintosh ROM which bears the device name "AAPL,ROM". This is also the default setting for booting Old World machines.
3. Binary boot loader
This is a file located on a file system. In order to boot it OF must know the path to that file. An Open Firmware path to a file looks rather weird:
mac-io/ata-4@1f000/@0:13,\\:tbxi
(This is the current value of boot-device on my machine.)
ultra0:13,\\:tbxi
(This is what I set it to. "ultra0" is an alias for the long bit above.)
ultra0:13,\System\Library\CoreServices\BootX
(This is the real path to the boot loader of MacOS X.)
This seems a bit tricky at first, but it is really fairly simple after one got into what all this is supposed to mean.
Basically, the path to a boot loader is
[device]:[partition],[path][filename]
where
[device] is (generally) a disk (see below),
[partition] is a partition number,
[path] is a directory (using \ as seperator instead of /), and
[filename] is either a filename ("BootX") or ":tbxi" (see below).
Disks have funny names, including (and I make no distinction between real names and aliases):
scsi-int/sd@0 (first SCSI disk connected to internal SCSI controller)
scsi-int/sd@1 (second SCSI disk connected to internal SCSI controller)
ultra0 (first IDE disk in a Power Mac G4)
hd (some disk, usually works for IDE machines)
cd (CD-ROM or DVD-ROM)
The partition number is the same partition number that is displayd by pdisk. Partition number 0 is the master boot record.
There is one special folder called "system folder" which, instead of its long name, can be accessed simply by using \\ as an alias. Thus "\System\Library\CoreServices\" is equivalent to "\\".
The name of the boot loader is either a normal file name (like BootX or Yaboot) or the alias ":tbxi" which stands for "the file of the type tbxi in that folder", which is usually the boot loader or a CHRP script.
In our example, the real path to the boot loader is
mac-io/ata-4@1f000/@0:13,\System\Library\CoreServices\BootX
And the shortest possible version, replacing all the weird stuff with aliases is
ultra0:13,\\:tbxi
The default value of boot-device on New World machines is usually
hd:,\\:tbxi
which will usually boot MacOS or MacOS X (I assume the latter).
4. CHRP script
This works like a binary boot loader.
5. Boot loader in master boot record
This works for Old World machines mostly.
You install a boot loader in the master boot record (MBR) of your disk, then point OF to it:
setenv boot-device scsi-int/sd@0:0
This assumes that the boot loader is located in the master boot record of the first SCSI disk connected to the internal SCSI controller.
(quik-1.3.1-0a.ppc.rpm is such a boot loader. Please do not attempt to use this on a New World machine. Use on an Old World machine only. I only tested it on a UMAX S900.)
SUMMARY
Chapter IV - further information, links
There is a "Boot Variables" control panel that seems to work on Old World Machines. Use at your own risk. Do not use on New World machines. Prefer the other methods anyway. Use MacZip to unpack. Download from my iDisk ("ajbrehm") if you cannot unpack the ZIP file. Read the README file that comes with the Control Panel. Don't blame me if something goes wrong.
For Old World machines the Quik boot loader (download Quik) mentioned above works fine.
For New World or CHRP machines YaBoot should work. There is also this document about using Yaboot. SuSE Linux comes with a modified version of Yaboot (they changed the name to match the x86 release).
The Apple
document mentioned at the top is also very helpful.