The Penguin in the Apple

by Leonardo Giordani

On June 24, 2003, Linux User & Developer Expo took place in Birmingham, during which the Best Linux Hardware Award has been assigned to the SGI Altix 3000, a cluster system. It competed against the Xinit Sharp SPS440, which are powerful enterprise servers, and two notebooks, the Apple PowerBook and iBook.

This list of nominees is really strange, even though the victory went to the SGI cluster solution. 2003 has been the year during which, thanks to the 2.4 series kernels and several other projects (KDE and GNOME, for example), Linux has become a system usable even on desktop machines. This has been realized by the introduction of stable support in hardware categories users want to access for every day use, including USB devices.

Apple solutions are based on PowerPC processors and adopt solutions such as widescreens, gigabit Ethernet and wireless cards on board. Notebooks with this ind of hardware have been taboo for Linux until a short time ago; as recently as 2000, installing Linux on a x86 notebook was considered work for experts. Now, we not only can run Linux on this hardware, but we also can claim it to be the best.

Apple, moreover, has been extremely intelligent in its relationships with the Open Source community. Even though Apple continues to develop, support and sell closed-source solutions (Mac OS X), they have shown great interest in the Open Source world and have released the kernel of OS X (Darwin) under an open-source license. Under such circumstances, it is not surprising that more Linux users are approaching Apple solutions, which are innovative and not hostile to open-source solutions.

In this article we discuss the Apple PowerBook, covering the hardware features and the installation of Gentoo Linux and trying to understand if it really is a good choice for Linux users.


The PowerBook is produced by Apple in three different models that differ mainly in their screen dimensions--12, 15 and 17 inches. Each model is available with either a combination CD burner/DVD reader drive or a CD/DVD burner superdrive.

The first feature user notices surely is the screen dimension: the 12" model has a definition of 1024x768. The other two models exhibit a 16:9 widescreen, as compared to the more common 4:3 monitors, so you get a lot of work area. The maximum resolution available on the 15" model is 1280x854, and on the 17" model the resolution is 1440x900. All have DVI/VGA and S-Video output plugs to connect with an external digital or analog monitor and to televisions.

The microprocessor is a PowerPC G4, with frequencies up to 1 GHz and with three cache memory levels. The RISC architecture at the base of the PowerPC is quite different from that of the x86. Later in this article, we try to compare some performances. The minimum amount of memory mounted on the PowerBooks is 256MB, upgradable up to 1GB, and the hard drives are Ultra ATA/66 with 40 or 60GB of storage space.

The widely supported NVIDIA GeForce4 card is mounted on the 12" and 17" models. The 15" model comes with an ATI Mobility Radeon 9000 card, also well supported under Linux.

The networking section has some surprises for the user: each model is equipped with a Gigabit Ethernet card and an Airport wireless card, which reaches 11 or 54 Mbit/s. We also find two USB ports and a FireWire port, a PCMCIA slot, a microphone and line out ports and speakers.

A note about weight: the three models with batteries in weigh, respectively, 2.1, 2.45 and 3.1 Kg and are really slim compared to an x86 laptop of the same class.

The general impression one receives from every Apple product is they are solid both on the hardware and the design side. Unfortunately, this leads to high prices; Apple has no half measures, so it sells no cheap and less powerful versions of its notebooks.

Mac OS X

This article is not the proper place to offer a complete overview of Mac OS X. Just know that it is possible to run OS X perfectly from Linux through Mac-On-Linux, a project similar to Wine but with stable support for all OS X features.

Installing Linux

I successfully installed Gentoo Linux on the PowerBook, and the procedure was quite straightforward even if there are some issues to keep in mind. The tested machine is a Titanium PowerBook with a PowerPC G4 800MHz processor, 512MB of memory, 40GB of hard disk space, 15" screen (1280x854 pixels), Radeon Mobility 9000 video card, Gigabit Ethernet and wireless Airport card integrated.

You can follow the PPC general instructions on the Gentoo site to install Gentoo Linux. For the rest of this article, I focus only on Titanium-specific configurations.

Step 1: Bootstrap

Disk repartitioning probably is the most difficult part of the whole installation. You need to create empty space using the Mac OS X tool (from the installation CD) and then create Linux partitions using the mac-fdisk utility. The latter is not documented in the Gentoo install instructions, but you can find a good tutorial here.

Once you know the main mac-fdisk commands, you can follow the Gentoo instructions exactly and partition your disk in less than 10 minutes.

The Gentoo Linux installation requires many hours: during the first phase (bootstrap) the system compiles an optimized version of glibc, GCC, binutils and gettext, but the whole process can take up to five hours. To skip the compilation of the base system, we can use Stage 3 of the installation, which installs a precompiled version of the kernel. The result is a not totally optimized system, but it is quite usable.

Step 2: Configuration and Kernel Compilation

The configuration of the Gentoo system through the make.conf file is quite simple. Given that the PowerBook's hardware always is the same, we can find the right switches for the best performances. You have to write only the USE flags, reflecting the real use of your notebook. The right compilation flags for the PowerBook series are:

CFLAGS="-O2 -pipe -mcpu=7450 -maltivec -mabi=altivec
-mpowerpc-gfxopt -fsigned-char -mstring -mmultiple"

