Skip to content

Instantly share code, notes, and snippets.

@ross-newman
Last active June 9, 2024 18:51
Show Gist options
  • Save ross-newman/a744988b298ea1ad47c5dae1baafcb22 to your computer and use it in GitHub Desktop.
Save ross-newman/a744988b298ea1ad47c5dae1baafcb22 to your computer and use it in GitHub Desktop.
Building PPC Linux code using QEMU on Ubuntu 18.04 LTS
#!/bin/bash
echo "Building Debina 10 QEMU instance..."
wget https://cdimage.debian.org/cdimage/ports/10.0/powerpc/iso-cd/debian-10.0-powerpc-NETINST-1.iso
sudo apt install qemu
# Create new disk for install
qemu-img create -f qcow2 debian10.qcow2 2000M
# Boot the install image
qemu-system-ppc -L pc-bios -boot d -M mac99 -m 1024 -net nic,model=sungem -net user -hda debian10.qcow2 -cdrom ./debian-10.0-powerpc-NETINST-1.iso -g 1024x768x8
# Run the image
qemu-system-ppc -L pc-bios -boot c -prom-env "boot-device=hd:,\yaboot" -prom-env "boot-args=conf=hd:,\yaboot.conf" \
-M mac99 -m 1024 -net nic,model=sungem -net user -hda debian10.qcow2 -g 1024x768x32
echo "Building lUbuntu 16.04 QEMU instance..."
#wget http://cdimage.ubuntu.com/releases/14.04/release/ubuntu-14.04.6-server-powerpc.iso
wget http://cdimage.ubuntu.com/lubuntu/releases/16.04.1/release/lubuntu-16.04-desktop-powerpc.iso
qemu-img create -f qcow2 lubuntu14.qcow2 2000M
qemu-system-ppc -L pc-bios -boot d -M mac99 -m 1024 -net nic,model=sungem -net user -hda lubuntu14.qcow2 -cdrom lubuntu-14.04.5-desktop-powerpc.iso
qemu-system-ppc -L pc-bios -boot c -prom-env "boot-device=hd:,\yaboot" -prom-env "boot-args=conf=hd:,\yaboot.conf" -M mac99 -m 1024 -net nic,model=sungem -net user -hda lubuntu14.qcow2 -cdrom lubuntu-14.04.5-desktop-powerpc.iso
#Building u-boot for PPC
echo "Building U-Boot for QEMU..."
sudo apt install gcc-powerpc-linux-gnu
git clone https://git.denx.de/u-boot.git
make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- qemu-ppce500_defconfig
make ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-
#qemu-system-ppc -machine help
#qemu-system-ppc -cpu help
qemu-system-ppc -M ppce500 -m 1024 -nographic -kernel ./u-boot
@ross-newman
Copy link
Author

I was surprised that Ubuntu was still supporting PowerPC processors up to lubuntu 16.04 but they were and the evidence is shown below. The performance is not fast but this should be expected for an emulation, just about usable. I installed gcc and make to build some test apps. Cross compilation on an Intel host would be much quicker.

Screenshot from 2019-06-19 16-05-15

U-Boot could be used to boot Linux RAM disk images if required.

@cmedinam
Copy link

Hi! great work! many thanks! Could you put some example to run an iso using ppce500 o how to prepare the .img and uboot to run the isos?

@ross-newman
Copy link
Author

If only I had the time... PPC is dead and buried unfortunately so I’m done tinkering. Good luck with your ppce500 experiments..

@mechatism1
Copy link

PPC is still alive, kicking, and mandated by state & federal government for certain types of equipment. Dropping support for this equipment is shortsighted, but resources must follow the money. Now new equipment can only run older versions where backports are rare or nonexistent. Those of us supporting equipment with these state & federal mandates are left in the dark; everyone knows how agile government mandates are. And everyone depends on this equipment daily to keep them safe. They have no idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment