Outils pour utilisateurs

Outils du site

Panneau latéral




Ham Radio






Gloduk (Gentoo Linux on an iBook G4)

Installing Gentoo Linux 2008.0++ on a June-2005 12“ iBook G4.



When the machine boots up, press c to boot from the Gentoo Install LiveCD. In case when there is a protection to the OpenFirmware, boot into it (Command+Option+O+F) and type

boot cd:,\\:tbxi 

at the prompt. Another solution is to press the Option key in order to display a graphical list of the possible boot options.


Plugged into a DHCP-based lan, the network is automagically configured to the appropriate parameters.


The hard disk is a 160 GB (and there is 1.2 GB RAM). It will be partitioned roughly as follows.

Device Type/Mount Size
hda1 Partition map 32 kB
hda2 Bootblock 800 kB
hda3 / 30 GB
hda4 swap 1.2 MB
hda5 /home 30 GB
hda6 /data

These partitions are created using the mac-fdisk tool.

# mac-fdisk /dev/hda

Some cleanup in the existing partitions may be necessary. Then the main Linux partitions can be created.

Command (? for help): i
size of 'device' is 312581808 blocks:
new size of 'device' is 312581808 blocks
Command (? for help): b
First block: 2p
Command (? for help): c
First block: 3p
Length (in block, kB (k), MB (M) or GB (G)): 30G
Name of partition: root
Command (? for help): c
First block: 4p
Length (in block, kB (k), MB (M) or GB (G)): 1280M
Name of partition: swap
Command (? for help): c
First block: 5p
Length (in block, kB (k), MB (M) or GB (G)): 30G
Name of partition: home

We don't need the MacOS X partition. It was created using C instead of c.

Command (? for help): C
First block: 6p
Length (in block, kB (k), MB (M) or GB (G)): 5G
Name of partition: OSX
Type of partition: Apple_HFS

The final data partition will use all the remaining space, this is done by specifying a size of 6p.

Command (? for help): c
First block: 6p
Length (in block, kB (k), MB (M) or GB (G)): 6p
Name of partition: data

The final layout can be saved.

Command (? for help): p
        #                    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_UNIX_SVR2 root                62914560 @ 1664      ( 30.0G)  Linux native
/dev/hda4         Apple_UNIX_SVR2 swap                 2621440 @ 20973184  (  1.2G)  Linux swap
/dev/hda5         Apple_UNIX_SVR2 home                62914560 @ 22021760  ( 30.0G)  Linux native
/dev/hda6         Apple_UNIX_SVR2 data               184129584 @ 53479040  ( 87.8G)  Linux native

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

Command (? for help): w
IMPORTANT: You are about to write a changed partition map to disk. 
For any partition you changed the start or size of, writing out 
the map causes all data on that partition to be LOST FOREVER. 
Make sure you have a backup of any data on such partitions you 
want to keep before answering 'yes' to the question below! 

Write partition map? [n/y]: y
The partition map has been saved successfully!

Syncing disks.

Partition map written to disk. If any partitions on this disk 
were still in use by the system (see messages above), you will need 
to reboot in order to utilize the new partition map.

Command (? for help): q

The newly created partitions are then formatted and mounted in /mnt/gentoo at the appropriate mount points.

# mkswap /dev/hda4
# swapon /dev/hda4
# mkfs.ext3 -L root /dev/hda3
# mkfs.ext3 -L home /dev/hda5
# mkfs.ext3 -L data /dev/hda6
# mount -t ext3 /dev/hda3 /mnt/gentoo
# mkdir /mnt/gentoo/{home,data}
# mount -t ext3 /dev/hda5 /mnt/gentoo/home
# mount -t ext3 /dev/hda6 /mnt/gentoo/data

Gentoo stage 3 and portage tree installation

We go through http://www.gentoo.org/doc/en/handbook/2006.0/handbook-ppc.xml?part=1&chap=5 (now obsoleted by http://www.gentoo.org/doc/en/handbook/handbook-ppc.xml). A G4 stage 3 from 2009-09-09 will be installed.

It may be good to roughly set the date to one posterior to that of the snapshot.

# date 091520482009
# cd /mnt/gentoo
# tar xjpf /PATH/TO/stage3-g4-2006.0.tar.bz2
# tar xjf /PATH/TO/portage-20060123.tar.bz2 -C /mnt/gentoo/usr
# mkdir /mnt/gentoo/usr/portage/distfiles
# cp /PATH/TO/distfiles/* /mnt/gentoo/usr/portage/distfiles/


