Table of Contents

Gentoo on iBook

processor	: 0
cpu		: 7447A, altivec supported
clock		: 1199MHz
revision	: 1.2 (pvr 8003 0102)
bogomips	: 1196.03
machine		: PowerBook6,5
motherboard	: PowerBook6,5 MacRISC3 Power Macintosh 
detected as	: 287 (iBook G4)
pmac flags	: 0000001b
L2 cache	: 512K unified
memory		: 256MB
pmac-generation	: NewWorld

Hardware information (use lshw) to get much better information)

$ lspci
0000:00:0b.0 Host bridge: Apple Computer Inc. UniNorth 2 AGP
0000:00:10.0 VGA compatible controller: ATI Technologies Inc M9+ 5C63 [Radeon Mobility 9200 (AGP)] (rev 01)
0001:10:0b.0 Host bridge: Apple Computer Inc. UniNorth 2 PCI
0001:10:12.0 Network controller: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller (rev 03)
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)

Installation

I deleted OSX and did a Linux only installation. Why waste the meagre 30G space when I wont need OSX. Follow the instructions in the Gentoo handbook. I did a stage 2 installation and downloaded the latest Linux kernel 2.6.16 and compiled it myself. Sleep works finally !!!

My /etc/make.conf file

/etc/make.conf

CHOST="powerpc-unknown-linux-gnu"
 
#gcc optimization flags
CFLAGS="-O3 -mcpu=7450 -mtune=G4 -maltivec -mabi=altivec -fno-strict-aliasing \
        -pipe -mpowerpc-gfxopt -fomit-frame-pointer -fpermissive"
CXXFLAGS="${CFLAGS}"
 
#Custom USE flags
USE="avi altivec \
     bluetooth bzlib \
     cdr cups \
     dvd dvdread \
     fbcon fftw fortran ftp \
     gif gimp -gnome gtk2 \
     icc imagemagick \
     java jpeg \
     -kde \
     mad mime mozsvg mp3 mpeg mpeg4 \
     ncurses \
     opengl \
     pda pdflib plotutils png pwdb \
     qt \
     radeon \
     sysfs \
     tidy tiff truetype \
     unicode usb \
     vcd \
     wifi \
     xscreensaver \
     zlib"
 
#Specify gentoo mirrors
GENTOO_MIRRORS="http://cudlug.cudenver.edu/gentoo \
                http://mirrors.acm.cs.rpi.edu/gentoo"
 
CONFIG_MAC_EMUMOUSEBTN=y
VIDEO_CARDS=radeon
 
#rsync host for syncing the portage tree
SYNC="rsync://rsync.asia.gentoo.org/gentoo-portage"
 
# PORT_LOGDIR is the location where portage will store all the logs it
#     creates from each individual merge. They are stored as YYMMDD-$PF.log
#     in the directory specified. This is disabled until you enable it by
#     providing a directory. Permissions will be modified as needed IF the
#     directory exists, otherwise logging will be disabled.
PORT_LOGDIR=/var/log/portage
 
PORTAGE_NICENESS="19"
 
RSYNC_EXCLUDEFROM=/etc/portage/rsync_excludes

Mouse buttons

The iBook has only one mouse button !!! You can assign some other keys for the middle and right buttons. This will work if you have enabled the option in the kernel. Then add the following lines to /etc/sysctl.conf

/etc/sysctl.conf

dev/mac_hid/mouse_button3_keycode = 126
dev/mac_hid/mouse_button2_keycode = 125
dev/mac_hid/mouse_button_emulation= 1

This assigns the middle button to the Apple key (which is on both sides of the space bar key) and the right button is Fn+Apple.

Special keys

pbbuttons is great. Volume, brightness and CD eject keys work well. With gtkpbbuttons you can get a nice display while these keys are pressed.

cdrom

Use the ide-cd module. No need for scsi emulation for cd-writer. To check your cdwriter do

$ cdrecord -scanbus dev=ATA:
Cdrecord-Clone 2.01 (powerpc-unknown-linux-gnu) Copyright (C) 1995-2004 J�g Schilling
cdrecord: Warning: Running on Linux-2.6.11.6
cdrecord: There are unsettled issues with Linux-2.5 and newer.
cdrecord: If you have unexpected problems, please try Linux-2.4 or Solaris.
scsidev: 'ATA:'
devname: 'ATA'
scsibus: -1 target: -1 lun: -1
Warning: Using badly designed ATAPI via /dev/hd* interface.
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.8'.
scsibus1:
        1,0,0   100) 'MATSHITA' 'CD-RW  CW-8123  ' 'CA10' Removable CD-ROM
        1,1,0   101) *
        1,2,0   102) *
        1,3,0   103) *
        1,4,0   104) *
        1,5,0   105) *
        1,6,0   106) *
        1,7,0   107) *

