Open Firmware: Difference between revisions

From OLPC
Jump to navigation Jump to search
m (→‎External links: ''openfirmware.org'' is NOT an official website.)
No edit summary
 
(40 intermediate revisions by 17 users not shown)
Line 1: Line 1:
'''Open Firmware''' is the hardware-independent [[wikipedia:Firmware|firmware]] (computer software which loads the operating system) that the XO runs.
'''OpenFirmware''' is a hardware-independent [http://en.wikipedia.org/wiki/Firmware Firmware] (computer software which loads the operating system), 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.


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.
It is accessed by a user by a [[FORTH]]-based shell interface. [[FORTH]] is a powerful high level language.


For example Fedora and Debian use the [http://en.wikipedia.org/wiki/Yaboot YaBoot] BootLoader for OpenFirmware.
For example Fedora and Debian use the [http://en.wikipedia.org/wiki/Yaboot YaBoot] BootLoader for Open Firmware.

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 ==
== Source Code ==
The source code for the firmware used in the XO is available in the Open Firmware repository:
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 [http://openbios.org/viewvc/?root=OpenFirmware browse the Subversion repository] and view or download the code.
* [http://dev.laptop.org/git/users/quozl/openfirmware/ openfirmware]


Subversion was once used. You can browse the subversion repository:
== Replacing BIOS in the XO - an historical overview - ==
* [http://openbios.org/viewvc/?root=OpenFirmware at openbios.org], or
* [http://tracker.coreboot.org/trac/openfirmware/browser at coreboot.org].


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 revision number. E.g. for [[OLPC Firmware q2d07]] the revision number is 775.
Insyde was a development BIOS and bootloader used for a very short

To work backwards from the laptop, get the [[Ok]] prompt and type
more rom:sourceurl
and look at the revision number on the end of the line. This is especially useful on development builds, but works on stable builds as well. An M or 1 suffix means that the source was modified since the revision number.

== Replacing BIOS in the XO-1 - 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
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
to LinuxBIOS for both low-level hardware initializer and bootloader, which was
less than ideal and somewhat unwieldy. In a surprise move, SUNW then
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
opened up their parts of the OFW/OBP code under a BSD license, which
allowed Mitch Bradley (at that point working for us) to open up his
allowed Mitch Bradley (who was working for OLPC) to open up his
own parts -- that of his company, FirmWorks -- and let us have an
own parts -- that of his company, FirmWorks -- and let us have an
acceptably-licensed OpenFirmware we can use as a fancy and compact
acceptably-licensed Open Firmware we can use as a fancy and compact
bootloader. LinuxBIOS did low-level hardware initialization,
bootloader. LinuxBIOS did low-level hardware initialization,
transfered control to OFW, which then also acting as boot loader to load Linux OS.
transfered control to OFW, which then also acting as boot loader to load Linux OS.
Line 28: Line 41:
in a few milliseconds.
in a few milliseconds.


:source [http://lists.laptop.org/pipermail/devel/2007-August/thread.html#6227 Questions on LinuxBIOS and OpenFirmware]
:source [http://lists.laptop.org/pipermail/devel/2007-August/thread.html#6227 Questions on LinuxBIOS and Open Firmware]

==Accessing Open Firmware on an XO==

There are two ways to get to OFW on an [[Activation and Developer Keys | unlocked]] XO, at boot time and from Sugar.

* See [[Ok]]. At boot time, briefly type the Escape key (top left on the XO keyboard, with a white X in a black disc) when you hear the startup jingle. Do not hold it down. 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 for routine Forth use and experimentation. The latter method (breaking out of Sugar/Linux) is for debugging OS problems and to inspect the state of hardware after the OS has been running, but is not recommended, due to its potential for confusing the OS or losing unsaved data.

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.

Be careful using "flash" and commands ending with "-tag". The "flash" command overwrites the Open Firmware image; it is safe to use with officially-released [[Firmware|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.

When finished with OFW,
*turn the power off, by holding down the power button,
*type ''boot'' to start the operating system,
*type ''bye'' to restart the laptop, or
*type ''power-off'' to turn off the laptop.


== See also ==
== See also ==
* [[OFW_FAQ|OpenFirmware Frequently Asked Questions]]
* [[OFW_FAQ|Open Firmware Frequently Asked Questions]]
* [[Forth Lessons]]
* [[Forth Lessons]]
* [[Cross Compiling Open Firmware]]


== External links ==
== External links ==
* [http://code.coreboot.org/p/openfirmware/source/changes/HEAD/ Browse Subversion repository]
* [http://playground.sun.com/1275/home.html Open Firmware Working Group]: Official Open Firmware homepage hosted by Sun Microsystems, Inc.
* [http://tracker.coreboot.org/trac/openfirmware/timeline Browse Subversion repository]
* [http://www.openbios.org/Open_Firmware OpenBIOS project]: Free/Open source Open firmware implementation
* [http://openbios.org/viewvc/?root=OpenFirmware Browse the Subversion repository]
* [http://openbios.org/viewvc/?root=OpenFirmware Browse Subversion repository]
* [http://www.firmworks.com/QuickRef.html Open Firmware Quick Reference] (but ignore the section on nvram, because this is disabled in OLPC builds)
* [http://en.wikipedia.org/wiki/Open_firmware Open Firmware in Wikipedia]
* [[wikipedia:Open_Firmware|Open Firmware in Wikipedia]]
* [http://web.archive.org/web/20070626112950/http://www.openbios.org/data/docs/of1275.pdf The definitive Open Firmware specification (IEEE 1275-1994)]
:* OLPC does not claim compliance with this standard for the implementation of Open Firmware in the XO laptops, since changes have been made to our build of Open Firmware without reference to the standard, but we probably complied given we had the expertise in the specification. --[[User:Quozl|Quozl]] 23:52, 21 February 2014 (UTC)


[[Category:Firmware]]
[[Category:Firmware]]

Latest revision as of 05:30, 11 January 2016

Open Firmware is the hardware-independent firmware (computer software which loads the operating system) that the XO 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 Open Firmware.

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 is available in the Open Firmware repository:

Subversion was once used. You can browse the 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 revision number. E.g. for OLPC Firmware q2d07 the revision number is 775.

To work backwards from the laptop, get the Ok prompt and type

more rom:sourceurl

and look at the revision number on the end of the line. This is especially useful on development builds, but works on stable builds as well. An M or 1 suffix means that the source was modified since the revision number.

Replacing BIOS in the XO-1 - 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 Open Firmware 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 Open Firmware

Accessing Open Firmware on an XO

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

  • See Ok. At boot time, briefly type the Escape key (top left on the XO keyboard, with a white X in a black disc) when you hear the startup jingle. Do not hold it down. 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 for routine Forth use and experimentation. The latter method (breaking out of Sugar/Linux) is for debugging OS problems and to inspect the state of hardware after the OS has been running, but is not recommended, due to its potential for confusing the OS or losing unsaved data.

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.

Be careful using "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.

When finished with OFW,

  • turn the power off, by holding down the power button,
  • type boot to start the operating system,
  • type bye to restart the laptop, or
  • type power-off to turn off the laptop.

See also

External links

  • OLPC does not claim compliance with this standard for the implementation of Open Firmware in the XO laptops, since changes have been made to our build of Open Firmware without reference to the standard, but we probably complied given we had the expertise in the specification. --Quozl 23:52, 21 February 2014 (UTC)