Once the base files are in place, one can think about chrooting (http://www.gentoo.org/doc/en/handbook/2006.0/handbook-ppc.xml?part=1&chap=6).

# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
# chroot /mnt/gentoo /bin/bash


We want to build a pure UTF-8 system. According to http://www.gentoo.org/doc/en/utf-8.xml#doc_chap2, it is necessary to play with the locales. First we want to have English (US) and French locales both in UTF-8 and latin, the others are not useful at the time.

en_US ISO-8859-1
en_US.UTF-8 UTF-8
#ja_JP.UTF-8 UTF-8
#en_HK ISO-8859-1
#en_PH ISO-8859-1
#de_DE ISO-8859-1
#de_DE@euro ISO-8859-15
#es_MX ISO-8859-1
#fa_IR UTF-8
fr_FR ISO-8859-1
fr_FR@euro ISO-8859-15
fr_FR@euro.UTF-8 UTF-8
#it_IT ISO-8859-1

Then, we specify that the en_US.UTF-8 locale should be used by default.

# cat > /etc/env.d/02locale
# env-update
# source /etc/profile

Portage stuff

Now is the time to specify the contents of the USE flag. Having a look at the contents of /usr/portage/profiles/use.desc (from the chroot), one can add the following to the /etc/make.conf file. The flags needed for the modular X11 package and the Portage overlay are also set here.

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -mcpu=powerpc -mtune=powerpc -fno-strict-aliasing -pipe"
CXXFLAGS="-O2 -mcpu=powerpc -mtune=powerpc -fno-strict-aliasing -pipe"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
USE="X Xaw3d a52 aac aiglx alsa altivec -apache2 apm avahi bash-completion
bzip2 bluetooth caps cdparanoia cdr crypt cups curl dbus -doc dri dvd dvdread
-emacs encode -esd -evo fbcon ffmpeg flac gcj -gnome -gnome-keyring gnutls
gpgme gpm gtk hal iconv imagemagick imap idle ipv6 jabber -jack java jpeg -kde
-qt3 -qt4 kpathsea ldap libnotify midi mozilla mozdevelop mp3 mp4 mpeg
musicbrainz nptl nptlonly nsplugin offensive ogg oggvorbis opengl -pcmcia pdf
png pop posix python quicktime readline recode samba sdl slang smartcard smime
smtp sqlite srv ssl svg symlink syslog -tetex texlive theora threads tidy tiff
trayicon truetype unicode usb v4l vorbis win32codecs wxwindows x264 xinerama
xml2 xosd xprint xsl xulrunner xvid xforms zeroconf zlib"
INPUT_DEVICES="keyboard mouse evdev"
VIDEO_CARDS="radeon vesa fbdev"
source /usr/local/portage/layman/make.conf


# mkdir /usr/local/portage

Then synchronize the portage tree and do the necessary updates.

# emerge --sync
# emerge -u system
# etc-update

At this stage, a conflict between sys-apps/shadow and sys-apps/pam-login blocked the update. Uninstalling pam-login solved everything.

Compiling the glibc may fail too, with an unhelpfull error about -mlong-double-128 IBM extended format support. One should make sure that one is using at least gcc-4.1:

# gcc-config -c
# gcc-config -l
 [1] powerpc-unknown-linux-gnu-3.4.4
 [2] powerpc-unknown-linux-gnu-3.4.4-hardened
 [3] powerpc-unknown-linux-gnu-3.4.4-hardenednopie
 [4] powerpc-unknown-linux-gnu-3.4.4-hardenednopiessp
 [5] powerpc-unknown-linux-gnu-3.4.4-hardenednossp
 [6] powerpc-unknown-linux-gnu-4.1.1
# gcc-config powerpc-unknown-linux-gnu-4.1.1
 * Switching native-compiler to powerpc-unknown-linux-gnu-4.1.1 ...       [ ok ]
# source /etc/profile
# gcc-config -c
# emerge -u system


Let's configure a nice kernel and set the appropriate parameters.

First, the timezone.

# cd /etc
# rm localtime 
# ln -s /usr/share/zoneinfo/Europe/Paris localtime

And in /etc/conf.d/clock.


Then pull the kernel sources (linux-2.6.30-gentoo-r4 at the time of the last update).

# USE="-doc symlink" emerge gentoo-sources

Which we compile with the appropriate options (linux-2.6.31-gentoo-r10, 2.6.30-gentoo-r4, 2.6.20-gentoo-r5).

# cd /usr/src/linux
# make oldconfig
# make vmlinux modules modules_install
# cp vmlinux /boot/linux-2.6.30-gentoo-r4

One has the habit to store all the kernels and optional init ramdrives in /boot, then using symlinks to point to the relevant kernel, there is only one for now so all links point to it.

# cd /boot
# ln -s linux-2.6.30-gentoo-r4 kernel
# ln -s linux-2.6.30-gentoo-r4 kernel.base
# ln -s linux-2.6.30-gentoo-r4 kernel.old
# ln -s linux-2.6.30-gentoo-r4 kernel.test

System configuration

Filesystems table

The /etc/fstab file should be updated to reflect the mount points of the filsystems we created earlier. The example entries are commented out and the needed ones are added. The relevant parts of the file then looks like the following.

/dev/hda3	/		ext3		noatime		0 1
/dev/hda4	none		swap		sw		0 0
/dev/hda5	/home		ext3		noatime		0 0
/dev/hda6	/data		ext3		noatime		0 0

Network information

Several files need modification to set the “personality” of the machine.


# /etc/conf.d/hostname

# Set to the hostname of this machine

The domain names are set in /etc/conf.d/net, we do not want the domain to be overriden by DHCP settings, and there is no NIS domain (for now).


The /etc/hosts file also has to be modified accordingly.

...       gloduk.narf.ssji.net gloduk localhost.local localhost
::1 gloduk.narf.ssji.net gloduk ip6-localhost ip6-loopback

The network interfaces configuration is set in /etc/conf.d/net. Actually, this part can be skipped. It is said in the file that ”[a] blank configuration will automatically use DHCP for any net.* scripts in /etc/init.d“ which is the behavior we want for now. One must, however, remember to create the necessary entries in /etc/init.d for the interfaces to be handily brought up, this is already done for eth0.

The network won't be automatically started at boot as ifplugd will be used to do that. Let's first install it, a DHCP client and the wireless-tools which will soon be needed.

# USE="-doc" emerge ifplugd dhcpcd wireless-tools


First changing the root password might be an interesting idea

# passwd

We use the preexisting operator user as a non-privileged by default administrative user.

# usermod -d /operator -m -g wheel operator
# chown -R operator:wheel /operator
# passwd operator

The first user of the system (me !) is added.

# useradd -d /home/shtrom -m -g users -G wheel,audio,cdrom,usb,netdev,plugdev,games shtrom
# passwd shtrom

First packages

It's now time to install the first packages.

System stuff…

# emerge hotplug pbbuttonsd powernowd hdparm
# rc-update add hotplug default
# rc-update add pbbuttonsd default
# rc-update add powernowd default

Some absolutely needed tools.

# emerge vim sudo screen bash-completion links lynx

Useful portage tools…

# emerge eix layman

PBButtonsd configuration

The configuration file for the Powerbook Buttons (and more) daemon resides in /etc/pbbuttonsd.cnf. Some modifications have to be made in order to have an nice sleep-and-stuff behavior.

onAC_CoverAction      = blankscreen
NETLoad_device        = "wlan0"

sudo configuration

We want to allow all users from group wheel to be able to use sudo retaining their usual environment. Using visudo, we uncomment the appropriate line.

Defaults:%wheel !env_reset
%wheel	ALL=(ALL)	ALL

bash-completion configuration

We want enhanced completion for Bash on by default for all users.

# sudo eselect bashcomp enable --global base gentoo ssh subversion gpg2 git configure findutils bzip2 gzip rsync tar sysvrc

eix database

The eix database has to be built for later use.

# eix-sync

Global configuration

Some global parameters can be set in /etc/rc.conf.



(The lines related to X11 (DISPLAYMANAGER and XSESSION) will be uncommented later.)

eselect is also of use.

# eselect editor set vim
# eselect pager set less


It might be interesting to have the SSH daemon start at bootup.

# rc-update add sshd default


The bootloader we will be using is Yaboot.

# emerge yaboot mac-fdisk

It will be configured using the /etc/yaboot.conf file, which can be automatically created using yabootconfig before edition. This has to be done outside of the chroot.

# ^D
# yabootconfig --chroot /mnt/gentoo/
yaboot is the Linux Loader for PowerPC.  yabootconfig sets up your system to boot directly
from your hard disk, without the need for a boot CD, floppy or a network boot.
Install yaboot bootstrap on /dev/hda2 to boot Linux from /dev/hda3? [Yes] 
Creating a simple /mnt/gentoo/etc/yaboot.conf...
yabootconfig: Cannot find a kernel, please locate one
Enter path to a kernel image: /mnt/gentoo/boot/kernel
Enter path to an initrd image (hit Enter for none): 
Running mkofboot to make the disk bootable...

The file can then be edited to fit our desires.

## yaboot.conf generated by yabootconfig 1.0.8
## run: "man yaboot.conf" for details. Do not make changes until you have!!
## For a dual-boot menu, add one or more of: 
## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ










The password can be either cleartext or MD5. The MD5 version can be generated using md5sum.

echo CLEARPASS | md5sum

Still out of the chroot, ybin is run to reflect the modifications.

# ybin -v -C /mnt/gentoo/etc/yaboot.conf


At this stage, it becomes possible to reboot and work in the system without chroot. Let's try it

# umount /mnt/gentoo/data /mnt/gentoo/dev /mnt/gentoo/home /mnt/gentoo/proc 
# reboot

System tools

System logger

The usual Syslog-ng will be used.

$ sudo emerge syslog-ng
$ sudo rc-update add syslog-ng default

Cron daemon

This is a laptop which will not be up all the time. Using vixie-cron and anacron seems to be the best choice

$ sudo emerge vixie-cron anacron
$ sudo rc-update add vixie-cron default


The slocate package is useful to find files…

$ sudo emerge slocate

NTP client

The OpenNTPd client from OpenBSD will be used.

$ sudo emerge openntpd
$ sudo rc-update add ntpd default

A command line options has to be defined in /etc/conf.d/ntpd to immediately adjust the time on startup.


Resync after suspend

NTP seems to lose track of time after suspend/resume. As an attempt to fix this, a script for the pm subsystem can be added, that simply restarts OpenNTPd on resume.

# Restart NTP daemon on resume to resync time
        printf "Restarting NTP daemon"
        /etc/init.d/ntpd restart >/dev/null 2>&1 0<&1 && echo Done. || \
            echo Failed.
case "$1" in
        thaw|resume) resume_ntp ;;
        *) exit $NA ;;

