John Leach - A Powerbook G4 and Linux

© Copyright John Leach <john@johnleach.co.uk>
Last updated: $Date: 2005-06-18 15:30:06 +0100 (Sat, 18 Jun 2005) $


I've recently become the owner of a shiny new 15" Apple PowerBook G4. Although I'm still scared to touch it for long in case I scratch or bubble the paintwork, I've managed to get GNU/Linux running on it (amongst many other things). I'm going to document my progress, in part, here.

The hardware

It's a 1Ghz PowerBook G4, with a 15" wide screen LCD, 512mb RAM, 60GB HD and a SuperDrive (CD+DVD Writer).

the obligatory dmesg log and lspci output:

00:0b.0 Host bridge: Apple Computer Inc. UniNorth 1.5 AGP
00:10.0 VGA compatible controller: ATI Technologies Inc Radeon R250 Lf [Radeon Mobility 9000 M9] (rev 01)
10:0b.0 Host bridge: Apple Computer Inc. UniNorth 1.5 PCI
10:17.0 Class ff00: Apple Computer Inc. KeyLargo Mac I/O (rev 03)
10:18.0 USB Controller: Apple Computer Inc. KeyLargo USB
10:19.0 USB Controller: Apple Computer Inc. KeyLargo USB
10:1a.0 CardBus bridge: Texas Instruments PCI1410 PC card Cardbus Controller (rev 02)
24:0b.0 Host bridge: Apple Computer Inc. UniNorth 1.5 Internal PCI
24:0e.0 Class ffff: Lucent Microelectronics FW323 (rev ff)
24:0f.0 Class ffff: Apple Computer Inc. UniNorth GMAC (Sun GEM) (rev ff)

The latest 2.4.21 and 2.5.66 kernels recognise my CPU properly now (seems to run cooler now too, but thats highly subjective).

cpu             : 7455, altivec supported
clock           : 1000MHz
revision        : 3.3 (pvr 8001 0303)
bogomips        : 997.28
machine         : PowerBook3,5
motherboard     : PowerBook3,5 MacRISC2 MacRISC Power Macintosh
detected as     : 80 (PowerBook Titanium IV)
pmac flags      : 0000000b
L2 cache        : 256K unified
memory          : 512MB
pmac-generation : NewWorld

Kernels

Benjamin Herrenschmidt (BenH), a rather clever chap, maintains the powerpc side of the Linux kernel.

kernel.org

BenH kernel patches are available at kernel.org. Just patch them against Linus' tree and compile (as of writing, 2.4.20-ben10 is the latest.

Raw Bleeding edge

I obtained my kernel sources by rsyncing directly from BenH's development tree. They could be in *any* state at the time I synced, so your results may differ wildly. rsync -arvz rsync.penguinppc.org::linux-2.4-benh . should get you an up-to-date copy. There is also a web interface to the bitkeeper tree at http://ppc.bkbits.net/

The latest 2.4.21-pre kernel I've been playing with has some new code from ATI with allows suspend to work properly at last!! Hooray!

2.5 kernels

2.5.66 compiles ok if you don't select the alsa sound drivers, but I got no boot messages or console screen (which apparently is due to a dependency that isn't enforced in menuconfig). Just had to wait for a few seconds for X to appear. Not sure whats going on right now. I'll look into it further later.

Graphics and Display

An ATI Radeon 9000 provides the graphical output (The newer 12" and 17" PowerBooks have evil NVidia cards, with evil (and debatably illegal) binary-only drivers).

Dual Display

Agh. this is not fun. Clone mode looks easy enough, but as the built in LCD is 1280x854, my Iiyama Vision Master Pro 451 external monitor cannot display the screen properly as the aspect ratio isn't 'normal' (it kinda clips/squeezes the right hand side of the display). Setting Option "CloneMode" "1280x1024" just seems to get ignored.

Independent dual displays are trickier. Had to compile my own drm drivers and some X modules. I have fully working displays (1280x854 and 1600x122) but with a strange yellow tint on both screens, with some strange intermittent artifacts whilst redrawing things. I have a screenshot of the yellowness. That desktop should be grey (one block of it is!). I think the fact I can make a screenshot of the problem reveals more about the problem than the actual screenshot. If this were a weird hardware thing I'd expect a screenshot, viewed on a working display, would look fine.