and while writing specify the device as, for example, <tt>dev=ATA:1,0,0</tt> or you can also add the following lines to <tt>/etc/default/cdrecord</tt> file

CDR_DEVICE=matshita
matshita=       ATA:1,0,0   -1      -1      ""

To allow all users to use cdrecord, remove the SUID bit from cdrecord

chmod -s /usr/bin/cdrecord

You may have to specify the device as <tt>/dev/hdc</tt> instead of <tt>ATA:1,0,0</tt> for this to work properly.

Fan control

Use the therm_adt746x module in the kernel. This module also allows you to read the cpu/gpu temperature and fan speed from /sys/devices/temperatures

Sound

Load the following modules for sound to work properly

i2c-keywest
i2c-dev
soundcore
dmasound_core
dmasound_pmac

These modules are for OSS; I had problems with ALSA, but it might work with the recent kernels. Try ALSA first and use OSS if it doesnt work.

Hard Disk

Hard disk capabilities

$ hdparm -i /dev/hda

/dev/hda:

 Model=TOSHIBA MK3025GAS, FwRev=KA302B, SerialNo=256Q2714S
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=48
 BuffType=unknown, BuffSize=0kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=58605120
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  sdma0 sdma1 sdma2 mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: device does not report version: 

 * signifies the current active mode

Hard disk settings

$ hdparm /dev/hda

/dev/hda:
 multcount    = 16 (on)
 IO_support   =  1 (32-bit)
 unmaskirq    =  1 (on)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 readonly     =  0 (off)
 readahead    = 256 (on)
 geometry     = 16383/255/63, sectors = 30005821440, start = 0

Suspend

Suspend to RAM works very well. Enable the required options in the Macintosh drivers section in the kernel (see my config file) and install <tt>powerprefs</tt>. Some usb modules can cause iBook to hang upon suspend. These modules must be unloaded before suspending. Put the <tt>modules</tt> file given below in <tt>/etc/power/event.d</tt>

Frequency scaling

I use powernowd to reduce the cpu clock when the cpu is idle.

CPU Temperature, etc.

You can read the cpu/gpu temperature and fan speed from <tt>/sys/devices/temperatures</tt>. I use torsmo to display these informations on the screen. Torsmo was available in gentoo portage but seems to have been removed now. Anyway it did not work directly and I had to do a small hacking. You can download the file from <a href=”torsmo-0.18.tgz”>here</a> and compile it yourself. Copy the executable to <tt>/usr/local/bin</tt> and put the following line into your .fvwm2rc file

+ I Exec /usr/local/bin/torsmo -d -a top_right -w 0x48 2&gt;/dev/null

This will display the output at the top right corner of your screen.

Running non-ppc binaries

You can install qemu, compile the binfmt_misc module in the kernel and run the script <tt>qemu-binfmt-conf.sh</tt>. This will allow you to run simple binary files from other architectures like x86. However if run time libraries are required then you will have to supply them. You can execute this script automatically during boot by giving its complete location in /etc/conf.d/local.start.

Some system information

You can get some system information by running the bash script <tt>ibook.sh</tt>

$ ./ibook.sh
CPU Clock Speed: 1199MHz
CPU Temperature: 43
GPU Temperature: 46
Fan Speed      : 0 (0 rpm)
Power source   : AC
Battery charge : 4480, 96%
Current        : 0
Voltage        : 12359 mV
Time remaining : 0

Modules

Add the following modules to your /etc/modules.autoload/kernel-2.6 file

/etc/modules.autoload/kernel-2.6

#USB modules, ohci_hcd must be builtin, otherwise ibook hangs upon suspend
ehci_hcd
usb_storage

#Firewire module
ohci1394

#Sound modules for OSS
i2c-keywest
i2c-dev
soundcore
dmasound_core
dmasound_pmac

#Fan control module
therm_adt746x

uinput
uninorth-agp
radeon

Some configuration files

<ol> <li><a href=”make.conf”>Portage make.conf</a></li> <li><a href=”config-2.6.16.txt”>Kernel config file</a></li> <li><a href=”xorg.conf”>xorg.conf</a></li> <li><a href=”fstab”>fstab</a></li> <li><a href=”yaboot.conf”>yaboot.conf</a></li> <li><a href=”pbbuttonsd.conf”>pbbuttonsd.conf</a></li> <li><a href=”modules”>modules</a></li> <li><a href=”ibook.sh”>ibook</a></li> <li><a href=”qemu-binfmt-conf.sh”>qemu-binfmt-conf.sh</a></li> </ol>