It should do the right thing of re-syncing the time thanks to the -s flag in the daemon's configuration.

FIXME I'm still not sure this works, and this might require fiddling in /etc/conf.d/net instead.

Start When Any Interface is Up

When the network interfaces are started dynamically, some services depending on the net runlevel (ntpd, but also sshd) might not want to start until all interfaces are up, complaining that

$ <in>sudo rc-service ntpd restart</in>
 * WARNING: ntpd is scheduled to start when net.eth0 has started

This can be solved by removing the strict dependency on all the elements of a given runlevel, by letting any of themsatistfy it.



A simple MTA to relay local mail to a know distant MTA, with SSL authentication.

$ sudo emerge ssmtp

If is configured in /etc/ssmtp/ssmtp.conf. We use a duly signed certificate to authenticate with the remote MTA, it lays in /etc/ssl/certs/gloduk.narf.ssji.net.pem. Moreover, all mail for users with UID lesser than 1000 will be sent to user shtrom.


As there are plaintext passwords in the configuration file, we don't want it to be world readable. A quick hack is to setgid the ssmtp binary to, say, group mail, and only allow that group to read file ssmtp.conf.

$ sudo chgrp mail /usr/sbin/ssmtp 
$ sudo chmod g+s /usr/sbin/ssmtp 
$ sudo chgrp mail /etc/ssmtp/ssmtp.conf 
$ sudo chmod 640 /etc/ssmtp/ssmtp.conf 



