SDB:PPC: Working with the OpenFirmware (for Experts)

Şuraya atla: kullan, ara


Version: 1.0 -

The "BIOS" of nearly all PowerPC machines is OpenFirmware. OpenFirmware will initialize the hardware until the bootloader for the OS can be loaded. The OS must then initialize all hardware for further use. The devices found in OpenFirmware will be represented in a "device tree". A copy of the device tree can be found in /proc/device-tree.

The OpenFirmware itself is written in Forth, thus, programs for OpenFirmware must be written in the Forth programming language as well.

To load and run the bootloader, 3 variables are used in OF:

boot-device  this contains the path to the device that contains the bootloader
boot-file    contains the name of the boot loader file, can be empty
boot-command command to be called to boot the OS, usualy "boot" or "mac-boot"

A device path on newer machines could look like that:

/pci@f2000000/mac-io@17/ata-4@1f000/disk@0:10,\\yaboot
 On older machines no file is loaded from disk, the built-in ROM will be started:
  /AAPL,ROM
 (It might be possible to boot directly from the OpenFirmware prompt, but
 it is better to use BootX or MiBoot. Trust me ;) )
The last @ and the comma are separators. \\ represents the active System folder.
The comma is a separator between the filename of the bootloader and the device. The @          separates the device from the controller.
In this example, the file yaboot will be loaded from the active system folder on the 10th partition of the first IDE hard disk on the ATA controller.

With the OF command, "setenv boot-device", another path can be specified. But it is simpler to use the control panel's "Startup disk" or "System Disk" menu. A bootable system folder must be on the partition.

Useful commands for debugging:

printenv     shows the current contents of the variables
dev / ls     shows the device tree
devalias     shows the device aliases and the OpenFirmware pathnames
reset-all    restart the machine
shut-down    power off the machine

These aliases simplify the access to often used devices: hd, or ultra0, is the first IDE hard drive ultra1 is the second hard drive cd is the CD-ROM device

Not every alias points to a existing device. <keyword>ppc,powerpc,apple,ibm,firmware,openfirmware,mac,macintosh</keyword>