Kernel configuration takes a bit longer; in order to correctly handle PowerBook hardware, you have to use Benjamin Herrenschmidt's patched kernel, available as ppc-sources-benh. The 2.4.21 version has a little bug that crashes the system when you exit X (for example shutting the system), so the best choice for now is version 2.4.20-r10. The kernel configuration is quite perfect for the PowerBook, but some things differs from the x86 configuration, so here's a short description of the most important things (when not indicated, compile it in the kernel and not as a module):

Platform Support: select AltiVec Support CPU Frequency scaling. AltiVec is the SIMD (single instruction multiple data) PowerPC extension by Motorola that gives a noticeable boost to G4 performances. CPU frequency scaling is a useful PPC feature; you can scale the frequency of the microprocessor on the fly through the /proc filesystem. This means you can tune the working frequency based on the current CPU load and the battery status. For example, if you are writing something with your text editor and your battery is at 10%, you can set the CPU frequency to a low value and work for a long time.

Network device support: select Sun GEM and Apple GMAC support.

Networking options: to get MAC OS X networking up while running through Mac-On-Linux, you have to set up packet filtering. To obtain this, simply compile as modules network packet filtering and, in the section IP: Netfilter configuration, connection tracking, IP tables support, full NAT and MASQUERADE target support. Later, you need to set up the system to load these modules at boot.

Console drivers: to get X working with your video card, you have to select Open Firmware frame buffer device support and ATI Radeon display support (if you own a 12" or 17" PowerBook, install NVIDIA drivers following Gentoo documentation).

Macintosh device drivers: de-select Support for ADB raw Keycodes or you are not able to use you keyboard correctly. Select Support for PMU-based PowerMacs, power management support for PowerBooks and APM emulation. PowerBooks do not have an APM system, and they use the power management unit, which is its PPC counterpart.

Character devices: compile as modules Apple UniNorth support and Direct Rendering Manager with the ATI Radeon drivers, and de-select Enhanced Real Time Clock Support.

Sound: build sound card support and PowerMac DMA sound support as modules; later you can install ALSA drivers that work better than the OSS ones.

To complete the configuration of our system, we need to select which modules should be loaded at boot and edit the file /etc/modules.autoload. To activate Netfilter in order to let Mac OS X run, we need the following modules: ip_tables, iptable_nat, ip_conntrack and ipt_MASQUERADE.

Step 3: Graphical Environments and Desktop Stuff

After completing steps 1 and 2, we already have a GNU/Linux working system. For everyday use, anyway, we also could install the graphical environment (after all, this is not an high-end server). Compiling X and KDE takes about 10 hours. It is not a good idea to let the notebook run with 100% CPU load for such a long time, so remember that you can stop the compile process at any time simply by pressing the Ctrl-C key combination and powering off the notebook. Later, you can restart the process by giving the same initial command (emerge kde, for example), and it starts compiling from the last packet it was working on when you stopped. It picks up from the beginning of the packet; no half compilation results are stored. This lets you split the whole process into two or three parts, thus obtaining the desired result without melting the notebook hardware.

The sound card works well with the ALSA driver: to install them, follow Gentoo instructions and remember that you need the PowerMac sound driver.

I recommend buying a three-button USB external mouse, because the one-button touchpad on the laptop is difficult to use. You can emulate the right and central buttons with two keyboard buttons (while you are waiting your external mouse to be shipped), just by adding the following lines to the /etc/sysctl.conf file

dev.mac_hid.mouse_button_emulation = 1
dev.mac_hid.mouse_button2_keycode = 68
dev.mac_hid.mouse_button3_keycode = 87

These lines map the two buttons on the F10 and F11 keys, respectively.

The keyboard has another interesting issue: notice the lack of the AltGr button. The solution is quite simple: through the small xmodmap utility you can find the keycode of every key on the keyboard. Then you can assign a specific function or map to it by writing some lines in a .Xmodmap file stored in your home directory. For example, the keycode of the Apple key is 115, so you can write keycode 115 = Multi_key in the file, and the Apple key then will work as AltGr.


The installation procedure is quite simple, as you can see, but we cannot say that Linux support is total and stable on this Apple hardware. We are walking on the edge right now. The work of Ben Herrenschmidt and people at is really impressive, and I hope in six months we will see complete and homogeneous support for sound, buttons, external monitors and the like.

The Apple notebook is worth its price, and you surely will not be displeased with it. Once Linux has been installed, you have access to all of the software you use on your x86, but it also offers you the possibility of running Mac OS X software at a native speed. What do you think about running Microsoft Office for Mac OS X in a Linux window?


Apple Home Page

AltiVec Home Page

A short page on PowerBooks and Linux

Titanium G4 and Debian

PowerBook G4 12" and Debian

iBook and Debian Installation Directly from the Internet

PowerBook: Debian, Yellow Dog and Gentoo Installation

Ben Herrenschmidt Home Page at PenguinPPC

Leonardo Giordani received his degree in Telecommunication Engineering from Politecnico of Milan - Italy in February of 2003. He currently works in the field of remote sensing satellites at Tele-Rilevamento Europa in Milan as a researcher and development manager. He has worked almost exclusively with Linux since 1999 and is interested mainly in operating systems internals, C and Python programming and software development.

Load Disqus comments