This subproject is about implementing emulation of Pegasos2 board which can run Linux and several Amiga like and other OSes. See main project website for more information. For installing AmigaOS 4.1 on the emulated pegasos2 see documentation here.
While QEMU already has sam460ex board that can run Amiga like OSes, that is based on an embedded PPC440 (BookE) core SoC which cannot use KVM on PPC hosts and lacks some advanced PPC features such as AltiVec/VMX which could be used by some programs to run faster via exploiting QEMU's ability to translate these to corresponding host vector instructions where possible. MorphOS runs on the QEMU mac99 emulation but needs changes to OpenBIOS that could not be upstreamed and AmigaOS doesn't run on Mac hardware so having a board with a BookS CPU that can run all Amiga like OSes could be useful for KVM acceleration on BookS PPC hosts and allowing AltiVec/VMX under AmigaOS too. The Pegasos2 is a good target for that.
So let's explore what's needed to implement it in QEMU. First step is to gather all information about the board so we get to know it.
The bPlan/Genesi Pegasos II is built around the Marvell Discovery II MV64360 family PowerPC system controller chip, specifically the MV64361 version and a VIA VT8231 integrated SuperIO/South Bridge. These two chips provide almost all of its functions (except Firewire which is not needed to boot so it will be ignored for now). The CPU is on a separate card and can be a passive cooled G3 (750CXe) or a G4 (7447) with active cooling. For reference here are the specifications in short:
The schematics of the board was also published by Genesi and is freely available. Documentation of the MV64361 and VT8231 chips are not freely available (so cannot be uploaded or linked here) but it may be possible to find these on-line by searching for MV64360/1/2 and VT8231 respectively. The VT8231 is also very similar to the VT82C686B so information about that chip could also be useful. (QEMU already has some implementation of the VT82C686B which is used by the MIPS fuloong2e board.)
The board has an Open Firmware implementation that is based on CodeGen's SmartFirmware but it is not identical to the open source version as it has modifications from bPlan that were not open sourced. Apart from board specific initialisation it also integrates a BIOS emulator which is used to run option ROM of PC video cards and support for Amiga FFS file system for booting MorphOS. The device tree can be seen in PegasosII_OFW-Tree.txt and all other info about the open firmware implementation in PegasosII_OFW-Dump.txt. As the board's firmware is not open source it cannot be redistributed and it also cannot be included in QEMU or uploaded here which is a problem that needs to be solved. Possible solutions considered were: reimplementing it from the open source parts it consists of (the BIOS emulator is likely based on x86emu similar to what is described here or how it's implemented in Pmon 2000) or replacing it with one of the existing open firmware implementations in QEMU (OpenBIOS or SLOF) but those would need to be modified to provide the info as guests running on Pegasos 2 expect. Fixing OpenBIOS to be usable would help to make it more generic and also fix problem with MorphOS on mac99 while reimplementing SmartFirmware based firmware may be more compatible to real hardware but would add yet another firmware to QEMU which may not be desirable. I've also made some experiments to port OpenFirmware to Pegasos2 but it did not work in a generic way so that it could be used by multiple boards and would have needed similar modifications to emulate the different device tree.
In the meantime QEMU gained capability to emulate a minimal Open Firmware interface for spapr called VOF (Virtual Open Firmware) which I ended up using to replace the firmware that works for at least some guest OSes such as Linux and MorphOS but AmigaOS boot loader amigaboot.of still needs firmware ROM. To overcome that problem and to avoid some of the limitations that come from using the original firmware I wrote a replacement for amigaboot.of called BBoot that works with QEMU's VOF and thus avoids needing the non-free board firmware. The emulation still can be used with the firmware too which is useful for testing to get the emulated machine closest to real one but the firmware binary cannot be distributed. Easiest would be if bPlan open sourced the original firmware (only their part is not open source yet) but so far they haven't replied to any queries about that. The ROM image may be obtained by dumping it from your Pegasos II or maybe finding the firmware update called up050404 that was once downloadable from bPlan's web site. The ROM image can be extracted from that update with extract_rom_from_updater.
To emulate this board existing PPC CPU emulation could be used. The VT8231 emulation is based on and reuse similar parts of VT82C686B that already existed in QEMU but these had to be enhanced or fixed for differences between these chips and also adding missing pieces. (The MIPS fuloong2e board that uses VT82C686B emulation seems to be only partially implemented and the 686B is also missing a lot of details such as AC97 sound so this is not a finished emulation and may need to be finished and not only modified for differences between 686B and VT8231. While it's a good starting point, expect missing pieces when using it.) The biggest missing part was the MV64361 which is quite a complex chip and it had to be implemented from scratch as no emulation of it was present in QEMU yet. (Another MIPS board the malta which is emulated by QEMU is based on a chip named GT64120 which may be similar to the MV64361 because Marvell apparently bought Galileo Tech which produced that chip and may have based the Discovery II on that. But the emulation of that chip: hw/mips/gt64xxx_pci.c is also incomplete so at the end it could not be used for much when implementing MV64361 model.)
The pegasos2 emulation is in upstream QEMU since version 6.1.0-rc0, (previously in was in the pegasos2 branch of git where latest changes may be staged). The changes that were needed to implement this machnie consist of device emulation of MV64361, VT8231 and actual board code and their headers and some other changes for already implemented VIA parts such as IDE emulation. The current version also has a firmware replacement using VOF as described above.
In its current state the board firmware ROM runs and also can boot operating systems but only MorphOS >=2.6 and Linux (I've tested with Debian 8.11.0 powerpc netinst image) can ne booted easily. Most guest OSes do not seem to have driver for the standard VGA card (they expect ATI Radeon card) so either can only be used over serial console for Linux or have to use the experimental and incomplete ati-vga emulation. AmigaOS4.1 PegasosII version also boots but can't be seen due to no graphics driver without changing the boot CD or using customised System/Kickstart. The driver from Sam460EX version (or maybe some other drivers) can be used but it needs modifying the boot CD that is not easy to do for most users. I could boot AmigaOS 4.1 Pegasos 2 version by replacing the PCIGraphics.card and adding siliconmotion502.chip to System/Kickstart from the Sam460 version but it may not be practical to do so for most users. A lot of MV64361 might still be missing and there are also missing pieces of VT8231 but not sure how much of these are needed, guest OSes seem to mostly work. The QEMU command line when using board firmware is something like:
qemu-system-ppc -M pegasos2 -bios path/to/pegasos2.rom \ -device ati-vga,romfile="" -cdrom some.iso -d guest_errors,unimp
or with the built in Virtual Open Firmware (VOF):
qemu-system-ppc -M pegasos2 -kernel vmlinuz-chrp.initrd -append "console=tty" \ -device ati-vga,romfile="" -cdrom some.iso -d guest_errors,unimp
For MorphOS use boot.img from the root of the ISO as kernel, -append is not needed but can be used to pass command line options. AmigaOS cannot boot with VOF and needs the firmware ROM as it uses firmware features to read files from boot volume that is not supported by VOF yet.
Look for output in the serial window (try Ctrl+Alt+2) or use -serial stdio QEMU option to redirect it to terminal.
Below is a summary of known (solved or have a work around) and unknown (outstanding) issues with links to tickets where they are tracked: