Open Firmware: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Clarified what you need to be careful with, added blurb about built-in development environment, removed references to OpenBIOS which is no longer being developed.)
(Added discussion about when to (and not to) break from the OS into Forth.)
Line 36: Line 36:
There are two ways to get to OFW on an XO, at boot time and from Sugar.
There are two ways to get to OFW on an XO, at boot time and from Sugar.


* At boot time, press and hold the Escape key (top left on the XO keyboard, with a white X in a black circle). In a few seconds, the FORTH ok prompt appears, along with a hint on help.
* At boot time, type the Escape key (top left on the XO keyboard, with a white X in a black circle) when you hear the startup jingle. In a few seconds, the FORTH ok prompt appears, along with a hint on help.
* In the Terminal activity, execute the command
* In the Terminal activity, execute the command


echo y > /proc/sysrq-trigger
echo y > /proc/sysrq-trigger

The former method (ESC at startup) is greatly preferred for routine Forth use and experimentation. The latter method (breaking out of Sugar/Linux) is particularly useful for debugging OS problems in which you need to inspect the detailed state of hardware devices after the OS has been running, but is not recommended for casual use, due to its potential for confusing the OS.


See [[FORTH]] for a brief introduction to the FORTH programming language, which Open Firmware is written in, plus links to other resources. See [[Forth Lessons]] for lessons specifically tuned to Open Firmware on the XO.
See [[FORTH]] for a brief introduction to the FORTH programming language, which Open Firmware is written in, plus links to other resources. See [[Forth Lessons]] for lessons specifically tuned to Open Firmware on the XO.

Revision as of 00:16, 17 January 2010

Open Firmware is the hardware-independent firmware (computer software which loads the operating system) that the XO-1 runs.

It was developed by Mitch Bradley at Sun Microsystems, and used in post-NuBus PowerPC-based Apple Macintosh computers (though it has been dropped with Apple's transition to Intel processors), Sun Microsystems SPARC based workstations and servers, IBM POWER systems, and PegasosPPC systems, among others. On those computers, Open Firmware fulfills the same tasks as BIOS does on PC computers.

For example Fedora and Debian use the YaBoot BootLoader for OpenFirmware.

The Open Firmware user interface includes a FORTH-based shell interface. FORTH is a powerful high level language that is remarkably compact. A complete Forth development environment including compiler, decompiler, assembler, disassembler, source level debugger, and assembly language debugger is present in the XO boot ROM (SPI FLASH). With the Open Firmware Forth system, you can directly access all of the hardware devices on the XO, use built-in functions like selftest diagnostics and games, and even write complete applications, without needing any external tools. The bulk of Open Firmware is written in Forth, so the source level debugger can be used to debug Open Firmware itself.

Source Code

The source code for the firmware used in the XO-1 is available in the OpenFirmware subversion repository. To find the software used in a given OLPC release, look on the Firmware page to find the release, then look on the release page for the "svn" revision number. E.g. for OLPC Firmware q2d07 the revision number is 775. You can browse the Subversion repository and view or download the code (actual repository is at svn://openbios.org/openfirmware/).

Replacing BIOS in the XO - a historical overview -

Inside was a development BIOS and bootloader used for a very short time until we were able to bootstrap our own. At that point, we moved to LinuxBIOS for both low-level hardware initializer and bootloader, which was less than ideal and somewhat unwieldy. In a surprise move, SUNW then opened up their parts of the OFW/OBP code under a BSD license, which allowed Mitch Bradley (who was working for OLPC) to open up his own parts -- that of his company, FirmWorks -- and let us have an acceptably-licensed OpenFirmware we can use as a fancy and compact bootloader. LinuxBIOS did low-level hardware initialization, transfered control to OFW, which then also acting as boot loader to load Linux OS.

Since the "c" series of firmware releases starting on April 6, 2007, LinuxBIOS has not been present at all. The low-level init is now done with a few lines of assembly language code and a big table of register values.

Removing LinuxBIOS was what made it possible to get the startup time down to a couple of seconds, and to do the firmware part of resume in a few milliseconds.

source Questions on LinuxBIOS and OpenFirmware

Activating Open Firmware on an XO

There are two ways to get to OFW on an XO, at boot time and from Sugar.

  • At boot time, type the Escape key (top left on the XO keyboard, with a white X in a black circle) when you hear the startup jingle. In a few seconds, the FORTH ok prompt appears, along with a hint on help.
  • In the Terminal activity, execute the command
echo y > /proc/sysrq-trigger

The former method (ESC at startup) is greatly preferred for routine Forth use and experimentation. The latter method (breaking out of Sugar/Linux) is particularly useful for debugging OS problems in which you need to inspect the detailed state of hardware devices after the OS has been running, but is not recommended for casual use, due to its potential for confusing the OS.

See FORTH for a brief introduction to the FORTH programming language, which Open Firmware is written in, plus links to other resources. See Forth Lessons for lessons specifically tuned to Open Firmware on the XO.

The only commands that you need to be careful with when playing with Open Firmware on XO are "flash" and commands ending with "-tag". The "flash" command overwrites the Open Firmware image; it is safe to use with officially-released OLPC Open Firmware images. The "*-tag" commands modify the Manufacturing_Data that identifies the system; use them only if you know what you are doing.

See also

External links