tHog
Gentoo on a Powerbook G4

Leela

Powerbook G4 A1106, 1.67 GHz, 21 GB

Introduction

Received on 2010-04-23 after being found on Huuto.net. I would have preferred the A1138 with even better specs, but the best Powerbooks are generally quite pricey and hard to find, so I settled for this one, as it is not far behind.

Sold in May 2016, following display failure.

Configuration essentials

The Powerbooks are a somewhat established niche among hardware geeks, and the respective Linux sites abound. Besides the usual Gentoo PowerPC knowledge, here is what I consider most important for getting it up and running. This probably applies to most Powerbooks with Radeon graphics, and other Linux distros.

Kernel drivers

radeonfbNecessary for backlight control
ide-pmacThe new libata driver works, but yaboot takes a little extra configuration, so the old driver is a safer option.
therm_adt746xHighly recommended for cooling. It is used to lower the temperature limits where fans kick in. The hardware defaults are around 80 °C, which may be a little too much, especially on your lap.

Daemons

pbbuttonsdBacklight control, including blanking on idle. DPMS settings in Xorg do not seem to help at the moment. The daemon has plenty of other uses.
powernowd or similarSimulate conservative/ondemand cpufreq governors, as they do not currently work. Not really necessary, I usually prefer simple min and max settings on my machines.

Files

Graphics

Using the above setup of radeonfb and the usual Radeon DRM modules, graphics acceleration works almost perfectly. There are a few glitches in OpenGL output, though. These were not present when using kernel modesetting, but then KMS has other drawbacks at the moment (Linux 2.6.33.3). The non-KMS setup works for me now, as I do not use much 3D accel.

[2011-04-02] Since xorg-server 1.10 changed a few things, I am currently running fine without a xorg.conf. Input devices are handled with the evdev driver, and I use setxkbmap in .xinitrc for the correct layout. I also found that the kernel option radeon.agpmode=1 helps when testing KMS, though it does not fully work yet.

[2012-04-09] Succesfully booted with KMS using radeon.agpmode=-1 (PCI mode). Screen blanking works with conventional DPMS settings, but they are not necessary if pbbuttonsd is used for blanking. There are problems with brightness adjustment via pbbuttonsd, it seems strangely laggy/jerky. However, this can be somewhat mitigated by adjusting LCD_FadingSpeed. In general, X feels slower, probably due to the PCI bus mode.

Mesa needs to be compiled with different options to get OpenGL up to speed. UMS needs USE=classic while KMS needs gallium. In fact, since version 8.0, classic is no longer available.

Another boot without the agpmode slowdown was fine, until trying mplayer -vo gl crashed X. Text console was fine, but restarting X only produces garbage left over from the previous session -- this has happened before when trying KMS. So back to UMS for a little stability, it is my main workhorse after all.

Backlight blanking

This has been my biggest problem so far, and none of the solutions is quite perfect. In short, the Xorg Radeon driver cannot turn off the backlight via DPMS. One solution is to use the unaccelerated fbdev driver, since radeonfb itself can blank it.

A better solution is to use pbbuttonsd for blanking. It is what I use now, in order to use the fully accelerated Radeon driver. Unfortunately, there are problems in getting the light back on, probably due to conflicts between the two power management systems.

In case you get into this situation, simply switch to a VT and back. Radeonfb will reset the graphics mode, and so will X. However, there is a smoother solution: disabling DPMS and blanking altogether in X:

xset s noblank
xset s 0
xset -dpms
The only drawback is that some power savings may be lost. Besides the backlight, DPMS also invokes downclocking of the Radeon GPU, depending on the driver options in xorg.conf. However, this part of the driver is not yet complete, and it can even lead to bugs of its own, so the savings are questionable.

[2010-05-17] Found a patch for backlight control under Radeon kms. It does not currently work (tested on 2.6.33.4 and 2.6.34) but at least someone is working on it.

Kernel modesetting benefits

Whatever the current status, KMS is the future direction of Radeon driver development. One of the exciting plans is to accelerate video decoding; this machine cannot play 720p H.264 videos on its CPU alone. A slight drawback from my previous laptop which could just about do it, with somewhat lower quality. I do have a separate machine for these things, but of course it is a nice bonus if you can watch HD video on the road.

As you probably know, KMS is incompatible with accelerated framebuffer drivers. In fact, it provides its own fb. Unfortunately, the current Radeon KMS does not seem to handle backlight blanking properly.

One possible benefit is the xvidix output of MPlayer. For some reason, xvidix on ppc radeons is distorted, but KMS fixes that. The distortion looks like the image is split into vertical stripes, all of which are horizontally flipped; cvidix seems fine. However, vidix is mainly a faster alternative to Xvideo, so it may not give much boost to overall playback.

