Linux

Emulating PPC32 Linux in x86_64 Linux

I’ve recently needed to do some porting work for a PPC32 CPU running Linux. At the time I didn’t have any PPC hardware (I’ve since acquired a PowerMac G5). Of course when we don’t have hardware, we can normally emulate it. Here is how I set up the emulation so I can remember for next time.

There are a couple of things we need to start with. First of all, QEMU, this is a multi platform emulator which can be found in most Linux distributions. On my machine I installed this with the required PPC32 parts by running:

sudo apt install qemu-system-ppc openbios-ppc

Next up we need an OS to install. I needed something a little older than normal, Debian 8.11 PowerPC edition. After this I created a blank 12GB hard disk image using:

qemu-img create -f qcow2 powerpc32.img 12G

Then install the OS using the following, these options are documented at https://wiki.qemu.org/Documentation/Platforms/PowerPC:

qemu-system-ppc -L pc-bios -boot d -M mac99,via=pmu -m 1024 -hda powerpc32.img -cdrom debian-8.11.0-powerpc-DVD-1.iso

The installer will be somewhat familiar if you have ever installed a Linux distro before. I recommend not installing the GUI for Debian 8.11, the emulated CPU is very slow and GNOME wouldn’t work.

After a long wait for the installer to finish I created a file called boot.sh with the following contents:

qemu-system-ppc -L pc-bios -boot c -prom-env "boot-device=hd:,\yaboot" -prom-env "boot-args=conf=hd:,\yaboot.conf" -M mac99,via=pmu -m 2048 -hda powerpc32.img

Now running boot.sh will boot the PowerPC 32bit Linux image and give it 2GB of RAM.

The final piece needed for Debian 8.11 is the APT repositories. The default ones do not work, so in the VM you need to edit /etc/apt/sources.list, remove the cdrom line and add the following:

deb http://archive.debian.org/debian jessie main contrib non-free
deb-src http://archive.debian.org/debian jessie main contrib non-free

We are now good to go! Compile away and find any big endian based bugs!

Featured image by Baz1521, used under CC-BY-SA 3.0 license.

LinuxJedi

View Comments

Share
Published by
LinuxJedi

Recent Posts

The Legend Continues: Amiga 1000 Keyboard Revival

I have restored the boxed Amiga 1000 main unit and the mice that came with…

2 days ago

Amiga 4000 Repair: This one was just weird

I was recently sent an Amiga 4000 motherboard repair. It should have been quite straightforward,…

3 days ago

Unboxing the Legend Continues: Amiga 1000 Mouse Restoration.

I recently received a boxed Amiga 1000 which was in excellent condition, but required a…

1 week ago

Unboxing a Legend: Amiga 1000

I have a local friend who is a private collector of vintage computers and consoles,…

2 weeks ago

Amiga 4000 With Lots of Little Problems

I’ve had a few people send me things in to repair lately. Amongst these was…

2 months ago

Amiga A3640 CPU Card Repair

Lately, I've been very busy, but haven't had many interesting things to blog about happen.…

2 months ago