Insert Key

Some idiosyncracies of the iBook keyboard include not having a marked Insert key. This is annoying when using applications such as Midnight Commander (the Insert key is the default selection key). Fortunately, there actually is an insert key, as the 0 key of the numpad. It is reachable using the Fn+M key combination.

Dvorak Layout

Out of jest, it has been decided that it would be interesting to eventually try out a Dvorak mapping. This, of course, includes physically remapping the keyboard.

Next time, it may however be wiser to check transparent stickers options.

Popping the keys out and back in

We start off with this document, but slightly change the approach. Namely, we leave the “bearing” in place, and only remove the “shell”, before putting them back elsewhere.

The shell is clipped to the bearing at the top. The two pieces are separated by sliding some sort of pointey device against the inside of the shell, then using it as a leverv Once unclipped, the bottom slides freely out (upwards).

Sliding the tool against the shell......and gently unclipping it

Putting the keys back is almost the exact opposite as removing them. It can be useful to lift the bearing to ease sliding the key down before clipping it.

Lifting the bearingAdjusting the clipsClipping

A brand new Dvorak iBook

Console configuration

The console layout can be changed in /etc/conf.d/keymaps

X configuration

To use a Dvorak keyboard, one just need to use the dvorak XKB variant either in xorg.conf as

Option "XkbVariant" "dvorak"

or, using the more recent hotplug-based input system, in /etc/hal/fdi/policy/10-keymap.fdi:

<merge key="input.xkb.variant" type="string">dvorak-intl</merge>

:!: HAL has been deprecated, see Gentoo bug 313389, and x11-base/xorg-server Changelog for 2011-03-27. Udev should now be used instead, by copying /usr/share/X11/xorg.conf.d/10-evdev.conf to /etc/X11/xorg.conf.d/, and setting the keyboard mapping there.

Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option  "XkbRules" "xorg"
        Option  "XkbLayout" "us"
        Option  "XkbVariant" "dvorak-intl"
        Option  "XkbOptions" "lv3:enter_switch"

Airport Extreme

The Airport Extreme wireless card support is now quite stable. Only the firmware is needed for the card to work. It can be extracted, amongst others, from the OSX driver using bcm43xx-fwcutter. This tool is masked by the ~ppc keyword. It is unmasked in the same fashion as before in the /etc/portage/packages.keywords.

