Gentoo Linux on an iBook G4 1.33 GHz (mid 2005)

Hardware infos

/proc/cpuinfo
processor       : 0
cpu             : 7447A, altivec supported
clock           : 666.666000MHz
revision        : 0.5 (pvr 8003 0105)
bogomips        : 36.73
timebase        : 18432000
platform        : PowerMac
machine         : PowerBook6,7
motherboard     : PowerBook6,7 MacRISC3 Power Macintosh
detected as     : 287 (iBook G4)
pmac flags      : 0000001b
L2 cache        : 512K unified
pmac-generation : NewWorld

The CPU frequency is switchable between 666MHz and 1333MHz.

lspci
0000:00:0b.0 Host bridge: Apple Computer Inc. UniNorth 2 AGP
0000:00:10.0 VGA compatible controller: ATI Technologies Inc M11 NV [FireGL Mobility T2e] (rev 80)
0001:10:0b.0 Host bridge: Apple Computer Inc. UniNorth 2 PCI
0001:10:12.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)
0001:10:17.0 Class ff00: Apple Computer Inc. KeyLargo/Intrepid Mac I/O
0001:10:18.0 USB Controller: Apple Computer Inc. KeyLargo/Intrepid USB
0001:10:19.0 USB Controller: Apple Computer Inc. KeyLargo/Intrepid USB
0001:10:1a.0 USB Controller: Apple Computer Inc. KeyLargo/Intrepid USB
0001:10:1b.0 USB Controller: NEC Corporation USB (rev 43)
0001:10:1b.1 USB Controller: NEC Corporation USB (rev 43)
0001:10:1b.2 USB Controller: NEC Corporation USB 2.0 (rev 04)
0002:20:0b.0 Host bridge: Apple Computer Inc. UniNorth 2 Internal PCI
0002:20:0d.0 Class ff00: Apple Computer Inc. UniNorth/Intrepid ATA/100
0002:20:0e.0 FireWire (IEEE 1394): Apple Computer Inc. UniNorth 2 FireWire (rev 81)
0002:20:0f.0 Ethernet controller: Apple Computer Inc. UniNorth 2 GMAC (Sun GEM) (rev 80)
lsusb
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 006: ID 05ac:030b
Bus 002 Device 005: ID 05ac:1000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

Gentoo

/etc/gentoo-release
Gentoo Base System release 1.12.11.1
/etc/make.conf
# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example

CFLAGS="-O2 -mcpu=7450 -maltivec -mabi=altivec -mpowerpc-gfxopt"
CHOST="powerpc-unknown-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j3"
PORTAGE_NICENESS=11
FEATURES="distcc parallel-fetch userfetch"

# for OpenOffice and more
LINGUAS="de en"

# we don't want that
USE="-gnome -fortran -f77 -joystick -matrox -ipv6 -arts -ldap"
# X-Server/Console
USE="$USE X radeon fbcon dri opengl sdl xv dga gpm"
# Video
USE="$USE avi mpeg flash quicktime divx4linux mplayer xvid theora ffmpeg"
# Sound
USE="$USE alsa mp3 ogg oggvorbis flac xmms aac wma musepack a52 amr"
# Graphic
USE="$USE gimp pdf tiff"
# CD/DVD
USE="$USE cdparanoia dvd dvdread cdr"
# Hardware
USE="$USE wifi ieee1394 usb pbbuttonsd hal"
# Charsets
USE="$USE encode unicode nls utf8"
# Desktop
USE="$USE qt kde gtk rdesktop"
# Web
USE="$USE apache2 mysql php curl"
# Other
USE="$USE pam bash-completion tetex ssl cups zlib bzip2 hbci crypt idea xprint"
# only on G4
USE="$USE altivec bluetooth"

PORTDIR_OVERLAY="/usr/local/portage"

# for squash_portage
PKGDIR="/var/portage/packages"

# Distfiles on nfs host
#DISTDIR="/var/portage/distfiles"
DISTDIR="/automnt/vol1/var/portage/distfiles"

# Sync from local machine
SYNC="rsync://detritus/gentoo-portage"

