Friday, November 23, 2018

Make PowerPC Great Again

Back when Apple didn't try and screw over anyone with a broken iMac, back before Intel was the standard for Apple hardware, and back before Apple lost its only source of new innovation, that being Steve Jobs, there was the PowerMac, a line of computers running RISC architecture known as PowerPC, co-developed in a partnership between IBM, Apple, and Motorola. As the Power architecture is now fairly uncommon, as x86 and ARM dominate the processor market, it is now mainly used in server applications. The only "modern" OS you can run on them now is Linux, and I use that term lightly as not a lot of applications support the architecture.

A few months ago, I acquired an old PowerMac G5 from a local e-waste event, for free. The specific model I got was the lowest end PowerMac you could get from late-2004. It has 1GB of RAM (max of 4GB), has a single-core PowerPC 970FX CPU, and has a NVIDIA GeForce FX 5200 Ultra GPU. The system had no hard drive when I got it, so I threw in a 3.5" 80GB drive I had laying around and got to work on getting something to run.


As the hard drive was blank (or it had a non-Power compatible OS, I had no clue what was on it), I first installed an operating system. The disk drive, though a standard drive that you would see on a non-Apple PC, could only be opened from outside the case through software. Luckily this is a common issue, and the forum post I found recommended pushing the flap that covered the drive down and pressing the physical button with a bent paper clip. I downloaded the net installer for Debian 7, as I found it was the only disc that would boot on the Mac for some reason, even after trying the minimal install, which was just a command line with Ethernet drivers. After installing Debian 7, I got stuck pretty quick on finding any software to run. The internet browser was old and outdated, the latest officially supported version of any Java JRE or JDK was version 7, and finally nothing would compile as the GNU C and C++ compilers were way out of date. So I turned my focus on another project of mine for a few months.

About a week ago, I decided to start working on the PowerMac again. My first order of business was to change the SSH port so that it didn't interfere with my other Linux machines. After trying a bunch of random passwords on the machine I figured out the root user's login and got to work. I changed the SSH port, then began working on getting something useful running.

The machine draws too much power to use for a 24/7 server, so I though what if I could get something meaningful running, such as a game server? The first server that came to mind is Minecraft, as it runs on Java. The problem with that was that the only available version of Java was 7, which is not compatible with the latest Minecraft version's server. So I though for a minute, "What if a later version of Debian has a newer Java version?" So I began working on upgrading the machine to Debian 8. After updating all the packages on Debian 7, I changed the name of the version in "sources.list" to "jessie" instead of "wheezy". I then ran "sudo dist-upgrade" to upgrade the distro version. After about two and a half hours of loading about 2GB worth of new files onto the old and slow HDD, it was working, and it was working well. I tried to install OpenJDK8, and found out that OpenJDK stopped support the specific revision of PowerPC back during Java 7. I searched Oracle's website, found nothing, tried compiling it myself, also nothing. So after getting frustrated, I remembered an open-source alternative to the Minecraft server called Cuberite. Cuberite is a complete rewrite of Minecraft servers to be in C++, making it much more CPU and RAM efficient than the standard JVM-based executable. After downloading the latest supported release source code, I began the process of compiling the server.

After an hour, it successfully completed, and I tried to join the server on Minecraft 1.12.2. The game immediately crashed. I then tried again in the oldest supported version for the server, Minecraft 1.8.9. This time it didn't crash, but my character couldn't move and all I could see is bedrock hell. I tried putting in the command to teleport me away from point (0, 0, 0) but nothing worked. Must be an issue with compiling on an unusual architecture. Because I lacked the knowledge of C++, and I lack the time to spend hours scrolling through code I barely understand, I quickly gave up. So back to the drawing board.

After doing more research, it turned out that IBM had their own Java port, and one that would run on PowerMacs. Available here, for those who are curious, along with a few other Java SE ports to other  architectures. I downloaded the .bin file, ran it, and quickly got Java executing. I downloaded the Minecraft server jar file from the official download page with wget, and executed it. After generating the world for a excruciatingly long time for the world to generate, the server just crashed as soon as I joined, claiming the ticks were taking too long to load. Well crap. That's a lost cause.

So I decided to check what the sysbench time was on the CPU. I ran the test four times, once on the PowerMac, once on my personal gaming PC, once on my Raspberry Pi, and finally once on a friend of mine's 24 thread server machine. The results are as follows:
All were benchmarked with the sysbench CPU prime test, with all their threads used, and with a max of 20,000 numbers. Top left is the PowerMac, top right is the Pi, Bottom left is my Ryzen 5 2600x PC with 6 cores and 12 threads, and bottom right was the server running dual Xeon x5670 with 12 cores and 24 threads. As you can see, my current PC has the fastest time with 2.104 seconds, and since it was running on the Linux subsystem for Windows, it could be even faster if running natively. The Xeon is running on top of a virtualization layer, so it to would be faster if native. The Pi, with its 4 ARM cores managed a time of 92 seconds, with no overclock and only a heatsink to cool it off. This is about the time I would expect an older Pentium 4 or some similar x86 processor to achieve. The PowerPC was a stark disappointment. It took over 200 seconds for it to complete the test, making it statistically the least powerful machine used.

What did I learn from this? Well I learned that I now have a 20lbs paperweight under my desk. I learned that this is not an easy machine to tinker with, even after the easy process of getting Linux running. And finally, I learned that you can't just take some code designed for one machine and compile and run it on another. I could've Googled all this. I think I'm putting the PowerMac on hold for now, as I actually know how to get software working on my Raspberry Pi and the server I mentioned. At least those are practical.

No comments:

Post a Comment