Once this is done, the package can be emerged.

$ sudo emerge b43-fwcutter

The firmware has to be extracted from another driver. An OpenWRT driver (but check for OpenWRT's latest version) does the trick.

$ tar xjf broadcom-wl-
$ mkdir /lib/firmware
$ sudo b43-fwcutter -w /lib/firmware broadcom-wl-

It could also be taken from a (no-longer present) MacOS X partition.

$ sudo b43-fwcutter -w /usr/lib/hotplug/firmware /mnt/osx/System/Library/Extensions/AppleAirPort2.kext/Contents/MacOS/AppleAirPort2

Network configuration

As usual, the startup script is created…

$ cd /etc/init.d
$ sudo ln -s net.lo net.wlan0

The easiest to manage the wireless card is to use wpa_supplicant.

$ sudo emerge wpa_supplicant

It is then enabled for wlan0 in /etc/conf.d/net.

Regulatory domain

To be able to use channels 12 and 13 in France (and, we believe, 14 in Japan), it is necessary to change the regulatory domain of the wireless stack (mac80211). We need a kernel helper, crda, which will pull the domain description list as a depency. The latest version of wpa_supplicant is supposed to know how to do that, but is not in Portage at the time of this writing. To set the domain in the meantime, we use iw.

$ sudo emerge crda iw

The crda helper comes with a udev rule to enable it automatically, but the file does not seem to be placed properly. We correct that

$ cd /etc/udev/rules.d
$ sudo ln -s /lib/udev/rules.d/85-regulatory.rules

It is then possible to set the domain using iw. This can be done, if nothing better, in /etc/conf.d/local.start, even if the network configuration is done before.

$ sudo iw reg set FR

:!: There seem to be an issue with the latest version of the firmware 410.2160. After 5 to 10 minutes, the kernel starts spitting out b43-phy0 ERROR: PHY transmission error messages and no data can be transmitted anymore (the network scan returns no network). The firmware has to be downgraded to the previous version, 351.126, to fix the problem The kernel complains when loading it

Aug  9 15:21:20 gloduk b43-phy0: Loading firmware version 351.126 (2006-07-29 05:54:02)
Aug  9 15:21:20 gloduk b43-phy0 warning: You are using an old firmware image. Support for old firmware will be removed in July 2008.
Aug  9 15:21:20 gloduk b43-phy0 warning: You must go to http://linuxwireless.org/en/users/Drivers/b43#devicefirmware and download the latest firmware (version 4).

but it works like a charm.


The following has been deprecated in favor of wpa_supplicant In order to scan for available networks, the interface must be brought up before the association, this and other parameters concerning the wireless link have to be defined in /etc/wireless.

preassociate() {
        ifconfig $1 up

preferred_aps=( "fbxnarf" "NETGEAR" )
key_fbxnarf="1234-5678-9012-3456-7890-1234-56 enc open"
key_NETGEAR="1234:5678:90 enc open"


As the (at least) the DWL-122 driver has to be added separately, the package module-rebuild is useful to keep track of these while updating the kernel.

$ sudo emerge module-rebuild

The modules can then easily be rebuilt after changing kernel.

$ sudo module-rebuild rebuild


This 802.11b USB dongle can be used with linux-wlan-ng. The package is noted as unstable (~ppc). We should add it (and the related packages) to the /etc/portage/package.keywords for it to be installable (and, later, updated).

net-wireless/linux-wlan-ng      ~ppc
net-wireless/linux-wlan-ng-firmware     ~ppc
net-wireless/linux-wlan-ng-modules      ~ppc
net-wireless/linux-wlan-ng-utils        ~ppc

It can then be emerged. Thanks to the usb flag in the USE variable, the USB modules will be built.

$ sudo emerge linux-wlan-ng

Once emerged, inserting the dongle sucessfully loads the module. Still some configuration has to be done. linux-wlan-ng is not yet integrable in the Gentoo base layout. Some tricky work around have to be made. First, the default Gentoo wireless configuration file must be in place, this is done by just copying the example file

$ sudo cp /etc/conf.d/wireless.example /etc/conf.d/wireless

For some obscure reason, the wlan.agent hotplug script is not copied by the ebuild. It should be copied from the source tarball into the /etc/hotplug directory.

$ cd
$ tar xjvf /usr/portage/distfiles/linux-wlan-ng-0.2.3.tar.bz2  *wlan.agent
$ sudo mv linux-wlan-ng-0.2.3/etc/wlan.agent /etc/hotplug
$ sudo chmod a+x /etc/hotplug/wlan.agent
$ rm -rf linux-wlan-ng-0.2.3*

Inserting the dongle now should produce the following output in the kernel messages.

hfa384x_usbctlx_complete_sync: CTLX[5] error: state(Request failed)
hfa384x_drvr_readpda: Read from index 0 failed, continuing
PDA Read from 0x003f0000 in EXTDS space.
PDA Read from 0x007f0000 in EXTDS space.
Writing 4096 bytes to ram @0x7e2ffe
Writing 4096 bytes to ram @0x7e3ffe
Writing 4096 bytes to ram @0x7e4ffe
Writing 4096 bytes to ram @0x7e5ffe
Writing 4096 bytes to ram @0x7e6ffe
Writing 4096 bytes to ram @0x7e7ffe
Writing 4096 bytes to ram @0x7e8ffe
Writing 4096 bytes to ram @0x7e9ffe
Writing 4096 bytes to ram @0x7eaffe
Writing 4096 bytes to ram @0x7ebffe
Writing 4096 bytes to ram @0x7ecffe
Writing 4096 bytes to ram @0x7edffe
Writing 3010 bytes to ram @0x7eeffe
Writing 416 bytes to ram @0x7efc20
Writing 16 bytes to ram @0x7efdd0
Writing 4044 bytes to ram @0x7f0800
Writing 3288 bytes to ram @0x7fe000
ident: nic h/w: id=0x8026 1.0.0
ident: pri f/w: id=0x15 1.1.3
ident: sta f/w: id=0x1f 1.8.3
Prism2 card SN: 000000000000

The interface will be referred to as wlan0. One can set an alias in /etc/modules.d/wlan0.

alias wlan0 prism2_usb

The /etc/modules.conf file is then updated.

$ sudo update-modules

The standard wireless tools cannot be used with linux-wlan-ng at the time. This is specified in the /etc/conf.d/net file as


Of course, the startup script for the new interface has to be created.

$ cd /etc/init.d
$ sudo ln -s net.lo net.wlan0

WEP configuration

In order for WEP to work with linux-wlan-ng, the SSID (fbxnarf in this case) of the desired network must be defined in the /etc/conf.d/wlan.conf file.


A matching file /etc/conf.d/wlancfg-fbxnarf must exist, it is a modified copy of the /etc/conf.d/wlancfg-DEFAULT file. Roughly speaking, the options shown below have to be set to true.

lnxreq_hostWEPEncrypt=true     # true|false
lnxreq_hostWEPDecrypt=true     # true|false
dot11PrivacyInvoked=true        # true|false

Unplugging and replugging the dongle should be enough for it to be brought up and get an IP address from the nearby DHCP.

"High level" packages

The full monty

Some additions to /etc/portage/package.keywords.

dev-python/python-mpd   ~ppc
games-misc/fortune-mod-discworld	~x86
media-sound/mpdscribble ~ppc
media-sound/sonata      ~ppc
www-plugins/mozplugger  ~ppc
x11-misc/stalonetray    x86

Special uses flags go in /etc/portage/package.use.

app-text/poppler	cairo
gnome-base/gvfs		gnome
mail-client/mutt	sidebar
media-video/vlc		qt4
#net-dns/avahi		mdnsresponder-compat
net-libs/libsoup	gnome
net-wireless/wpa_supplicant	qt4
sys-auth/pambase	consolekit
$ USE="-avahi" sudo emerge -N xorg-x11 xev gnome-light gnome-screensaver gdm fvwm stalonetray ssh-askpass-fullscreen zenity mozilla-firefox mozplugger mutt lbdb urlview irssi gajim alsa-tools alsa-utils mpd sonata mpdscribble vlc easytag grip gvim gqview gimp dia xpdf imagemagick pmount rox graveman gtkpbbuttons powerprefs texlive-latexrecommended texlive-latexextra texlive-langfrench latexsuite xfig transfig gentoo-syntax cvs tightvnc subversion bsd-games xkill quilt git lftp traceroute tcpdump netcat nmap host zip unzip strace minicom xterm xclock urlview mesa-progs iptables
$ sudo emerge -uN world

Mounting external hard drives

By default, pmount refuses to have anything to do with hard disks. Including removable USB ones which, it considers, “is not removable.” This can be worked around by adding the specific devices nodes in /etc/pmount.allow:

# /etc/pmount.allow
# pmount will allow users to additionally mount all devices that are
# listed here.


Then install the fortunes. The AOLS fortunes are considered offensive, thus the specific USE flag.

$ USE=offensive sudo emerge fortune-mod fortune-mod-bofh-excuses fortune-mod-calvin fortune-mod-chucknorris fortune-mod-discworld fortune-mod-dubya fortune-mod-dune fortune-mod-firefly fortune-mod-gentoo-dev fortune-mod-gentoo-forums fortune-mod-hitchhiker fortune-mod-homer fortune-mod-humorixfortunes fortune-mod-kernelcookies fortune-mod-osfortune fortune-mod-pqf fortune-mod-simpsons-chalkboard fortune-mod-slackware

A quick file, /etc/profile.d/fortune.sh can be created to display a witty saying using fortune upon login.

case $- in
        tty -s && /usr/bin/fortune -a && echo

X configuration and startup


Xorg is configured with xorg.conf snippets in /etc/X11/xorg.conf.d/.


By default, the radeon driver configures a maximum display memory of 1024×1024. This not wide enough to have a second screen. This is fixed by for Virtual display size to something bigger (2048×768).

Section "Screen"
        Identifier "Screen0"
        Device "Default Device"
        Monitor "Default Monitor"
        SubSection "Display"
                Virtual 2048 768
Section "ServerLayout"
        Identifier "Layout0"
        Screen "Screen0"

The keyboard mapping is set through options for the evdev driver, extended from the default in /usr/share/X11/xorg.conf.d/10-evdev.conf.

# Catch-all evdev loader for udev-based systems
# We don't simply match on any device since that also adds accelerometers
# and other devices that we don't really want to use. The list below
# matches everything but joysticks.
Section "InputClass"
        Identifier "evdev pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
Section "InputClass"
        Identifier "evdev keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option  "XkbRules" "xorg"
        Option  "XkbLayout" "us"
        Option  "XkbVariant" "dvorak-intl"
        Option  "XkbOptions" "lv3:enter_switch"
Section "InputClass"
        Identifier "evdev touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
Section "InputClass"
        Identifier "evdev tablet catchall"
        MatchIsTablet "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
Section "InputClass"
        Identifier "evdev touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"

Obsolete Methods

Other methods to configure the keyboard, in increasing order of age.


The keyboard is recognized at runtime as an evedev device thanks to hald. We configure it in /etc/hal/fdi/policy/10-keymap.fdi.


Just setting the right options in the configuration file for Xorg allows having a fully working keyboard with international support using dead keys, additionally mappin the level 3 shift to the (rather useless) KP_Enter:

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
        Option  "XkbModel" "ibook"
        Option  "XkbLayout" "us(intl)"


The QWERTY mapping of the iBook is quite close to a regular (read “PC”) one. Using the intl variant allows to use all sorts of accents. The only problem is that this variant needs an AltGr keys which is totally missing from the keyboard…

Using xmodmap in the appropriate config file (say .xprofile for example) solves the problem in a QnD way, replacing the useless small Return key at the right of the space bar.

The enter_switch option should do that, but it doens't seem to work. Instead, one adds a file /etc/X11/xinit/xinitrc.d/99xmodmap.sh to directly remap the KPENTER to the Level 3 shift, to be executed at user login.

xmodmap -e "keycode 104=ISO_Level3_Shift"

That's all: €, Å, ō,… ;-)

Obsolete Global Xorg Configuration

The default layout for the xorg.conf file was generated by X itself. This is no longer necessary thanks to auto detection of devices by hal.

$ sudo X -configure
$ sudo cp xorg.conf.new /etc/X11/xorg.conf

The parameters have to be adjusted. This version of xorg.conf has AIGLX and Clone mode on the external display enabled, as well as evdev support for input devices.

Evdev input support

As AllowEmptyInput is enabled in xorg.conf, devices with drivers kbd and mouse are ignored. Only evdev devices, as discovered by hald are added and usable. Thus, it is necessary to start both hald and dbus.


Macintoshes only have one mouse button… Too bad. Fortunately, there is a mechanism available in Linux to map some key-strokes to the middle and right button. Unfortunately, there is an issue when used with evdev. We have to apply the patches from bugzilla to the kernel. Fortunately, this is fixed now.

A new line has to be added in /etc/sysctl.conf.

dev.mac_hid.mouse_button_emulation = 1

By default, the middle and right button will be (resp.) Fn+Ctrl and Fn+Alt, that is, right Ctrl and right Alt.

Display manager

In /etc/conf.d/xdm and (resp.) /etc/rc.conf, one enables the X display manager and (resp.) default session type. We also deactivate the feature that starts the display manager (way too) early.


It can then be started at boot

$ sudo rc-config add xdm default

While we're at it, we also install nice themes (;

$ sudo emerge gdm-themes-livecd gentoo-artwork-livecd

FVWM Session

A modified copy of the /etc/X11/dm/Sessions/custom.desktop file has to be named fvwm2.desktop in the same directory in order to allow selecting FVWM2 for session in GDM.

[Desktop Entry]
Comment=This starts a FVWM2 session


Save and restore the mixer settings.

$ sudo rc-update add alsasound default


If the session is not Gnome, GtkPbButtons should be started at login. An executable startup script called 99gtkpbbuttons.sh is added in /etc/X11/xinit/xinitrc.d

if [ "${GDMSESSION}" != "gnome" -a \
        "${DESKTOP_SESSION}" != "gnome" ]; then
        gtkpbbuttons -d -t Crystal -a /dev/null

Misc stuff

Tools to smoothly integrate MacOS X are bookmarked here.

Disabling Boot Chime

It's annoying and a bit useless. Fortunately, we learn from this thread that the powerpc-utils have a useful tool to set the volume of this chime to 0, nvsetvol. It needs /dev/nvram to be available to access the NVRAM; the driver can be found in the kernel's Character-based Device Drivers.

Setting Boot Message and Password

FIXME None of the following really works at the moment…

There is an oem-message OF variable which can be set to display a message at boot.

$ <in>sudo nvsetenv oem-banner "Blituri"</in>
$ <in>sudo nvsetenv oem-banner? true</in>

There is also an exciting-sounding oem-logo, for which SUN-related information might be relevant. Starting from a 64×64 black and white PNG file, some suitable is created and installed as follows

$ <in>dentify oem-logo.png</in>
oem-logo.png PNG 64x64 64x64+0+0 8-bit PseudoClass 2c 482B 0.000u 0:00.000
$ <in>convert -monochrome -geometry 64x64\! oem-logo.png sun:oem-logo.ras</in>
$ <in>tail --bytes=512 oem-logo.ras > oem-logo.data</in>
$ <in>sudo nvsetenv oem-logo "$(cat oem-logo.data)"</in>
$ <in>sudo nvsetenv oem-logo? true</in>

Passwords seem to be settable through the security-password (XORing each character with 0xAA and writing them in hex) variable, and enforced with security-mode (''none'', ''command'' or ''full'').

$ <in>sudo nvsetenv security-password `echo PASSWORD | perl -ne 'map { printf "%%%02x", 0xaa ^ ord($_) } split //,; print "\n"'`</in>
$ <in>sudo nvsetenv security-mode command</in>

If anything fails, the NVRAM can be reset through Command+Option+N+V (and the PRAM with Command+Option+R+R), though it doesn't seem to impact the password.

Booting from a USB Disk

As it sometimes happens, one can botch their boot record. With a potentially old and malfunctionning CD-ROM drive, other options have to be found. Booting a Debian installer from USB and dropping into a shell might help. There was some evidence that yaboot-1.3.17 was the problem, generating a Decrementer exception, so the goal is to reinstall an older version.

This first requires creating an HFS-formatted bootabe USB stick palatable to OpenFirmware. The boot.img image can be found on Debian mirrors, but a backup version is stored here.

An Open_Firmware-typed partition named bootstrap needs to be created using mac-fdisk (which might need to be built for the occasion; this source archive was found there): first initialise the partition table, then Create the partition. The boot.img can the be written to the newly created partition (with dd), then mounted and the netinst mini.iso (from there copied to it.

On to the problematic computer! One must first identify the OF path to the device. dev / ls and devalias can help the search for devices matching .*usb.*/disk.* (specificaly here, /usb@1b/disk@1). The computer should be bootable from there with boot OFPATH:2,\\:tbxi, but this didn't work (though it did on a Power Mac G5), and neither did it from a Firewire CDROM drive.

Booting a QEmu System on the Machine's Target Mode Disk

The next attempt was to start the machine in target mode (pressing T during boot, as per this documentation), presenting itself as a hard disk on the Firewire bus, for other machines to mount. A PPC qemu emulating a Mac99 (CHRP) machine accessing said hard disk and the latest Gentoo PPC install disc could then be started to try and run a PPC system to reinstall Yaboot.

Latest Gentoo discs don't seem to work well in QEmu, but Debian does, which is enough to mount the hard partitions.

$ <in>sudo qemu-system-ppc -machine mac99  -hda /dev/sdc -cdrom debian-6.0.6-powerpc-CD-1.iso -m 1024 -boot order=dc -net user,vlan=1 -net nic,vlan=1</in>

The rescue image should be booted.

Unfortunately, that didn't serve our purpose of reinstalling QEmu, for various related and unrelated reasons (no yaboot on the Debian CD, and no net in, and out, of the chroot to rebuild an older Yaboot).

Manually Reinstalling Yaboot

After reading through Rogérito Brito's note on installing GRUB, which contains a nice wrap-up of the scarcely documented OpenFirmware boot mechanisms, it didn't seem so hard to install an older Yaboot binary from one of the install discs manually, as was detailed in an old Ubuntu documentary. Still with the iBook in target mode, this is done as follows.

$ <in>hmount /dev/sda2</in>
$ <in>hcopy -r /media/cdrom/boot/yaboot :</in>
$ <in>hattrib -c UNIX -t tbxi :yaboot</in>
$ <in>hattrib -b :</in>
$ <in>humount</in>

Which worked!

projets/gloduk.txt · Dernière modification: 2013-11-15 05:06 (modification externe)