[2012-04-09] The video decoding interface is VDPAU, as confirmed by by Xorg log, and it should be directly usable with MPlayer. However, some library work is apparently needed.

Gamma

Someone mentioned that the Powerbook display needs a gamma value of 0.75, instead of the default 1. It may or may not be better, but it is worth experimenting, either in the Monitor section of xorg.conf, or with the xgamma command.

Input devices

This quote on my past work machine is equally valid here. The comparison is to my former workstation laptop Sigmatrix.

There is some unused space on the sides though, which makes you wonder if they could have fitted a proper keyboard instead. I miss the wonderfully logical Home-PgUp-PgDn-End column on the right side ... I guess nobody uses these anyway, since keyboard navigation is so 1960s :-/

Apple keyboards in general seem to have fewer keys, but there is some remapping you can do to make things easier. Unfortunately, one such procedure is mouse button emulation, so you lose 2 of the already scarce keys to get buttons 2 and 3. In my case, /etc/sysctl.conf has

# powerbook mouse buttons 2 & 3 emulation
dev.mac_hid.mouse_button_emulation = 1

# low enter (next to right apple) = right
dev.mac_hid.mouse_button3_keycode = 96

# right apple = middle
dev.mac_hid.mouse_button2_keycode = 126

In addition, I like to have an AltGr. This is stored in .xmodmap, which in turn is called by the program xmodmap in my .xinitrc.

! Left Apple works as AltGr

!for kbd driver
!keycode 115 = ISO_Level3_Shift Multi_key

! for evdev driver
keycode 133 = ISO_Level3_Shift Multi_key

Not quite the usual position, but it seems logical to have the mouse-emulation buttons together. Also, it would make tactile sense to move Alt next to space, but these mappings only work in X, and I like to keep things as simple and general as possible.

Linux geeks may miss the (Magic) SysRq key; some Apple keyboards have an F13 which does the same under Linux, but here the functions end at the usual 12. I have remapped the eject key for this purpose, as you can eject the slot-loading drive via other software means. Linus himself proposed a patch, and I have munged it into a working version for 2.6.33 (see above).

Power management

Suspend to ram works as it should, when you close the lid, press the power button briefly, or when the battery runs low. These are handled by pbbuttonsd, and thus configurable. Suspend has not usually worked in recent laptops running Linux, as they have a buggy ACPI tailored to Windows. In contrast, my first Linux laptop had a working suspend via APM.

There are many ways of monitoring the battery status. In the past I have used apm, from the package apmd, and this is again possible via the kernel module apm_emu.

On those Linux machines that cannot suspend to ram, I have often used hibernation. The kernel manages suspending to disk without any special hardware features. It would be handy with dual booting, but it does not quite work on this machine now. It is probably a graphics driver issue, since the machine gets up and running behind a garbled screen.

Networking

The b43 wireless driver is already in the kernel, fully working. The firmware must be downloaded separately, as it cannot be redistributed by open source projects, but it is in fact very straightforward.

The Ethernet is a Sun GEM, just like in some Power Macs. Despite the gigabit speed, it is located in the 10/100 section of Linux Ethernet drivers.

The Bluetooth looks like a standard device using the btusb driver. I have not much use for BT so I have not tested it properly.

Dual booting with OS X

During the initial Gentoo install, I left an empty 20-GB partition at the end of the hard drive. Later I got around to installing OS X 10.5.6, and it went into the partition nicely, without disturbing any others. It only required an "erase" step (i.e. filesystem creation) prior to the actual OS install. Naturally, yaboot reinstall was in order afterwards to re-enable booting into Linux. I set defaultos=linux and macosx=/dev/hda7 in /etc/yaboot.conf; in my case the empty partition was number 6, but OS X created a small partition there, before the actual OS. (From my very limited OS X experience it seems that these are for initrd-style drivers.) After the core OS updates, there is 8.5 GB of empty space, so the 20 GB was a good guess for getting a usable system without spending too much extra.

Usability experiences

I'm spoiled by the colour and contrast of the display, and the solid feel of the keyboard. These were not immediately obvious, but going back to my former laptop feels incredibly flimsy and washed out. The changes in keyboard layout are a slight drawback, but there is always a change between laptops anyway.

Still, the enter and arrow keys feel too small, and the lack of Home/PgUp/PgDn/End is noticeable. These are available via Fn+arrow keys, but it takes two hands, one of which may be on the mouse. Delete is similarly Fn + Backspace.

There is some comfort in the fact that current x86(-64) laptops do not have any better keyboards. Unless you choose a large one with a number keypad and all.

Memory slot failure

