LinuxPPC
on the PowerBook G3

[Cette page est aussi disponible en français]


[R4/R5 differences]  [Installing LinuxPPC]  [Booting LinuxPPC]  [The PowerBook G3 trackpad]  [Playing audio CDs]  [Configuring X]  [PCMCIA]  [PowerBook G3 kernel patches]  [The other side of the coin]  [Useful links]


A note on different versions of the PowerBook G3

This page concentrates first and foremost on the PowerBook G3 Series computers. If you're not quite sure which version you have, follow this link for more information on how to identify your PowerBook. Currently, there are 4 different versions of the PowerBook G3 from Apple. The first (original) PowerBook G3 is significantly different, both in appearance and in hardware, from the PowerBook G3 Series first released in May 1998.

The different models of the PowerBook G3 Series computers use the following video controllers:

Release date Code name Family
number*
Video controller VRAM CPU speeds
[MHz]
May 1998 Wallstreet M4753 ATI 3D RAGE LT 4M 233/250/292
August 1998 Wallstreet II M4753 ATI RAGE LT 4M(?) 233/266/300
May 1999** Lombard M5343 ATI RAGE LT 8M 333/400

A little more information can be found at Apple's Tech Info Library.

*The family number is printed under the PB G3, on the plate opposite the serial number.

**See this page for information on how to get USB and Ethernet working on the Lombard.


What's the difference between LinuxPPC R4 and R5?

The main difference is that R4 is based on the glibc-1.99 libraries, while R5 is based on glibc-2.1. Since glibc-1.99 and 2.1 are incompatible, it means that all system binaries and libraries must be replaced, and that all software must be recompiled and linked against the new libraries. Thus, upgrading from R4 to R5 actually means doing a complete reinstall of LinuxPPC.

Another difference between is of course that R5 comes with a lot more software than R4.

Although it can be a lot of work doing the R4->R5 upgrade, it will probably pay in the long run, as more and more software will depend on glibc-2.1.


Installing LinuxPPC

Note: Before you insert your LinuxPPC R5 CD into your CDROM drive, you should make sure that the autostart feature of QuickTime is switched off, as the original batch of LinuxPPC R5 CDROMs are infected by the Autostart worm. However, there have been no reports on this worm actually spreading to harddisks from the R5 CDROMs. Read also this announcement from LinuxPPC Inc. for further information.

Although I will primarily refer you to The LinuxPPC Installation and User Guide for instructions on how to install LinuxPPC, I will outline the procedure below, and give some (hopefully) useful hints and comments. Before you start the installation process, you should also check if there have been released any updates that applies to you.

If you have an expansion bay harddisk, it's possible to install LinuxPPC on it. Doug Williams explains how.

In addition to the partitions recommended in the LinuxPPC installation guide, I will recommend that you create a small HFS partition (32 megs, for example) in addition to your primary HFS partition. This partition might come in handy when you're transferring files from Linux to Mac OS. Using this as the only HFS partition writeable from Linux is a good safety measure against file system corruption on your primary Mac OS partition. Personally, I have been burnt by this a couple of times, forcing me to do complete reinstalls of Mac OS. Nowadays, the Linux HFS support seems pretty much reliable, so chances are you will not be affected by this. However, it's better to be on the safe side.

Here's how I have partitioned my 4.8G hard drive, in case you wonder:

Partition File system type Label Mount point Size
/dev/hda7 Apple_HFS MacHD /mnt/mac_hd 600M
/dev/hda8 Apple_UNIX_SVR2 root / 150M
/dev/hda9 Apple_UNIX_SVR2 usr /usr 1.3G
/dev/hda10 Apple_UNIX_SVR2 swap   96M
/dev/hda11 Apple_HFS TinyMacHD /mnt/xfer 32M
/dev/hda12 Apple_UNIX_SVR2 home /home 2.7G

Note that the size of my primary Mac OS partition is only 600M. The reason is that I hardly ever use Mac OS, and thus prefer allocating precious disk space to Linux. Also note the strange positioning of the small 32M HFS partition (/dev/hda11); it's squeezed in between the swap space and the home partition. Originally, I had a 128M swap partition, but after experiencing file system corruption on my Mac OS partition due to bugs in the Linux HFS driver, I reduced my swap space to 96M, and squeezed in a 32M HFS partition. I now use this small partition for writing data I need in Mac OS (like new kernels, etc).

