PPC systems under qemu-system-ppc emulation on aarch64 part 1

Shorter and last entry from me in 2019. This time its about some experiments running PPC systems via qemu-system-ppc

This time I wanted to see how the Pinebook-pro behaves and how usable it is on the virtualization/simulation side. Im using the XFCE Manajaro Arm64 Linux for the Pinebook-pro made available here https://osdn.net/projects/manjaro-arm/storage/pbpro/xfce      on a microSD card, and here is one important thing to consider, good quality/fast  microSD card is a must (Im using a 64 GB Kingston read speed 100 MB/s )

However since I don’t really like XFCE I have removed it from the install and use Fluxbox instead (its even more lighter but needs more skill to configure compared to XFCE or KDE)

Also Im using a fresh Qemu git clone https://github.com/qemu/qemu

Qemu compilation on aarch64 Manjaro Linux is straight forward and can be summed up to simply “$ configure && make ” and ” # make install

I wanted to cover the PPC systems I have tested here, so mainly we will be covering MacOS 10.2 and later MorphOS 3.12 and AmigaOS 4.1. Apple had support for PPC all the way to macOS Tiger 10.5.8 but I found 10.5 to be really slow in qemu compared to 10.2

Also 10.2 is quite aged and we will include an installation of Apple pre-xcode developer toolkit with the GCC compiler and test compile some code.

All of the above can be of course done on any other architecture, x86_64 with powerfull CPU (core i5/i7 would produce much better results compared to the Pinebook’s ARM CPU)

Assuming we have all in place lets prepare the environment for the OSX 10.2 installation

Create working directories and download the ISOs, there are 3 ISOs, place these there

DISK1.ISO  –   https://mega.nz/#!4MJCBQpJ!Ydr7UCBKo0lNYzl0AhM_wsdzDLMbHpwrRsuBEVhCm5s
DISK2.ISO  –  https://mega.nz/#!ZdAkRQKA!17phaXtAh_DWebc2yc4JiA-7nfUQk8fV1_-ksZh2Tcs
DEVELOPER.ISO –   https://mega.nz/#!lUYwTKjQ!ii8hikFjEyr8Qs3d0DfSOZZIrYp3Vm7-m0oetkFRC20
~ $ mkdir MACOS
~ $ cd MACOS 
MACOS $ ls 
MACOS $ disk1.iso disk2.iso developer.iso 

Lets create the qcow2 disk image to hold the installation (20 GB should be fine)

MACOS $ qemu-system create -f qcow2 disk.img 20G 
MACOS $

For the networking on the Arch Linux we need to download uml_utilities and compile them, since they do not ship on the Manjaro Linux (arch) since we need the tunctl command from there to setup the network

$ wget http://user-mode-linux.sourceforge.net/uml_utilities_20070815.tar.bz2
$ bunzip uml_utilities_20070815.tar.bz2 
$ tar -xvf uml_utilities_20070815.tar
$ cd tools-20070815 
$ make 
The make will error on uml_net/hoct.c:215 undefined reference to ` makedev`  But this does not really matter, the tunctl binary will be built which we can copy over to /usr/bin like this $ su # cd tunclt # cp tunctl /usr/bin

Also we would need to install the bridge-utils which are installable via pacman package manager like this

# pacman -S bridge-utils

Once we have all the above in place we can prepare the network sharing script for Qemu, just make sure we execute this after each system boot

#Setup tap and bridge 
#change the username below to match yours
tunctl -t tap0 -u user  
ifconfig tap0 up
brctl addbr br0
brctl setfd br0 0
ifconfig br0 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 up
brctl addif br0 tap0 
ifconfig tap0 0.0.0.0
sysctl net.ipv4.ip_forward=1
iptables --table nat -A POSTROUTING --out-interface wlan0 -j MASQUERADE

Also make sure you have this script as /etc/qemu-ifup and executable

#! /bin/sh
# Script to bring a network (tap) device for qemu up.
# The idea is to add the tap device to the same bridge
# as we have default routing to.

# in order to be able to find brctl
PATH=$PATH:/sbin:/usr/sbin
ip=$(which ip)

if [ -n "$ip" ]; then
ip link set "$1" up
else
brctl=$(which brctl)
if [ ! "$ip" -o ! "$brctl" ]; then
echo "W: $0: not doing any bridge processing: neither ip nor brctl utility not found" >&2
exit 0
fi
ifconfig "$1" 0.0.0.0 up
fi

switch=$(ip route ls |
awk '/^default / {
for(i=0;i<NF;i++) { if ($i == "dev") { print $(i+1); next; } }
}'
)

switch=br0

# only add the interface to default-route bridge if we
# have such interface (with default route) and if that
# interface is actually a bridge.
# It is possible to have several default routes too
for br in $switch; do
if [ -d /sys/class/net/$br/bridge/. ]; then
if [ -n "$ip" ]; then
ip link set "$1" master "$br"
else
brctl addif $br "$1"
fi
exit # exit with status of the previous command
fi
done

echo "W: $0: no bridge for guest interface found" >&2

Finally we prepare the qemu installer script which we will call install.sh here and execute

qemu-system-ppc -L pc-bios -boot d -M mac99 -m 512 -hda disk.img -cdrom disk1.iso \
 -netdev user,id=mynet0 -device sungem,netdev=mynet0 -net nic -net tap

Load the Disk Utility and configure the qemu disk (20G) Erase using Macos Extended

Once the disk is ready we can chose it for OSX installation

Installation will continue

After a while when the installer finishes, power off  qemu and re-load the installer script with the second disk2.iso  like this, but this time we boot of the C drive

qemu-system-ppc -L open-bios -boot c -M mac99 -m 1024 -hda disk.img -cdrom disk2.iso \
-netdev user,id=mynet0 -device sungem,netdev=mynet0 -net nic -net tap

Installation will continue and eventually finish. Reboot yet again. Here is the final run.sh script to load the simulator.

During the final setup we need to enter some annoying personal details, make some up

Finally setup the passwords and account

Next we will setup network

And do not choose DHCP, setup the network manually

Click through next and eventually finish the setup. All the personal information requirements are really annoying, but for some reason the network configuration does not get saved properly, so we need to re-configure it yet again

This time the network gets saved and works

We can now install the GCC developer tools on the developer.iso CD, open the CD and double-click Developer.mpkg

Wait for the installer to finish

And the final look – qemu in full screen (ctlr+alt+f) in 1920×1080 resolution … looks almost native

Next we will try MorphOS and AmigaOS , but that will be in 2020

Happy new Year

Reference used

https://wiki.qemu.org/Documentation/Platforms/PowerPC

 

Advertisement

About astr0baby

Please run Adblock or similar... we have been told to do so since Carl Sagan wrote the Contact .
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.