Update: After much discussion on the debian-powerpc list, and some work from Ben Herrenschmidt and Michel Daenzer, this is now fixed! I have independent dual displays working with my internal LCD and an external Iiyama VisionMaster Pro 451. The fixed code is available in the latest DRI trunk XFree86 debs from Michels repository (version 2003.07.25-2) at deb http://people.debian.org/~daenzer/dri-trunk-sid/ ./

My XFree86 dual head config is a good example to help you on your way.

Filesystemism

Moving from a dual-boot Linux/Win2k system to a dual-boot Linux/MacOSX hits a bit of a stumbling block when you need to transfer data.

In my scenario, there were 3 filesystems in use, EXT3, HFS+ and NTFS. Linux supports Ext3, NTFS (read-only), HFS and HFS+ (read-only). Win2k support NTFS only. MacOS supports HFS+ only. Getting my (multiple tens of gigabytes of video) data from my external firewire hard disk formatted with NTFS, into MacOSX has proved difficult. After much research and testing of HFS and HFS+ support for Linux, EXT support for MacOS (none), and FAT support for everyone, I finally gave in and just copied the data over samba from Linux to MacOS running through mol (Mac On Linux), but I'll document what I learnt here in case it helps anyone.

HFS (Hierarchical File System>

HFS replaced MFS (Macintosh File System) as the MacOS filesystem when the Mac Plus was released. Linux can support read HFS volumes, but writing support is still in development, and risky.

MacOS uses the OpenStep ufs type. Writing is not at all supported. To mount, specify hfs and openstep:

mount -t ufs -o ufstype=openstep /dev/disk1 /mnt/myhfsdisk

MacOSX can format, read and write UFS partitions and disks with no problems. Windows 2000/XP doesn't support HFS natively, but I didn't investigate any 3rd party tools.

HFS+

HFS+ is an improved HFS and the Mac OS X filesystem of choice. Linux can read HFS+ with some userspace utilities but the version I used didn't have full write support (I could make directories, no more). Some Linux 2.4 kernel patches do exist but the last release was Jun 2002. Mac OS X obviously has no problem making use of HFS+, Mac OS9 needs some drivers, and as far as I can tell, Win2k has no support whatsoever for it. Update: The latest benh powerpc kernels have newer HFS+ support which has worked flawlessly for me mounted read-only. Write support is another matter which I would recommend researching and testing thoroughly before using on a "live" system.

NTFS

Linux has read-only NTFS support in the mainstream kernel, but it's a little old. The latest version has been rewritten to be faster and more stable, but still lacks write support (technically, both drivers have NTFS write support, but it's still in development and you shouldn't trust it with your valued data). With the mainstream kernel I couldn't mount my NTFS drive, as I'd chosen quite a large cluster size when I originally formatted. I got this message when trying to mount it: NTFS: Partition cluster size is not supported yet (it is > max kernel blocksize).).

Patching the kernel with the latest version (2.1.2a) worked fine, and I could mount it with no problems.

Mac OS X doesn't support it at all. Win2k/XP seems to just about manage with it. UPDATE: According to Johannes Sauerbier, Mac OS X 10.3 now supports NTFS, but in read-only mode.

FAT

Linux has support for reading and writing FAT16/32 partitions in the mainstream 2.4 (and 2.5) kernel. Just mount it as type 'vfat'.

Win2k/XP and Mac OS X supports FAT on hard disks, but with MacOS, not in partitions. The whole disk needs to be formatted FAT. I'm not yet sure why this is the case.

Conclusion

Linux, Mac OS X and Win2k/XP have full FAT filesystem support, allowing you to transfer files neatly between them all. In my case I finally settled on copying from samba on Linux onto the Mac, as with all the juggling of data to end up with all my files on a reliable filesystem (i.e: not FAT) would have taken much longer, even considering the sheer size of it all.

Now overcoming problems with 'media types' opening Adobe Premiere project files on Mac OS originally created on Windows took much longer to sort out, but that really is out of the scope of this document.

Partitions

Mac has it's own disk partition format. FIXME.

Mac On Linux

Nothing here yet except for this screenshot.

More to come

Clearly there is more to come. I've already got MacOSX/Debian dual boot, 'Mac-on-Linux' virtualizing MacOSX on my Gnome desktop, Quake running, cpu frequency stuff. I'm certainly planning to get Linux 2.5 running on it (maybe when BenH starts work on it).

Link-o-rama

I've had much help from some of the following pages.

Back to johnleach.co.uk