The following is only valid for LinuxPPC R4:  The LinuxPPC R4 installer annoyingly (IMHO, YMMV) sets /usr/local to be a symbolic link to /opt, unless you have created a separate /usr/local partition. If your root and/or /opt partition is small, you might fill up the partition very soon if you compile and install a lot of software in /usr/local yourself. Therefore, it might be a good idea to remove the symbolic link, and put /usr/local on the /usr-partition. If you do this, please be careful in determining exactly what files and directories belong in /opt, and what belongs in /usr/local. This has been fixed in R5; egcs and KDE (and Gnome) are now installed under /usr instead of /opt.  ]

Q: I have R4 installed. Do I have to repartition my hard drive to install R5?

A: No. It is perfectly possible to upgrade from R4 to R5 without repartitioning or reformatting your entire hard drive.

If you have enough disk space, it might be a good idea to a trial installation of R5 on a partition where it won't interfere with R4. As for me, I first did a trial installation of R5 on my /home partition, which had enough free disk space. I made sure to not reformat any of the partitions, and let / be mounted on /dev/hda12, which is where my /home lives. I left all my other partitions alone (except the swap space, of course), so R4 would not be affected. Of course, installing R5 on the /home partition makes a lot of mess there, but it's very easy to remove afterwards (just "rm -rf" the R5 directories, taking care not to remove your user directories. Just make sure you back up all your important data first!). Doing it this way, it is a trivial matter to go back to R4 in case things went wrong.

Before installing R5 "for real", it may be a good idea to make a backup copy of your /etc directory on a safe place, as it will be much easier to bring your R5 installation up to where you left your old R4 if you still have access to your old /etc. If you have lots of source code and SRPMs in /usr/local and /usr/src, it might be a good idea to back up these to a safe place as well. I did, and this helped me get back to where I "left" R4 in a relatively short time.

What I ended up doing when replacing R4 with R5, was to reformat only my / and /usr partitions (after having made backup copies of /etc and source code, of course). My /home partition was left as it was under R4, as there was no point in reformatting it.

Which installer to use?

The default installer is X-based, and simplifies the installation process, making it less tedious, compared to the RedHat installer. However, the RedHat installer gives you a much more fine-grained control over the installation, and lets you select or reject individual packages. If you prefer to use the RedHat installer, add redhat to the kernel arguments in BootX.

Problems with the installation of the X server

Unfortunately, Xconfigurator does not seem to work properly on the PowerBook G3 Series, so the generated configure file for XF68_FBDev will not work. Thus, when you reboot, you will get a lot of error messages about gdm "respawning too fast". This is because XF68_FBDev cannot start due to the bogus parameters in /etc/X11/XF86Config, generated by Xconfigurator. To solve this problem, you can for example do the following: When you reboot into Linux, add single to the kernel arguments in BootX. This will drop you into single user mode. Edit the file /etc/inittab, changing the default runlevel from 5 to 3 (change the line that reads "id:5:initdefault:" to "id:3:initdefault:"). Now you can reboot, or just exit the shell to continue the boot process.


Booting LinuxPPC

Open Firmware is somewhat broken on the PowerBook G3 Series, and this prevents you from booting Linux directly from the internal IDE hard drive. Instead, you have to boot via Mac OS, using BootX. BootX comes in two flavours, an application you start from Mac OS, and a system extension, which is loaded early in the Mac OS boot process.

BootX

You can find the latest version of BootX at Benjamin Herrenschmidt's web page.

The kernel arguments

When booting LinuxPPC, you can pass information to the kernel via its command line, giving it information about your hardware, thus tuning it better to your computer, or to modify its default behaviour. Here are some kernel arguments you might want to use:

