Native Linux on the PowerPC
Looking for a better operating system for your PowerPC machine? If you're reading Linux Journal, chances are you've already found one. The PowerPC-based machines from Apple, Motorola and IBM offer some competition to Intel and DEC Alpha-based PCs. The PowerPC is a well-designed processor with a well-made box, and since it uses the PCI bus, it can use most of the PCI cards made for the Intel PCs. Even better, PowerPCs run Linux.
The PowerPC (PPC) processors are produced by IBM, Apple and Motorola in a joint venture. The vast majority of PPC computers are PowerMacs and PowerMac clones. Both IBM and Motorola make PowerPCs based on the PREP standard. Motorola also makes Mac clones. IBM is now using the PowerPC in its RS6000 and 830 class of machines and in one of its larger computers—the AS400. There is even a version of the IBM portable, the Thinkpad, that is PowerPC-based. The PREP-based machines all look pretty much the same to the operating system, and that makes supporting them all easier. The PowerMac, however, is not PREP-based. Native Linux runs on all of these machines except the AS400 and the older PowerMacs based on the NuBus. Our aim is to be able to run PowerPC Linux on every PowerPC system available.
There are three versions of Native PowerPC Linux, as well as Apple's version of Mach with a Linux personality (MkLinux)--all developed by separate groups. All the native versions of the port started from early work by Gary Thomas. By the time this article is published, we hope the various native versions will have been merged into one. As things stand right now (in late January), the three versions are:
http://www.linuxppc.org/--A version of Linux 2.0 for Be, Motorola and IBM machines by Gary Thomas. This version includes some kernel support from the MkLinux project. More information can be obtained by writing email@example.com.
http://www.cs.nmt.edu/linuxppc/--A version of Linux 2.1 that runs on the Motorola and IBM workstations from New Mexico Tech. This is the one found in the main Linux source distribution. More information can be obtained by writing firstname.lastname@example.org.
ftp://cap.anu.edu.au/pub/--A version of Linux 2.1 that runs on the PowerMac from Paul Mackerras. More information can be obtained by writing email@example.com.
Currently, we are integrating the New Mexico Tech port (for Motorola and IBM machines) with Paul Mackerras's version (for PowerMacs) in order to support all PowerPC machines from one source tree.
The standard utilities, like Emacs, awk, Perl, bash, Ghostview and TeX, all compile and run just as on any Linux port. Network support is complete—NFS server and client, FTP server and client, slip, ppp, tftp boot servers, xntp and other network services all work. X runs on the IBMs with the S3 card and on the Macs. (It's quite snappy on my IBM 830.) In fact, this document was prepared in its entirety under PowerPC Linux using X, Ghostview, LaTeX, and Emacs.
PowerPC Linux is very stable, and I'm using it as a development platform for the kernel. I've had uptimes as long as two weeks with a reboot only to update to a newer kernel. The infamous “crashme” test has run for over 12 hours on our machine, and improvements are still being made. Lmbench shows the system runs pretty quickly too.
Linux performs very well in comparison with AIX on the PowerPC. It also runs well in comparison to Linux on the Intel when tested with lmbench. The numbers in Listing 1 are the arithmetic mean of the results from 10 runs with lmbench-1. 0 (except on the PowerMac where the results are of a single run). Up-to-date lmbench numbers, crashme results and bug-fixes are kept at http://www.cs.nmt.edu/linuxppc/.
Support for other video cards will be finished shortly. Early versions of shared libraries are working on Thomas's version. They're a high priority, and so will be completed soon. Kernel modules were working up to early versions of the 2.1 kernel, but with the recent changes to the modutils, there are minor problems to be worked out. It will not be long before modules work again.
There is a PowerMac version of LILO (named MILO) that boots MacOS and Linux, but there is no such program for the PREP platforms yet. A boot loader is not yet a high priority, but having one would certainly help in the debugging process—booting new kernels quickly becomes tedious without LILO. LILO is also necessary for users wishing to boot PPC Linux and another operating systems.
Since most PowerPC systems use the PCI bus, PCI cards that work on the Intel PCs work on the PowerPC systems. There are many Linux drivers written for PCI devices, and so adding support for more devices is easy. Most drivers need only minor modifications to work on the PowerPC. Usually we just need to change the “endianness” of the drivers. Most device drivers in Linux assume a little-endian CPU, and since the PowerPC is running big-endian, most drivers need to change the format of the data sent to the device. As changes have been made, the authors have been given copies for inclusion in the standard Linux tree. Luckily, the PowerPC is not the only Linux port to a big-endian machine. The Sparc runs big-endian and must deal with the same issues and fix the same problems, so we're not alone in needing and making these changes.
As of right now, the list of working drivers includes the serial interface, PS/2 mice, EIDE hard drives (CD-ROMs are buggy), the NCR 53c8XX SCSI controller (all SCSI devices working), standard floppy, DEC Ethernet cards (de4x5 driver) and Lance Ethernet cards. Supported on the PowerMac are the MACE Ethernet interface, ADB mouse/keyboard and the MESH and 53C96 SCSI controllers. Mark Scott at Motorola has configured the PowerStack to support audio, but none of the other sound devices on any of the architectures are supported yet. The EIDE CD-ROM support has bugs and needs more work—neither video input nor output works. Patches from users who have other hardware are welcome.
Linux on the PowerPC is a stable and robust development environment. What we need is more users installing it and beginning the work on driver modifications and other missing features. Linux benefits from the work of many programmers across the globe, and PowerPC Linux hopes to have the same advantage.
At this time, making the kernel bullet-proof is the highest priority. Second is speeding it up. After all, a fast kernel that crashes is just a kernel that crashes quickly.
I'd like to take Real-Time Linux, developed here at New Mexico Tech, and make it work on the PPC. The PowerPC makes real-time features easier than the 80x86 with better timer and simpler interrupt interfaces. Integrating with RT-Linux could even serve to optimize the kernel by using soft disables for interrupts rather than costly hardware disables.
As soon I have access to a symmetric multi-processing (SMP) PowerPC machine, I'll begin work on SMP, since there is no support for PowerPC SMP machines now.
The distribution of PPC Linux currently consists of a boot floppy image for the installation, a root floppy image, a file system tar file and a final boot image for the hard disk. Detailed instructions and the associated files for an installation can be found at ftp://ftp.nmt.edu:/pub/people/cort/. This installation is clumsy and requires a network with an NFS server or a tape drive. This isn't as practical as it could be and leaves much room for improvement. The Red Hat package management tools are compiled and work, but they are not yet directly supported by Red Hat; therefore, only the RPM source packages work.
There is no support in PPC Linux for emulating operating systems other than in the PowerMac version, which runs MkLinux binaries as long as they don't make Mach system calls. Other than limited MkLinux support, there are no plans for adding emulation. Support for PowerPC AIX binaries would not be very difficult, but since there are few applications for PowerPC AIX that users would want, adding support would not be worthwhile. However, a stronger case can be made for emulation of MacOS and Windows. There are many applications for both MacOS and MS Windows that users would want to run under PPC Linux. Perhaps MacOS and Windows emulation for the PowerPC could be taken up by others as a project similar to Wine and DOSemu.
There is still a lot of work to be done in many areas of the kernel and at the user level. Device drivers need to be modified and tested to translate from a big-endian CPU to the native format of the device. There are very few devices supported now, and I don't have access to them all to do the work. People with hardware they'd like to see supported and an interest in doing some kernel hacking are needed for this project. Even users who don't want to write code can help by testing kernel changes.
People interested in running PowerPC on their workstations are also needed. Different PowerPC machines are needed to test and verify the system works on as many of the PowerPC machines as possible. People willing to help add support for their own machines would be even better.
X needs changes to support more video cards, and the changes should be integrated with standard XFree. I'm rather keen on the idea of a PPC Linux Netscape as well. Linus Torvalds urged the idea of Linux as a “fun” system at the 1997 Usenix Technical Conference; as an example he cited his work to port Quake to Alpha Linux. Perhaps someone with an interest could take up this cause.
A PowerPC version of LILO that works on the PowerMac and other PowerPC platforms would be very useful. Currently, we only have a PowerMac version, and work on a PREP LILO could begin using the PowerMac version.
Cort Dougan is a graduate student at New Mexico Tech and splits his time between his graduate work, PowerPC Linux and hydroponics farming. He can be reached via email at firstname.lastname@example.org.