wiki:Linux/Ubuntu/PowerPC/AppleiMacG3

Apple iMac G3

I've recently added several non-Intel architecture computers to my collection, all of which will run Linux for package building, testing, development and debugging. One such is an Apple iMac G3 500Mhz with a PowerPC (PPC) 750 CPU, ATI Rage 128 PR/Pro AGP 4x TMDS, and up to 1GB of (PC100) RAM.

Installation

I began by installing 9.04 Jaunty from the  Alternate Installer CD image maintained as an unofficial port.

There were a few problems during installation where package setups failed but those seem to have been related to a temperamental slot-feed CD drive on the iMac. I found by ejecting the CD using a paper-clip poked on the emergency eject button (extreme right edge of the slot) to remove and reinsert the CD, the installation eventually succeeded.

Starting

On iMacs with EFI Open Firmware the yaboot boot-loader is used. It takes a bit of getting used to after GRUB. There are two stages both offering prompts that use a default if no key is pressed. The first prompt is "c" CD boot or "l" Linux. The second prompt is rather like the GRUB menu in that multiple operating systems or kernels can be started. The default is "Linux". To start with kernel command line options you woudl first press the Tab key to get a list of possible boot labels to type, and then add the parameters to the end. E.g:

Linux single debug nosplash break=premount

That's single-user recovery mode (no GUI), verbose kernel messages, no usplash graphics, drop to the busybox prompt before the premount section in the /init script in the initial ram-disk image.

Bug: powers off early in boot sequence

I discovered this issue is caused by USplash not liking the ATI Rage 128 frame-buffer driver. It can be disabled by editing the yaboot configuration file.

Start the system using:

Linux single nosplash

At the recovery options menu, choose to drop to the shell.

List the disk partitions to determine which one contains the boot-loader:

sudo fdisk -l /dev/hda
/dev/hda
        #                    type name                 length   base     ( size )  system
/dev/hda1     Apple_partition_map Apple                    63 @ 1        ( 31.5k)  Partition map
/dev/hda2         Apple_Bootstrap untitled               1954 @ 64       (977.0k)  NewWorld bootblock
/dev/hda3         Apple_UNIX_SVR2 untitled             500001 @ 2018     (244.1M)  Linux native
/dev/hda4               Linux_LVM untitled           39518605 @ 502019   ( 18.8G)  Unknown

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

In this example the Apple_Bootstrap partition is the one containing yaboot.

Mount the boot-loader's partition to a temporary location:

mkdir /mnt/yaboot
mount /dev/hda2 /mnt/yaboot

Edit yaboot.conf and replace the splash options with nosplash:

## yaboot.conf generated by the Ubuntu installer
##
## run: "man yaboot.conf" for details. Do not make changes until you have!!
## see also: /usr/share/doc/yaboot/examples for example configurations.
##
## For a dual-boot menu, add one or more of:
## bsd=/dev/hdaX, macos=/dev/hdaY, macosx=/dev/hdaZ

boot=/dev/hda2
device=/pci@f2000000/mac-io@17/ata-4@1f000/disk@0:
partition=3
root=/dev/mapper/imac-root
timeout=50
install=/usr/lib/yaboot/yaboot
magicboot=/usr/lib/yaboot/ofboot
enablecdboot

image=/vmlinux
	label=Linux
	read-only
	initrd=/initrd.img
	append="quiet nosplash"

image=/vmlinux.old
	label=old
	read-only
	initrd=/initrd.img.old
	append="quiet nosplash"

The nano editor can be used for this (nano /mnt/yaboot/yaboot.conf) or sed can be used to do a replace (sed -i -e 's/\(splash\)/no\1/g' /mnt/yaboot/yaboot.conf)

Bug: Xorg doesn't use high-resolution true-colour mode

When Xorg first starts it doesn't use the full capabilities of the ATI Rage 128 video chip-set (1024x768 24-bit colour). I found the auto-detect for the driver (r128) doesn't happen and so the standard VESA driver is used.

A manual entry needs to be added to the /etc/X11/xorg.conf file. Here's the settings that worked:

Section "Device"
    Identifier      "Rage128PR"
    Driver          "r128"
    BusID           "PCI:0:16:0"    # values are DECIMAL
    VideoRam        8192            # may not be needed since it usually detected
    MemBase         0x94000000      # obtained from 'lspci -vv' output
    IOBase          0x0400