[2010-05-27] This morning, the machine failed to return from sleep. Upon reboot, the firmware "bong" sound is missing (nice) and the OS only sees 1 GB of RAM (not so nice). Apparently, this is the dreaded lower memory slot failure that many a Powerbook has suffered. It was recognized by Apple and a fix was provided, but the offer seems to have ended. Even a petition is out there :)

The serial number of this machine is W85060HRRG4, which falls into the problematic range. It may be that this has already been repaired once, as the problem appears to be recurring, but the previous owner refuses to answer my emails.

The problem may be due to solder joints only (hello ROHS!), in which case it is theoretically possible to repair it by myself. However, some sources also refer to firmware problems, as also indicated by the lack of the "bong". I have tried a PMU reset and the procedures described in MacFixIt, to no avail. The lack of a startup sound is probably a genuine diagnostic sign of hardware failure, then.

Interestingly, Apple Service Diagnostic disc 2.5.7 shows that both SODIMMs are present, with identical characteristics except for size: the faulty slot has 0 MB. However, both have a variable called "actual-size", equal to 1024 MB as it should. So most of the solder traces are probably fine, but something essential is missing.

After some further Open Firmware hacks, I am no closer to a solution, but at least I have learned a little about OF. Parameters and the rc file can be easily set from Linux, using the nvset* tools from yaboot. Even the startup sound volume is configurable... in principle, not in practice :(

[2010-05-28] Called Apple support, they confirmed there once was a replacement program, and the only way to fix this now is by yourself. After re-seating, the lower memory slot seems to work occasionally, and I am looking into BGA solder reflow instructions ;)

[2010-05-30] On a slightly positive note, removing the unused SODIMM shaved off 1 to 2 watts of power consumption. This is mostly idle consumption, as I am not testing these with any memory-intensive work. The faulty slot draws pretty much the same power as an idling one, so it must really be removed.

Libata vs. IDE/ATA

[2010-06-02] With the macio driver, Power Macs have joined the libata framework for IDE/ATA drivers. The old drivers are still available and work fine, so there is no huge benefit in the update. However, for the bleeding edge tweakers, the new ones are fine too ;)

Only yaboot needs a little extra configuration with libata. In fact, the problem is with the ofpath command, which wrongly assumes that /dev/sdaX are SCSI devices. So you have to manually specify the OF path for the yaboot "boot" partition and possibly others. This should not be particularly difficult, as you should already have the correct device= entry for the whole disk in yaboot.conf. From there, you only need to append the partition numbers.

The "boot" partition is accessed both by Linux and OF, so it needs both entries:

boot=/dev/sda2
ofboot=/pci@f4000000/ata-6@d/disk@0:2
On the other hand, dual booting only really needs the OF path, so
macosx=/dev/sda7
becomes
macosx=/pci@f4000000/ata-6@d/disk@0:7

A slight drawback is that the front LED no longer indicates disk access. Its function can be changed via /sys/class/leds/pmu-led::front/trigger, but only IDE drive events are registered, while libata works under the SCSI subsystem. Some people have suggested patches for this, but personally I do not find it important enough to start messing with.

[2010-07-06 / 2.6.34.1] Alas, the CD/DVD seems to have a real problem under the macio libata driver. It is limited to non-UDMA modes, so it is somewhat slower. It seems to be fine for playing DVD movies, for example, but CD burning is problematic. On 2011-07-20 (2.6.39.3) the problem is still around.

/s/udev/mdev/

[2012-04-26] Recently, I started having problems with kernel modules. Recent versions udev wanted to use kmod instead of module-init-tools, and kmod (as of version 8) was fucked up on this machine. I had previously read about mdev, as I would prefer a leaner system without all that hotplugging. Following the instructions at Gentoo wiki has worked to a great extent, but I needed some extra steps:

The only thing that does not work yet is my Tascam US-122 external sound card. It should be quite doable, since it needs a few explicit steps which can be scripted, but for some reason usx2y fails, even though the fxload stage works.

Also, a lot of packages insist on udev. In any case, module-init-tools is basically dead, and I should try to get kmod working somehow.

Well, kmod started working fine after I used meeker CFLAGS, so it is back to udev with my USB sound card. But it was a nice adventure in seeing how mdev could work too, especially in a lower end system.

About the name

One philosophical notion behind this choice of hardware is Quality, as described by Robert Pirsig. I could have gotten more computational power and bling for less money, but instead I chose something else. Not because of the Cult of Apple (I would probably be running some other OS then) but because of the PowerPC architecture and the solid metal build.

Pirsig has also written about the concept of Lila, with which I am not so familiar, but it brings to mind a Futurama character. Getting a full-size laptop with only one CPU is somewhat quirky when everyone has two (not to mention working memory slots >.<) and I have a loose policy of naming machines after fictional characters.

External links


Risto A. Paju