root=/dev/hdaN
Let /dev/hdaN be the root partition (mount it as /). BootX inserts this option for you, based on what you put in the Root device box. The root partition is where the system critical stuff is installed, like kernel modules, system binaries, and other important stuff, and it is the first partition to be mounted during the boot process. Other partitions (/usr and /home for example) gets mounted later in the boot process.
video=atyfb:vmode:14,cmode:32,mclk:71
This tells the kernel to use the atyfb video driver, giving you accelerated graphics when you use X. The vmode:14-part means "use 1024x768 resolution with 60Hz vertical sync rate", while cmode:32 means "use 32 bitplanes". Read the manpage for vmode for more information about the different video modes. The last option, mclk:71, is a timing parameter for the video hardware, and 71 seems to be the value that minimizes "snow" and unwanted video artifacts on my screen*. Be careful not to set this too high, as you might damage your hardware. If you have problems getting X up and running, you might want to check the "No video driver" box. This inserts video=ofonly at the end of the command line, overriding the video=atyfb:...-part. It will give you unaccelerated graphics, but X might be much easier to get up and running. See below for information on how to set up X.
adb_buttons=103,111
Use keys F11 and F12 as the middle and right mousebuttons, respectively. You might want to choose another pair of keys.
hda=autotune
Autotune the IDE interface chipset to increase the harddisk data throughput. Same as hdparm -p /dev/hda. Caution: read the hdparm manpage before you use this option. If you use it, you're on your own, and I cannot be blaimed for any filesystem corruption that might occur. That being said, using this parameter might speed up the transfer rate from/to the harddisk dramatically.
single
Normally, you don't want to use this, but you can add it to the kernel arguments to boot Linux in single user mode (runlevel 1). Can be used in case you need to boot without going directly to runlevel 3 or 5, for example to do repairs in case your system is messed up.

There are many more kernel parameters one can play with, but the above gets the job done for me.

*I have seen many claims as to which values will work, but mclk:71 works for my PowerBook. It may or may not work on your computer. If you need to use the mclk option, try a few different values (this requires alot of rebooting), but take care not to set it too high, as it might potentially damage your hardware. Also try without the mclk option.


The PowerBook G3 trackpad

Trackpad tapping

The PowerBook G3 trackpad can be used in much the same way under LinuxPPC as under Mac OS, where you can tap the pad with your finger instead of using the mouse button. Some people (including me) love this feature, while others hate it. Under current kernels (2.2.x), tapping is enabled by default, and this annoys the ones who don't want this feature. To disable the trackpad tapping permanently, download this trackpad utility, compile and install the executable, and put the following line in /etc/rc.d/rc.local:
trackpad notap
This will disable tapping when you boot Linux. There are other options to the trackpad tool you can experiment with (notap|tap|drag|lock) if you don't want to disable all tapping, but just the drag and draglock features.

GPM

Gpm is a mouse server and cut and paste utility for the virtual consoles. In other words, it lets you use your trackpad when X is not running.

For R5: Gpm should be included by the R5 installer, but if it didn't, you only have to install the package gpm-1.17.5-3.ppc.rpm (or later). You will find it on the R5 CD or at one of the LinuxPPC ftp mirrors.

For R4: To activate GPM during boot, simply insert

gpm -t bm
in the file /etc/rc.d/rc.local.

Emulating mouse buttons

Since many X applications require at least 2 mouse buttons, one is presented with a problem when using the PowerBook (or any Mac). How do one represent the other two mouse buttons? The solution here is to let two keys on the keyboard emulate the rest of the mouse buttons. Since I am left-handed, I chose F11 and F12, so I can use the trackpad with my left hand, and press the "mouse buttons" with my right hand. However, you might choose to use other keys for this. You do it like this: Pick two keys that you feel comfortable with using as mouse keys, and make sure that these keys won't remove any important functionality from your keyboard. Then, in a virtual console (do not use X), issue the command "showkey -k", and write down the keycodes you get from the keys you selected. Then reboot, and add the following to the kernel arguments in BootX:
adb_buttons=M,R
where M and R are the keycodes for mouse button 2 (middle) and 3 (right), respectively. Now boot Linux. You can now use the two specified keys as mouse buttons, instead of the cumbersome option-2 and option-3, which is the default.

Playing audio CDs

If you don't get any sound when playing audio CDs on your media-bay CDROM player, try the following procedure, which works every time for me.

First check your volume using kmix or xmixer. If it's low, try cranking up the volume. If you don't get any sound, it's probably because you need to change some settings under Mac OS that LinuxPPC use. Try rebooting into Mac OS, and use the control strip to select the media-bay as sound source. Next, turn up the system volume, also using the control strip. 75% or so works fine on my PBG3. Boot LinuxPPC, play a CD, and adjust the volume using kmix or xmixer. You should now get sound throughput from your CD.