EndSection

Section "Monitor"
    Identifier      "iMac Monitor"
    HorizSync       58-62
    VertRefresh     75-117
EndSection

Section "Screen"
    Identifier      "Default Screen"
    Device          "Rage128PR"
    Monitor         "iMac Monitor"
    DefaultDepth    24
    SubSection "Display"
       Depth     24
       Modes     "1024x768" "800x600" "640x480"
    EndSubSection
EndSection

Section "Module"
    #Disable "glx"
    #Disable "dri"
EndSection 

Section "ServerLayout"
    Identifier "Default Layout"
    Screen "Default Screen"
EndSection

Several values need determining from the system. To find BusID use:

lspci -nn | grep Rage
0000:00:10.0 Display controller [0380]: ATI Technologies Inc Rage 128 PR/PRO AGP 4x TMDS [1002:5052]

The first set of numbers is the BusID, with the values in hexadecimal.

IMPORTANT Xorg expects the numbers to be decimal so they need converting before inserting in xorg.conf. This example would become "PCI:0:16:0" in xorg.conf.

To determine the addresses for MemBase and IOBase use lspci again to discover the memory and I/O ranges:

lspci -s 00:10 -vvvnn
0000:00:10.0 Display controller [0380]: ATI Technologies Inc Rage 128 PR/PRO AGP 4x TMDS [1002:5052]
	Subsystem: ATI Technologies Inc Rage 128 PR/PRO AGP 4x TMDS [1002:5052]
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping+ SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 255 (2000ns min), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 48
	Region 0: Memory at 94000000 (32-bit, prefetchable) [size=64M]
	Region 1: I/O ports at 0400 [size=256]
	Region 2: Memory at 90000000 (32-bit, non-prefetchable) [size=16K]
	Expansion ROM at f1000000 [size=128K]
	Capabilities: <access denied>
	Kernel driver in use: aty128fb

From this example MemBase will be 0x94000000 and IOBase will be 0x400 (both are hexadecimal values).

Bug: Apt sources for PPC ports not set correctly

After installation the software sources list only contained the CD-ROM when it ought to have listed the Internet achives for the PowerPC. The easiest way to have these set is to use Gnome's System > Administration > Software Sources and tick all the source check-boxes on the "Ubuntu software" and "Updates" tab.

Alternatively the configuration file /etc/apt/sources.list should look like this:

deb http://ports.ubuntu.com/ jaunty main universe restricted multiverse
deb-src http://ports.ubuntu.com/ jaunty universe main multiverse restricted #Added by software-properties
deb http://ports.ubuntu.com/ jaunty-security universe main multiverse restricted
deb-src http://ports.ubuntu.com/ jaunty-security universe main multiverse restricted
deb http://ports.ubuntu.com/ jaunty-updates universe main multiverse restricted
deb-src http://ports.ubuntu.com/ jaunty-updates universe main multiverse restricted
deb http://ports.ubuntu.com/ jaunty-proposed universe main multiverse restricted
deb-src http://ports.ubuntu.com/ jaunty-proposed universe main multiverse restricted
deb http://ports.ubuntu.com/ jaunty-backports universe main multiverse restricted
deb-src http://ports.ubuntu.com/ jaunty-backports universe main multiverse restricted
deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ - Release powerpc (20090421)]/ jaunty main restricted

Bug: UK keyboard mapping not correct

If the key-caps don't match the displayed characters in the console and in Xorg it is likely the keyboard layout needs adjusting. I fiddled around alot before the system seemed to accept my choices so I'm not entirely sure which action I took that finally fixed the issue.

However I can report what the active and apparently best working settings are. In Gnome, System > Preferences > Keyboard > Layouts choose "Keyboard model" Apple and "layout" United Kingdom.

The only issues remaining are:

  • shift+2 keycap @ (at) displays a " (double-quote)
  • shift+' keycap " (double-quote) displays the @ (at) symbol
  • back-tick (`) displays the # (hash a.k.a. pound) symbol
  • § (section marker) displays the ` (back-tick) symbol

I've attached a photograph of the keyboard.

Apple iMac USB Keyboard M2452 UK

Attachments