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

Repair of a Trident VLB Graphics Card

Hot on the heels of repairing the Cirrus Logic VLB card, I acquired a dead…

1 week ago

Raspberry Pi JTAG Programming – 2025 Edition

It seems that every time I document how to do Xilinx JTAG programming from a…

1 week ago

Repair of a Cirrus Logic VLB Graphics Card

Fellow vintage computer collector, Gammitin, challenged me to fix four VLB graphics cards, as well…

2 weeks ago

Upgrading my 486 PC Build

You may remember my recent 486 PC build, I enjoyed doing it, but I had…

3 weeks ago

The Roland MT-32: The Ultimate late-80s Gaming Sound

One of the projects I wanted to do with my new 486 PC was to…

1 month ago

486 PC Build

A lot of people my age went from the 8bit era to the 16bit era…

2 months ago