# mirrorselect -s10
GENTOO_MIRRORS="/automnt/vol1/var/portage/ ftp://pandemonium.tiscali.de/pub/gentoo/ ftp://gentoo.inode.at/source/ http://88.198.37.77/ ftp://ftp.mneisen.org/gentoo ftp://gd.tuwien.ac.at/opsys/linux/gentoo/ http://213.186.33.37/gentoo-distfiles/ http://213.186.33.38/gentoo-distfiles/ ftp://mirror.muntinternet.net/pub/gentoo/"

# X.org
INPUT_DEVICES="keyboard mouse evdev"
VIDEO_CARDS="radeon fbdev v4l"

# Apache
APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias"

Kernel

Sleep (suspend-to-ram)

For powermanagement you need pbbuttonsd. Here is my /etc/pbbuttonsd.cnf.

You have to unload some USB modules sleeping. For this and to call hibernate for suspend to disk I made a script /etc/power/scripts.d/pbbuttonsd_ibookg4 and a symlink in /etc/power/event.d: # ln -s ../scripts.d/pbbuttonsd_ibookg4 zz_pbbuttonsd_ibookg4. To hibernate in emergency case I changed the shutdown command to hibernate in /etc/power/pmcs-pbbuttonsd.

Hibernate (suspend-to-disk)

It works with the vanilla Software Suspend in the kernel, but I use TuxOnIce. To make it work it needs the package hibernate-script. The following modules have to be blacklisted: part of /etc/hibernate/blacklisted-modules:

appletouch
ohci_hcd
ehci_hcd
ohci1394
eth1394
ieee1394

It does not work together with DRI, so you have to decide weather DRI or Suspend-to-Disk is more important for you.

Kernel configuration

For kernel building I used genkernel, because my own compiled kernels did not boot, maybe because of the initrd.

Kernel config for my self patched kernel: kernel-config-ppc-2.6.22.15-cmr

I use the following kernel patches:

Do not select CONFIG_PREEMPT, this is unstable on PPC and caused a lot of headache because of not reproducible compilation errors. However CONFIG_PREEMPT_VOLUNTARY seems to work fine, but I also heared that it is not recommended. But I also heared about a recent fix for this.

lsmod
Module                  Size  Used by
ohci_hcd               32644  0
ehci_hcd               33932  0
nfs                   273260  0
ipv6                  278668  17
snd_pcm_oss            49728  0
snd_mixer_oss          18272  1 snd_pcm_oss
autofs4                21316  1
nfsd                  233344  13
exportfs                5056  1 nfsd
lockd                  72856  3 nfs,nfsd
sunrpc                181188  9 nfs,nfsd,lockd
squashfs               42280  1
zlib_inflate           15712  1 squashfs
nls_utf8                1824  1
hfsplus                84484  1
usbhid                 27604  0
fuse                   48468  2
appletouch              8928  0
mousedev               12616  1
evdev                  10496  11
sungem                 31972  0
sungem_phy             12704  1 sungem
apm_emu                 2080  0
apm_emulation           7932  2 apm_emu
i2c_powermac            4576  0
therm_adt746x          11404  0
snd_aoa_codec_tas      13472  2
snd_aoa_fabric_layout    12424  2
snd_aoa                17920  2 snd_aoa_codec_tas,snd_aoa_fabric_layout
snd_aoa_i2sbus         21380  1
snd_pcm                85444  2 snd_pcm_oss,snd_aoa_i2sbus
snd_timer              22436  1 snd_pcm
snd_page_alloc          9256  1 snd_pcm
snd                    60692  12 snd_pcm_oss,snd_mixer_oss,snd_aoa_codec_tas,snd_aoa_fabric_layout,snd_aoa,snd_aoa_i2sbus,snd_pcm,snd_timer
soundcore               6884  1 snd
snd_aoa_soundbus        6116  2 snd_aoa_fabric_layout,snd_aoa_i2sbus
firewire_ohci          18656  0
firewire_core          44184  1 firewire_ohci
crc_itu_t               1792  1 firewire_core
ohci1394               38480  0
ieee1394               95968  1 ohci1394
usbcore               142608  5 ohci_hcd,ehci_hcd,usbhid,appletouch
uninorth_agp            9740  1
agpgart                33896  1 uninorth_agp
/etc/modules.autoload
# Power Management
therm_adt746x
apm_emu