Note: Since an audio CD does not contain a file system, you do not "mount" it like you would do with a CDROM. The software CD players, like kscd and its relatives, just tells the CDROM drive to read the audio CD directly. The audio D/A conversion is being done in hardware, on the CDROM drive, and the resulting analog signals are then being routed to the internal loudspeakers or to the line out connector.


Configuring the X server

On the PowerBook G3 Series, there are two X servers that you might want to use; Xpmac and XF68_FBDev. Xpmac is a PowerMac-specific server running on both LinuxPPC and MkLinux, while XF68_FBDev is a generic X server for the Linux frame buffer device, which will work only for LinuxPPC.

Common for both X servers is that you have to do the following: Let /usr/X11R6/bin/X be a symlink to Xwrapper, and /etc/X11/X be a symlink to /usr/X11R6/your_x_server, like this:

# cd /usr/X11R6/bin  
# ln -s Xwrapper X
# ls -l X
lrwxrwxrwx   1 root     root            8 Jun 17 15:16 X -> Xwrapper
# cd /etc/X11
# ln -s /usr/X11R6/bin/your_x_server
# ls -l X
lrwxrwxrwx   1 root     root           20 Jun 19 20:31 X -> /usr/X11R6/bin/your_x_server
where your_x_server is either XF68_FBDev or Xpmac.

If Xpmac is not already installed, you will find the XFree86-Xpmac rpm on the LinuxPPC install CD and on the ftp.linuxppc.org ftp mirrors. Below is a little more information about these two X servers.

XF68_FBDev and the XF86Config file

The file /etc/X11/XF86Config tells your XFree86 server (in this case, XF68_FBDev; Xpmac does not need this file) details about your video hardware, monitor, keyboard, mouse, fontpath, etc. The Xconfigurator utility is responsible for generating an XF86Config file for you, based on information you feed it, and data it gets from probing the hardware. Unfortunately, as per writing, Xconfigurator just doesn't work very well on the PowerBook G3 Series, and generates an XF86Config file that does not work. Xautoconfig is a utility that is supposed to do a much better job, but not even this is able to generate a working configuration file for my PowerBook G3.

For the above reasons, I made a new XF86Config, based on my old (working) R4 file, where I put the relevant parameters into an otherwise non-working file generated by Xautoconfig. Here is the result - an XF86Config file that works very nicely on my PowerBook G3. Of course, YMMV... :-) To accompany this file, I feed the following kernel arguments to BootX (remember to uncheck the "No video drivers" box):

video=atyfb:vmode:14,cmode:32,mclk:71
Read more about the kernel arguments under the "Booting LinuxPPC" part above.

Getting Xpmac up and running

Some people may ask why one should run Xpmac instead of XF68_FBDev. In my case, the reason is simply that Scilab have problems with the 32 bitplane mode offered by XF68_FBDev, while it handles the Xpmac's 24 bitplane mode without problems. Since using 16 bitplanes is not an option, and since the 24 and 32 bitplane modes really are the same, I prefer using Xpmac.

On the PowerBook G3 Series, the atyfb video driver has a tendency to throw "snow" up on the screen, as well as to present a console that is "jumpy" when scrolling. Therefore, I prefer to use the Open Firmware video driver (which is selected when checking the "No video driver" box in BootX), even if this makes the console noticeably slower. The XF68_FBDev X server is not accelerated when using this frame buffer device, so one can use the accelerated Xpmac instead, with options that force acceleration for the ATI RAGE PRO (Mach64) display controller that's in the PowerBook G3 Series. Although this works beautifully under R4, Xpmac strangely enough refuses to cooperate with the OF frame buffer under R5. The problem is that under R5, Xpmac cannot seem to find the RGB database file /usr/X11R6/lib/X11/rgb.txt when one asks it to do accelerated graphics on the OF frame buffer device. Go figure. If you know what causes this problem, or know how to solve or work around it, I will appreciate it greatly if you send me an email.

To get Xpmac up and running, set up the symlinks as described above, and put the following in the .xserverrc file in your home directory:

/usr/X11R6/bin/X -fp "unix/:-1" -mode 14 -depth 24
There are many other options you can play with; type "Xpmac -help" in a shell to get a listing, or read the Xpmac manual page. I feed a few extra arguments to Xpmac, in order to set the keyboard repeat rate I want, as well as a mouse button 2/3 emulation that is more according to my own taste. The actual .xserverrc file I use looks like this:
/usr/X11R6/bin/X -fp "unix/:-1" -mode 14 -depth 24 -ar1 400 -ar2 20 \
    -middlekey 111 -rightkey 119 -nooptionmouse
This means the following: -ar1 400 -ar2 20 sets the delay before keys start autorepeat to 400 milliseconds, and then they will autorepeat with a rate of 20 characters per second (this is the highest rate available, I think). -middlekey 111 -rightkey 119 sets F11 to be mouse button 2 (middle), and F12 to be mouse button 3 (right). The keycodes for the keys you want to use as mouse keys also has to be specified in the kernel command line. More about this below. -nooptionmouse forces F11 and F12 to act as mouse buttons without me having to press the Option key. To get accelerated graphics using Xpmac when using the OF video driver, one would theoretically just add the option "-mach64 to the other arguments. But as stated above, Xpmac refuses to cooperate as nicely under R5 as it did under R4, so it won't work :-(

If you have really been paying attention, you will see that I specify keycodes 103 and 111 as mouse buttons 2 and 3 in the kernel commandline, while I tell Xpmac to use keycodes 111 and 119. The rule here seems to be that you must add 8 to the keycodes you specify to the kernel before you feed them to Xpmac. I'm not quite sure why this is so. If you can enlighten me, please send me an email explaining the reason.

[ Under R4, the following .xserverrc should work fine when using the OF video driver:

/usr/X11R6/bin/X -mach64 -mode 14 -depth 24 [other command-line arguments]
If you use the atyfb driver under R4, just remove -mach64.  ]

Further reading

For more information, read the manual pages for XFree86, XF68_FBDev, Xpmac, XF86Config.


PCMCIA support

If you want to use PCMCIA-cards on your PowerBook, you need to install some kernel modules and a kernel patch.

The easy way to do it is to download and install the following:

  1. LinuxPPC R4: This kernel image (version 2.2.8) and these kernel modules. This kernel also has support for the volume and mute buttons on the PowerBook G3 Series. This is a fairly generic kernel, and should also work on other PowerBooks. The kernel is built using this config file. The PCMCIA modules are contained in this RPM.
  2. LinuxPPC R5: Either
    • a PowerBook G3 Series specific 2.2.12 kernel image (gzipped or uncompressed) with kernel modules, System map file (put it here: /boot/System.map), and the .config file. I used the 2.2.12 sources from ftp.kernel.org to build this kernel, and I stripped away stuff you probably won't need on the PBG3 (like redundant video drivers, etc). Additionally, you need to install this RPM, which contains all the necessary PCMCIA modules and configuration files.
    • or a generic PowerMac 2.2.10 kernel image (gzipped or uncompressed), with kernel modules, System map file (put it here: /boot/System.map), and the .config file. This kernel is very close to the default PowerMac kernel. In addition, you need this RPM, which gives you PCMCIA modules and configuration files for this kernel.
    For R5, you will need to install the XForms library first.

On the other hand, if you want to compile everything by yourself, you have to

  1. Apply this patch from Paul Mackerras to your kernel source (without this patch, the kernel will freeze if you insert a PCMCIA modem card). Make sure you have CONFIG_SERIAL set to y or m in your kernel configuration. If you use make menuconfig to configure your kernel, you set this option by enabling "Character devices -> Standard/generic (dumb) serial support". Also make sure you have enabled module support. You can use this config file (which was used to build the kernel above) as a starting point. Recompile your kernel and kernel modules, and install them.
  2. Reboot with your new kernel (the PCMCIA package you are about to compile in the next step will read some information from your running kernel).
  3. Download and install this SRPM. Before you build the RPM, you must make the following modifications to /usr/src/redhat/SPECS/pcmcia-cs.spec:
    • Line 4: Change "Release: 221" to "Release: 22x"
    • Line 65: Change "/lib/modules/2.2.1/pcmcia" to "/lib/modules/2.2.x/pcmcia"
    (Use an x that reflects your kernel version).
  4. Build the PCMCIA modules with the command
    rpm -bb /usr/src/redhat/SPECS/pcmcia-cs.spec
    Then, install the RPM package you just built:
    rpm -i /usr/src/redhat/RPMS/ppc/pcmcia-cs-3.0.8-22x.ppc.rpm
  5. Reboot, or start the PCMCIA service like this (you must be root to do it):
    /etc/rc.d/init.d/pcmcia start
