Building OpenFirmware for QEMU

From DisNCord Community Wiki
Revision as of 22:40, 23 February 2023 by Kraaabs (talk | contribs) (add gitlab link to the dockerfile ~Sarah)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In 2006, the source code for OpenFirmware[1] on x86 was released. Although there are instructions[2] for building images for use with QEMU, they are sparse and don't work any more on modern, 64-bit Linux.

Setting up your own build environment

As far as I can tell, building OpenFirmware requires an older version of GCC as well as multilib support. The easiest way to get both of these things at once is to use an older Linux distribution in a virtual machine.

Slackware 14.2 (the 32-bit version) is known to produce working builds. Just install the entire distribution and follow the instructions on the OpenFirmware wiki to build your image of choice. As of 2023/02/22, this method seems to work fine.

As well, User:Kraaabs has created a Dockerfile to build images without having to set up your own VM:

So why doesn't it work?

OpenFirmware is actually bootstrapped using a FORTH interpreter that it builds before the "real" build process starts. This interpreter is known not to build on aarch64, and segfaults on x86_64. 32-bit builds of the interpreter appear to work, but they produce broken images (with no error message!).

At this point it's unclear whether the issue is with the FORTH interpreter itself (likely) or with the FORTH code used to build OpenFirmware (less likely). Either way, building on an older 32-bit system seems to work just fine, and produces images that run in modern versions of QEMU.

Just give me images!

User:Kraaabs has successfully built every kind of QEMU OpenFirmware image for x86. Download here.