# Network
sungem

# USB
ohci-hcd

# Mouse
evdev
mousedev
appletouch

# more
fuse

Hard drive setup

Partitioning

mac-fdisk -l (FUJITSU MHV2120AH, exchanged for a FUJITSU MHV2040AT)
/dev/hda
        #                    type name                  length   base      ( size )  system
/dev/hda1     Apple_partition_map Apple                     63 @ 1         ( 31.5k)  Partition map
/dev/hda2         Apple_Bootstrap bootstrap               1600 @ 64        (800.0k)  NewWorld bootblock
/dev/hda3               Apple_HFS MacOSX              83886080 @ 1664      ( 40.0G)  HFS
/dev/hda4         Apple_UNIX_SVR2 swap                 1048576 @ 83887744  (512.0M)  Linux swap
/dev/hda5         Apple_UNIX_SVR2 root               149505328 @ 84936320  ( 71.3G)  Linux native

Block size=512, Number of Blocks=234441648
DeviceType=0x0, DeviceId=0x0
mac-fdisk -l (TOSHIBA MK8025GAS, BTO by Apple)
/dev/hda
        #                    type name                  length   base      ( size )  system
/dev/hda1     Apple_partition_map Apple                     63 @ 1         ( 31.5k)  Partition map
/dev/hda2         Apple_Bootstrap bootstrap               1600 @ 64        (800.0k)  NewWorld bootblock
/dev/hda3               Apple_HFS MacOSX              20971520 @ 1664      ( 10.0G)  HFS
/dev/hda4         Apple_UNIX_SVR2 swap                 1048576 @ 20973184  (512.0M)  Linux swap
/dev/hda5         Apple_UNIX_SVR2 root               134279728 @ 22021760  ( 64.0G)  Linux native

Block size=512, Number of Blocks=156301488
DeviceType=0x0, DeviceId=0x0

The IMHO best way to partition from scratch is to first partition and format with linux, then with Mac OS X.

mac-fdisk (on other Linux dirstributions sometimes also named pdisk)
We create a new partition table and then create the partitions. Type in the partition names and types exactly like shown above. For the two Linux partitions we can use the 'c' command, for all others we need to use 'C'. For the start of a partition we always enter '1p', where 1 is the number of the "free space" partition. At the last partition we also enter this for the partition length.

Formating

Make the bootstrap: mkofboot -b /dev/hda2
Set up the swap partition: mkswap /dev/hda4
Format the root partition: mkfs.ext3 /dev/hda5

Then we install Linux. Later we can install Mac OS X and format /dev/hda3 (which is there called disk0s3) with the disk utility.

Bootmanager

I was quite tricky to get the right configuration in /etc/yaboot.conf for this iBook.

Bootmanager Recovery:

You can also start the iBook while pressing the Alt key and then select the Tux icon.

Keyboard

I use a PC-like german keyboard layout on the iBook. The Apple-keys work as AltGr (especially useful for the signs @ | ~ \ { [ ] } ). The small enter-key between the right Apple-key and the arrow-keys is normally quite useless, so I reassigned it to a delete-key, what is very comfortable to me.

I made my own keymap /usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys-my.map.gz and entered it in /etc/conf.d/keymaps.

The same in X is done by ~/.Xmodmap.

Trackpad

This iBook model has a different trackpad than all the iBook models before. Apple calls it "scrolling trackpad" and in Mac OS X you can scroll by moving two fingers on the trackpad.

I use the appletouch driver from Stelian Pop. This driver is already included in the kernel. The alternative and older appletrackpad driver from Johannes Berg did not manage the fuzz right. Some people (not me) report that they still have fuzziness problems with the appletouch driver and there is an experimental patch for appletouch.

As long as you do not use the synaptics driver (see below), there is no switch in the kernel to disable tapping. So I wrote a kernel patch that disables tapping on console (gpm), X and mol. It is not yet switchable at runtime and by pbbuttonsd, this part of work still has to be done.

