Linux Users Group of Davis

March 20, 2000

Linux/PPC

Henry House

I. Overview
A. History of Apple's machine architectures

1. First macs used the Motorola 68k series processors and NUBUS system
bus.
Linux ported to some of these older Macs; work co-ordinated with ports
to NeXT black workstations, Amiga 68k-based systems, etc. 68k series are
32-bit CISC processors. Originally more powerful than Intel's line,
though eventually surpassed.

2. IBM and Motorola (with Apple's encouragement) developed PowerPC as a
replacement architecture in 1992.
PowerPC is RISC and is optimized for low heat and power consumption. It
is based on earlier IBM and Motorola work (POWER and 88k processor bus).
Motorola uses for embedded systems. IBM uses for AIX-based workstations,
minicomputers, and mainframes. Apple mainly uses chips of IBM
manufacture on its own boards. Most PowerPCs are 32-bit (incl. all that
Apple uses), but 64-bit variants exist.

3. First PowerMacs were NUBUS-based
At some point began using Sun's Open Firmware for boot-up. Other 
hardware: SCSI, adb, proprietary video.

4. Later PowerMacs switched to PCI
ADB giving way to USB, SCSI to IDE and Firewire, proprietary video to
AGP or PCI cards. Open Firmware finally no longer broken or lame with
Newworld machines (which are the colorful post-January-1999 machines).

B. Apple jump-started Linux porting by sponsoring MkLinux
This is Linux running on top of the Mach microkernel. Runs on many
machines, including NUBUS-based Macs. Performance not stellar because
the microkernel introduces a 10-15% overhead. However the microkernel 
allows Linux to run on this old harware that the Linux kernel itself 
does not support. Development of MkLinux continues (slowly). Rumor 
has it that this largely hardware-independant port is now running 
on HP's PA-RISC architecture as well.

C. The monolithic port (subject of demonstration, see II & III)
This port runs on all PCI-based Power Macs (both Oldworld and Newworld)
and many non-Apple machines too. This port does not suffer the 
performance problems that MkLinux suffers because monolithic = no
microkernel. This port was started by Gary Thomas. Many others have 
since been involved. Non-apple machine notes: spotty support
for multiprocessing and the various embedded busses; no support for
64-bit (yet). Distributions based on this port: Debian, LinuxPPC, Yellow
Dog, SuSE (beta), Turbolinux (beta). Early work on a German-only
distribution has since merged, apparently into LinuxPPC.

D. Other PowerPC hardware
Boxes made by IBM, Motorola, Be, others. Most may run at least one of
the two ports with varying levels of support. Quite a lot of hardware
variation in this category.

E. Other operating systems
Other operating systems for PowerPC include AIX, MacOS, MacOS X /
Darwin, the BSDs, AIX, various realtime OSes (LynxOS, ChorusOS, QNX
Neutrino, OS-9). In the works: Monterey (AIX / SCO fusion for PPC,
POWER, and Itanium). Defunct: Copland, Taligent, OS/2, Solaris, TaOS,
and Windows NT!

An interesting note: the PowerPC can run in little-endian or big-endian
mode, but big-endian is preferred for performance reasons. Many of the
defunct OS ports ran little-endian (including Solaris and NT). It is 
tempting to speculate that the choice of little-endian mode is related 
to the failure of the other OS ports on PowerPC.

II. Demo of installation onto PowerPC
Demonstration system: Apple PowerBook G3 (Wallstreet model).

A. Bootloaders: BootX (starts Linux from within MacOS like loadlin), 
yaboot (loads Linux at boot-up like lilo), direct Open Firmware 
booting (similar to the bootup of some SPARC workstations).

B. Distributions available: LinuxPPC (stable, current release called LinuxPPC
2000), Yellowdog (stable); Debian (frozen, awaiting official release of 2.2); 
TurboLinux, SuSE (still in beta); MkLinux (frozen, awaiting first stable 
release at version 1). All except last are based on the monolithic port. 
Also available is a rpm-based developer's reference release of the monolithic 
port, which is hosted by LinuxPPC {.org,.com}.

C. Show LinuxPPC 2000 X-based installation with bootable disk
The installer for the LinuxPPC 2000 distribution is graphical 
and newbie-friendly. After installation, the machine boots 
strait into X Windows -- no X configuration required!

III. Demo running system.

A. Harware support: DMA sound, ATI video, USB, PCMCIA, many
off-the-shelf PCI cards, power management.

B. MacOS emulation (MOL):
Allows a copy of MacOS to be run inside Linux/PPC with little speed
penalty. The MacOS display may be within an X window or on a Linux
framebuffer. Provides access to legacy applications with no need 
to reboot!

C. Advantages
Relative to MacOS Linux is more stable, seems to run faster, and 
offers compatibility with thousands of free Linux programs; Linux 
supports aging hardware that is unlikely to ever be supported by 
Apple's next operating system, MacOS X. Relative to Linux/Intel:
Limited collection of hardware makes development easier;
generally friendly attitude from Apple. IMHO recent Apple hardware is
reliably of good quality. Great choice if you want a Linux notebook.
Binary compatibility among all PowerPC Linux distributions. Enhanced
geekiness factor. Prospect of IBM's open hardware specs lie on the
horizon.

D. Problems
Many Macs have limited expandability. Those awful round mice and kid's
keyboards. PowerPC kernel still not merged into main (Linus) tree.
Big-endianness introduces a few compatibility issues (mainly with sloppy
code). Compiling RISC code takes a long time. RISC code is very large so
RAM requirements are relatively high. Hard to say how fast machines
really are because reliable benchmarks are lacking and work on compiler
optimization is ongoing. (But note that according to anectotal evidence,
a 200Mhz PPC604e outperforms the 350Mhz PII and some unspecified SPARCs.)

D. Closing tip
If your machine's CPU is anything higher than a PowerPC 601, add
-fgfxopt to your gcc command-line options. This will generate fsel
instructions (don't ask me to explain that please ;-) which increase
performance of your code. The 601 CPU unfortunately does not implement
these instructions.

IV. References

Most of the information presented here is to be found on these websites:

www.linuxppc.org (LinuxPPC development, distribution download, list archives)
www.linuxppc.com (User-oriented information and CD purchase)
www.debian.org/ports/powerpc (Debian on PowerPC)
www.ppc.kernel.org (PowerPC kernels and some background information)
www.linuxppc.org/powerpcfaq (PowerPC processor information, not OS-specific)
www.loomer.com/linuxppc (PowerBook-specific issues)
www.maconlinux.com (MOL, the open-source Macintosh emulator)
www.mklinux.org (Microkernel Linux -- the other port)

For a newbie, www.linuxppc.com is the best information source. You can 
determine whether your Mac is supported by the LinuxPPC 2000 distribution
from that site.