Now you can start playing with your PCMCIA cards :-)

PowerBook G3 kernel patches

The following patches (written by me) are relative to the 2.2.8 kernel from ftp.kernel.org, and make life a little easier when using LinuxPPC on the PowerBook G3:
  • A patch implementing support for the mute and volume buttons.
  • A patch removing the loudspeaker hiss from the PBG3 during boot, as a silent alternative to "echo ^G" in /etc/rc.d/rc.local. Note: This patch is very ad hoc, and not a very good solution, even though it works. Something else needs to be done with the DMA sound driver (drivers/sound/dmasound.c) to make it really shut up after finishing sound output.
If you don't know how to apply the patches, you can download patched source files from here: drivers/macintosh/mac_keyb.c, and drivers/sound/dmasound.c. Make backup copies of the old files, and replace them with these. Then recompile your kernel. Although these patches are for the 2.2.8 kernel, they should be relatively easy to apply to other 2.2.x kernels.

If you intend to use a PCMCIA modem, you will need this patch from Paul Mackerras. It basically stops the serial driver from probing for serial ports.


The other side of the coin...

Of course, Linux isn't perfect. Claiming anything else, and at the same time bashing Microsoft Windows and Mac OS would be a very dishonest thing to do. But then, I've never said that Linux doesn't have any flaws. Limiting myself to LinuxPPC on the PowerBook G3, here are a few things that annoy me:
  • Even though sleep support is now implemented on the Wallstreet PBG3s, the support is not complete yet. First, it only works with the atyfb video driver, which means one cannot use offb (checking "No video drivers" in BootX) if one wants to put the PowerBook to sleep. Also, after waking up the PowerBook from sleep, CD sound no longer works.
  • The Caps Lock key is broken by design1, so you cannot remap it to something useful (like Control). This is a hardware issue and, as far as I know, there is nothing one can do about it.
  • The left and right option keys give the same keycodes to the kernel, so you cannot remap for example the right option key to something else. The same goes for the left and right shift keys. As with the Caps Lock key, this is a hardware issue.
1Try starting up the xev utility, and place the mouse pointer in the window that pops up. Now, try pressing any other key but Caps Lock on your keyboard. You will see that when you press the key down, you get a key down event, and when you release the key, you get a key up event. Now try the same thing with the Caps Lock key. You'll see that when you first press the key, you get both a key down and a key up event. When you release it, you get nothing. Next time you press it down, you also get nothing. But when you release it again, you get both a key down and a key up event. This effectively prevents you from remapping it to for example Control, but it still works perfectly as a Caps Lock key...


Useful links

  • The Linux Directory. You'll find lots of useful links here.
  • LinuxPPC Inc. make and sell CDs with the most popular Linux distribution for PowerPC computers.
  • The home of the Linux/PPC project.
  • The LinuxPPC Mailing list archive. These archives contain a lot of information about LinuxPPC, and if you have a problem, you can often solve it by searching these archives.
  • Here's where you get the latest version of BootX. Hosted by its author, Benjamin Herrenschmidt.
  • Freshmeat.net - the place to find out about all the newest and coolest software for Linux.
  • Getting sick and tired of ad banners and those really obnoxious animated gifs whenever you surf on the web? Then Junkbuster is just the thing for you. It's a web proxy running nicely and quietly in the background, filtering out all the junk you don't want, and generally being a huge timesaver if you're on a slow connection (and even if you're on a fast connection!). A slightly modified version can be found at this place, with a pre-compiled RPM for LinuxPPC R4. An RPM for R5 is available from here.

If you have comments, corrections or additions to the information presented on this page, I welcome your feedback (send it to <Alvin.Brattli@phys.uit.no>).

Last modified: 1999-11-27.

Alvin Brattli

[This site VI powered]

:wq