There seems to be a bug in the ohci_hcd kernel module that makes the USB devices sometimes disappear after sleeping. Because of this I unload ohci_hcd before sleeping and reload it after wakeup. The positive side effect of this is that it switches the trackpad off while sleeping, so the iBook does not wake up anymore if you touch the trackpad or the button. To avoid that the iBook wakes up if you plug in or unplug a USB device, I do the same also with the ehci_hci module.

synaptics X11 driver

In X I use the synaptics driver. See my configuration below in the xorg.conf. Unfortunately the synaptics driver has a bug that prevents pbbuttonsd from resetting the dim timer when the trackpad is used. Workaround: Long dimming times in /etc/pbbuttonsd.conf. Here are some discussions and patches, but no proper fix yet:
http://forums.gentoo.org/viewtopic-t-450665-highlight-synaptics+sleep.html
http://sourceforge.net/mailarchive/forum.php?thread_id=9973470&forum_id=40677
http://sourceforge.net/mailarchive/forum.php?thread_id=10298370&forum_id=40677

There is a patch for the synaptics driver now, which enables two-finger scrolling like in Mac OS X:
http://lanpartei.de/~mirage/
and some discussion on it: http://www.ubuntuforums.org/showthread.php?t=82850
It works, but the "feeling" is quite different from how it feels in Mac OS X. The pointer easily jumps around if you don't put the two fingers exactly in the same moment on the trackpad. Scrolling is not smooth but scrolls only in quite big steps, usually 3 lines, like with a mouse wheel.

The trackpad had some problems with suspend-to-disk. This hint (section "Synaptics re-detection problems") solved the problem. I changed the device in xorg.conf to /dev/input/appletouch and the protocol to event und added a script appletouch.rules in /etc/udev/rules.d/.

To make the synaptics driver redetect the trackpad after suspend-to-ram you have to execute chvt 1 on suspend and chvt 7 on resume. I added these commands to /etc/power/scripts.d/pbbuttonsd_ibookg4

For now I don't use the synaptics driver anymore because it makes more troubles than advantages for me.

Mouse button emulation

To emulate the middle and right mouse buttons I use the kernel option CONFIG_MAC_EMUMOUSEBTN to map F11 to the middle and F12 to the right mouse button. An alternative is the mouseemu userspace tool.

# Enable Mouse Button Emulation
dev.mac_hid.mouse_button_emulation=1
# F11
dev.mac_hid.mouse_button2_keycode=87
# F12
dev.mac_hid.mouse_button3_keycode=88

X11

The current version of x11-base/xorg-server is 1.3.0.0-r5. /etc/X11/xorg.conf

The external Monitor works fine.

Power management

I use powernowd, it very easy to configure. /etc/conf.d/powernowd

The ondemand governor from the kernel does not work on the iBook, but powernowd also does the job.

Modem

The modem is not listed in the output of lsusb and lspci and it is not recognized by the hcfusb driver from linuxant. From inside of Mac OS X I got the following information:

Modem-Informationen:

Modem-Modell: Jump
Schnittstellentyp: I2S
Modulation: V.92
Hardware-Version: Version 1.0
Treiber: MotorolaSM56K.kext (v1.3.3)
Land: 42 (Deutschland)

There are some binary Linux drivers for this modem on the Motorola page, but not one for PPC. If anybody has a clue how to access this modem, then please let me know!

Airport Extreme (WLAN)

There are two ways how you can access the Airport card: With mol and a pci proxy in it and with a native driver.

The native driver now is included since kernel 2.6.17 and works ok. It does not reconnect after wakeup, so you have to restart the connection manually. The biggest problem for me is, that it works only with very strong signals.

Sudden Motion Sensor

There is an experimental approach Apple Motion Sensor Driver (ams), but nothing usable.

Not yet tried

Still remaining problems

If you have questions, solutions or if you cannot reproduce one of these problems, please mail me. All comments are very welcome. homepage@cmr.cx

Other sites about Linux on iBook

 

last updated: 2008-03-30