Free your iBook
Why should I install Linux additionally to a beautiful, comfortable unix-like Mac OS X? This seems to be idiotic for crusted Mac fanboys because you have a great graphical user interface with Unix as basement. However, compared to Linux Mac OS X has some disadvantages: Linux is free in the sense of the GPL and it is free of cost. There is more software for Linux than for Mac OS and you can learn something new about your computer. As long as Apple hesitates to put Mac OS X under the terms of the GPL one is compelled to search for a free alternative. The best thing is to install GNU/Linux along with Mac OS X so that you can keep on using the iBook’s hardware.
Another lack of Mac OS X is that tools like Apt are absent. If you have worked with these tools for a while it is really hard to work without them. Using DarwinPorts or Fink is half fun and they are weak alternatives. But finally there is only one good and plausible reason for installing GNU/Linux on a Mac: Simply because you can.
Requirements
For installation I decided to use Ubuntu “Dapper Drake” because it is based on Debian and the first boot of the Desktop-CD had made a good and solid impression. Instead of Ubuntu you can decide for Debian 3.1 “Sarge” or better for „Etch“ which I have tested besides “Dapper” and it worked as well. Ethernet, sound card, Touchpad and other hardware were recognized directly except for the Airport Extreme card but it worked after some configuration.
Parallel to Ubuntu I have installed Mac OS X 10.4 “Tiger”. The iBook has a processor with 1.3 GHz and 512 MB RAM and a hard disk with 80 GB: At delivery status the whole hard drive is occupied by Mac partitions. To install GNU/Linux parallel to Mac OS X the whole disk has to be partitioned. It is really tricky to make the Mac OS part smaller. Therefore it should be obvious to make backups of your data because they can be destroyed irreparably.
Partition
There are several ways to downsize the partition. On the one hand there are programs for Mac OS X like iPartition, Volume Works and Drive Genius but they are not for free. Mac OS X itself does not have tools to partition the hard drive except for the command line tool pdisk. With the following command you can activate pdisk:
ibook:~ christian$ sudo pdisk /dev/disk0 Edit /dev/disk0 - Command (? for help): h Commands are: C (create with type also specified) c create new partition (standard type) d delete a partition h help i initialize partition map n (re)name a partition P (print ordered by base address) p print the partition table q quit editing r reorder partition entry in map s change size of partition map t change a partition's type w write the partition table Command (? for help):
I think you can change the size of your partition with the option ‘s’, but I am not really sure and I have not tested it yet.
On the other hand you can partition the hard drive with Linux and the GNU tool parted. Here is the problem that parted cannot downsize a journaled HFS+ file system which is the file system of Mac OS X. To avoid this it is possible to disable the journal of the file system in the command line tool of Mac OS X called Terminal:
ibook:~ christian$ sudo diskutil disableJournal /
Later, when the partition is prepared, the journal can be enabled again:
ibook:~ christian$ sudo diskutil enableJournal /
In order to use parted you have to boot from the Desktop-CD. When the start sound resounds press the C-key till Ubuntu starts from CD. Parted can be used by typing ‘sudo parted’ in the command line and the partition table can be called with ‘print’:
Number Begin End Size File system Name 1 1kB 32kB 32kB Apple 3 134B 80GB 80GB hfs+ Apple_HFS_Untitled_4
In this example, partition number 3 is the one we want to downsize. We can do this with the option ‚resize‘. Parted will ask you where the partition with HFS+ should end: After 80 GB again? You have to fill in the new value. For example when you want to give Ubuntu about 10 GB spaces you have to choose 70 GB. Now the partition is smaller and parted can be terminated with ‚quit‘.
The easiest way to create a new partition is to delete and to reinstall Mac OS X. The reinstallation has a big advantage because you can install Mac OS X with less space by omitting language packages and bundled software you do not need, but it makes sense to install the X11 package. The first installation of Mac OS X used about 11 GB, after my changes it needed about 3.5 GB
Installations
For reinstallation you need the Mac OS X CDs. After inserting the first CD you have to reboot the iBook. When the start sound plays press the C-key until the computer starts booting from CD. In the next step you can choose your language and after that you can start partition with the hard disk utility program. For example you can use the first 10 GB for Ubuntu or Debian and the remaining for Tiger. After that you have to choose the target partition for Mac OS X. In the next step you can customize your installation by deselecting languages and other useless software packages you will never need. The installation will be successfully done after 30 minutes and „Tiger“ is back.
After restart insert the CD with the PPC version of Ubuntu „Dapper Drake“. You can download the ISO image with:
wget -c http://ubuntu-releases.cs.umn.edu/6.06/ubuntu-6.06.1-alternate-powerpc.iso
Note that you need the alternate install CD when you do not have partitioned the disk space before with a boot partition. Otherwise the installation of the desktop CD failed because you cannot create a NEWWORLD boot partition and it appears the error message:
No NewWorld boot partition was found. The yaboot boot loader requires an Apple_Bootstrap partition at least 819200 bytes in size, using HFS Macintosh file system.
However, installation with the graphical installer seems to work, too, if one wants to use the whole hard drive for „Dapper“ and does not want to make a parallel installation, but I did not test it. The ISO-images of Debian can be downloaded from the homepage of the Debian-project. It is a good idea to install the testing version of Debian also known as „Etch“ on the iBook because the current version of the kernel 2.6.17 includes the driver of the Broadcom wireless card BCM4318 that is the Airport Extreme card.
In order to boot Dapper from the alternate CD you have to restart the iBook and to hold the c-key after the start sound. At boot prompt you have to choose „Install in text mode“ and the adventure begins. During installation you should have an active network connection so that the installer is able to configure network. When you get to the point to partition choose “Manual Partition”. On the Linux partition you have to create 3 partitions. The first partition needs 1 MB. That is the NEWWorld boot partition for the boot loader yaboot and it needs the file system HFS. Then create a swap partition with at least 256 MB and format the remaining space for the root directory with an ext3 file system. The installation can start now.
After restart yaboot offers to start Linux by pressing the l-key — L like Linux — or the x-key for Mac OS X. If you do not press one of the keys yaboot will start Ubuntu automatically. You can change this later.
Configuration
“Dapper Drake” supports most of the hardware of the iBook really well especially in Gnome. Also KDE seems to work fine. At first glance the ethernet card, suspend mode, sound, USB and bluetooth are working out of the box. If you do not believe this try to scan for bluetoth devices in the command line. You need the package bluez-utils for this:
christian@ibook:~$ hcitool scan Scanning ... 00:0E:6D:10:1D:B6 Nokia 6310i 00:05:7A:01:A3:80 Airbus A380
In Gnome the function keys are directly supported. When you are using the function key „fn“ together with F1 or F2 you can control the brightness of the iBook’s screen. Pressing the fn-key together with F3 to F5 you can change the volume of the speakers and together with F6 you can activate the numpad or you can eject a CD with “fn” and F12. The keyboard of the iBook is not really supported because the keymap is like the one of a PC. For example you get the @-character by pressing Apple-key and Q. This correlates with AltGr and Q on a PC and so on. The good news is that fn-key together with backspace is the same like the Del-key.
In contrast to KDE suspend is not preset in Gnome. You can change this in “System | Settings | Power Management”. There you can choose in „Actions | When lid is closed“ the value “Standby”. Important for the use of power management and the function keys are the packages gnome-power-manager and pbbuttonsd. If both of them do not work out of the box like in Debian “Etch” the packages have to be installed as root with:
apt-get install pbbuttonsd gnome-power-manager
After restarting the Xserver by pressing the keys Ctrl-Alt and backspace, support is enabled. The remaining hardware is a little more difficult to configure.
Touchpad
The Touchpad works out of the box but the cursor is irritatingly slow. When I plug in a USB mouse it works fine. In order to get the “normal behavior” of a touchpad’s mouse cursor you have to change the file “/etc/X11/xorg.conf” in the section “InputDevice” like this:
Section "InputDevice" Identifier "Synaptics Touchpad" Driver "synaptics" Option "SendCoreEvents" "true" Option "Device" "/dev/input/mice" Option "Protocol" "auto-dev" Option "LeftEdge" "0" Option "RightEdge" "850" Option "TopEdge" "0" Option "BottomEdge" "645" Option "MinSpeed" "0.4" Option "MaxSpeed" "1" Option "AccelFactor" "0.03" Option "FingerLow" "55" Option "FingerHigh" "60" Option "MaxTapMove" "20" Option "MaxTapTime" "100" Option "TapButton1" "0" Option "TapButton2" "3" Option "TabButton3" "2" Option "HorizScrollDelta" "10" Option "VertScrollDelta" "30" Option "SHMConfig" "on" EndSection
After restarting the Xserver again or after restarting the iBook the cursor works normally. Unfortunately scrolling with two fingers and the right-click does not. You can emulate the latter with the keys F10 and F11. For this you have to change the file “/etc/sysctl.conf”:
# Emulate the middle mouse button with F10 and the right with F11. dev/mac_hid/mouse_button_emulation = 1 dev/mac_hid/mouse_button2_keycode = 68 # F10 dev/mac_hid/mouse_button3_keycode = 87 # F11
Boot Manager
You can configure the boot manager yaboot in the file “/etc/yaboot.conf”. A possible configuration looks like this:
boot=/dev/hda5 device=/pci@f4000000/ata-6@d/disk@0: partition=3 root=/dev/hda3 timeout=100 install=/usr/lib/yaboot/yaboot magicboot=/usr/lib/yaboot/ofboot enablecdboot macosx=/dev/hda7 defaultos=macosx image=/boot/vmlinux label=Linux read-only initrd=/boot/initrd.img initrd-size=8192
The first line refers to the NEWWorld partition on “/dev/hda5” where the boot manager is. The root device of the Linux installation in this case is “/dev/hda3” and Mac OS X is installed on “/dev/hda7”. If you want Mac OS X to start automatically you have to enter “defaultos=Mac OSx” otherwise Ubuntu will start first. After saving your changes in “/etc/yaboot.conf” you have to execute “sudo ybin” in the command line. Your changes will take effect after restart. Without executing ybin your changes will be ineffective.
Fstab
You should adapt the file “/etc/fstab” a little. For example I have added the option “noatime” to my Linux partition “/dev/hda3”. The access time won’t be set at every access and this saves power. I also added this option to the Mac partition “/dev/hda7”. The HFS+ partition has to be mounted by user (“users”) with reading and writing permissions (“rw”). This should not be done automatically at system start (“noauto”) but manually to “/media/Mac OS”. For this you have to create the directory “/media/Mac OS” in the command line:
sudo mkdir /media/Mac OS
Here is my “/etc/fstab” as an example:
proc /proc proc defaults 0 0 /dev/hda3 / ext3 defaults,errors=remount-ro,noatime 0 1 /dev/hda4 none swap sw 0 0 /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0 /dev/hda7 /media/macos hfsplus rw,users,noauto,noatime 0 0
HFS+ writeable
The Linux driver for the Apple file system HFS+ cannot write on journaled file systems. Therefore you have to deactivate the journaled option in the command line of Mac OS X:
sudo diskutil disableJournal /Volumes/<Your Volume Name>
Airport Extreme
The configuration of Airport Extreme is a little more difficult because the chipset of the card is from the Broadcom Company and for a long time there was no free driver for Linux. Due to reverse engineering the Broadcom 43xx-project tries to solve this problem. In order to find out which Broadcom chipset is build in your iBook you have to type “lspci | grep Broadcom\ Corporation” in your command line und you will get:
christian@ibook:~$ lspci | grep Broadcom\ Corporation 0001:10:12.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)
If no card will be shown but WiFi works with Mac OS I would still do the following steps. Regularly the chipset BCM4306 or BCM4318 is used. The WiFi-card can be detected by “Dapper” but due to legal causes the firmware is missing. It is possible to extract the proprietary firmware. Before using the firmware please consider that the card works best with Ubuntu „Edgy Eft“ an the kernel 2.6.17. With Dapper and kernel 2.6.16 the card works sometimes and sometimes not. In this case an update from Dapper to Edgy would be worthwhile. Secondly, do not use Wifi-Radar. Remove it when it is installed because it has a driver conflict.
In order to install the program bcm43xx-fwcutter from the universe repository you need to do:
sudo apt-get install bcm43xx-fwcutter
The firmware will be extracted from the file “AppleAirPort2” You can find it in the Mac OS X directory
/System/Library/Extensions/AppleAirPort2.kext/Contents/MacOS
Copy the file to your desktop and start bcm43xx-fwcutter:
sudo bcm43xx-fwcutter -w /lib/firmware ~/Desktop/AppleAirPort2
A bunch of files will be copied to “/lib/firmware”. Now the card is ready for action. First you have to load the driver.
sudo modprobe bcm43xx
You need the following command to establish a connection.
sudo ifconfig eth0 up
In the next step you can scan for networks:
sudo iwlist eth0 scan
When it is successful you will have an output like this:
christian@ibook:~$ sudo iwlist eth0 scan eth0 Scan completed : Cell 01 - Address: 00:0E:2E:6F:E9:ED ESSID:"kabellos" Protocol:IEEE 802.11bg Mode:Master Channel:9 Encryption key:on Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s 48 Mb/s; 54 Mb/s Quality=100/100 Signal level=-50 dBm IE: WPA Version 1 Group Cipher : TKIP Pairwise Ciphers (1) : TKIP Authentication Suites (1) : PSK Extra: Last beacon: 124ms ago Cell 02 - Address: 00:04:0E:26:B5:EE ESSID:"Fritz!Box SL WLAN" Protocol:IEEE 802.11bg Mode:Master Channel:1 Encryption key:on Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s 11 Mb/s; 12 Mb/s; 18 Mb/s; 22 Mb/s; 24 Mb/s 36 Mb/s; 48 Mb/s; 54 Mb/s Quality=100/100 Signal level=-75 dBm Extra: Last beacon: 328ms ago Cell 03 - Address: 00:15:0C:1F:A7:F3 ESSID:"FRITZ!Box WLAN 3030" Protocol:IEEE 802.11bg Mode:Master Channel:6 Encryption key:on Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s 11 Mb/s; 12 Mb/s; 18 Mb/s; 22 Mb/s; 24 Mb/s 36 Mb/s; 48 Mb/s; 54 Mb/s Quality=100/100 Signal level=-75 dBm Extra: Last beacon: 208ms ago Cell 04 - Address: 00:12:BF:43:BD:02 ESSID:"" Protocol:IEEE 802.11bg Mode:Master Channel:13 Encryption key:on Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s 11 Mb/s; 12 Mb/s; 18 Mb/s; 22 Mb/s; 24 Mb/s 36 Mb/s; 48 Mb/s; 54 Mb/s Quality=100/100 Signal level=-67 dBm Extra: Last beacon: 3724ms ago
If you use WEB-encryption at your access point you have to enter your ESSID and your key in the “/etc/network/interfaces” file.
iface eth0 inet dhcp wireless-rate 11M wireless-essid OhneKabel wireless-key 1234-5678-9abc-def0-1234-5678-9a pre-up ifconfig eth0 up
For WPA-encryption please read the how to “WPA with IPW2200 on Ubuntu Dapper Drake“ by Martin Henze.
After configuration you can create a script to start your WiFi-connection with the following content:
#!/bin/bash if [ "$1" == --help ] then echo "Listing of ESSID's" # Lists the availble ESSIDs iwlist scan | grep ESSID echo "Likely interface: " # Grabs the name of the interface that succefully scanned iwlist scan | grep completed | sed "s/Scan\scompleted\s://g" echo "++++++++++++++++++++++++++++++++++++++ " echo "Usage: startwlan [interface] [essid] " echo "Pick one of the above interface and essid's" echo "use the interface that had the essids" echo "++++++++++++++++++++++++++++++++++++++ " exit fi if [ -z $2 ] ; then myEssid=any # Enter here your ESSID !!! else myEssid=$2 fi if [ -z $1 ] ; then myInterface="eth0" # typically eth0 but may be something else else myInterface=$1 fi echo "Bringing network down" sudo ifconfig $myInterface down &>/dev/null echo "Bringing network back up" sudo ifconfig $myInterface up &>/dev/null echo "Changing to $myEssid" sudo iwconfig $myInterface essid $myEssid &>/dev/null echo "Changing to rate to 11M" # this isn't always necessary but helps for Broadcom 4318 cards sudo iwconfig $myInterface rate 11M &>/dev/null # if your having issue getting connected to a network echo "acquiring IP" sudo dhclient $myInterface
Save this script as „startwifi.sh“ for example and make it executeable:
chmod 755 startwlan
You can start the script with “sudo ./startwifi.sh” when you have entered your correct ESSID in “myEssid” and in “myInterface” the right interface. If you want to have a list of available ESSID’s you have to type “sudo ./startwifi.sh –help”. When you have found out your ESSID you can give this and the interface as arguments to the script:
sudo ./startwlan eth0 WIFI_ESSID
If you want to connect to your WiFi-network automatically at boot up, just do the following in the command line:
sudo cp startwlan /etc/init.d/startwlan sudo update-rc.d startwlan start 20 2 .
The basis for this part is the article “Using Broadcom Wireless in Ubuntu Dapper 6.06” which you can find in the Ubuntu forums. In this article you will find the original script to startwifi.sh but it is named getit there. For this and other instructions for the Broadcom card you have to keep in mind that “eth0” is Airport Extreme and “eth1” the Ethernet card. PCI cards in PC’s have different notations.
Troubleshooting
When you cannot extract the bcm43xx-files in the firmware directory and you get following error message instead, you have to use an alternative to install Airport Extreme.
Sorry, the input file is either wrong or not supported by fwcutter. I can't find the MD5sum 70f65f5cbc769d6a32bc507342ee0fab :(
Download the driver wl_apsta.o. The author of “How to: Broadcom Wireless cards without Ndiswrapper” says that one should prefer this driver before all others. I have no idea whether this is valid for the iBook or not. In the command line you can download the file with wget to your desktop:
wget http://drinus.net/airport/wl_apsta.o && mv wl_apsta.o ~/Desktop
The firmware can be installed like the Apple driver:
sudo bcm43xx-fwcutter -w /lib/firmware ~/Desktop/wl_apsta.o
If the installation of Airport Extreme does still not work there is a third way to get the firmware.
For this, you have to download a ZIP-file with several drivers for the notebook Acer Aspire. After you have unzipped it you get a directory named “80211g”. Inside is the file “bcmwl5.sys” that contains the firmware. Start installation as following:
wget ftp://ftp.support.acer-euro.com/notebook/aspire_3020_5020/driver/80211g.zip
The archive can be unpacked with unzip and the file “bcmwl5.sys” can be copied to the desktop.
unzip 80211g.zip && cp ./80211g/bcmwl5.sys ~/Desktop
Finally you have to extract the firmware with bcm43xx-fwcutter:
sudo bcm43xx-fwcutter -w /lib/firmware ~/Desktop/bcmwl5.sys
How to connect an externel monitor to the DVI port
For connecting an external monitor you have to extend the file “/etc/X11/xorg.conf” with the entry “Radeon_Clone”. Furthermore “UseFBDev” should be deactivated because this option is not able to work with external monitors. Remove the following entry in “xorg.conf”.
Option "UseFBDev" "true"
Activate “MergedFB” instead. A modified “xorg.conf” can look like this. Do the entries after the removed line of “UseFBDev”:
Section "Device" Identifier "ATI Technologies, Inc. M11 NV [FireGL Mobility T2e]" Driver "ati" BusID "PCI:0:16:0" ## Removed --> # Option "UseFBDev" "true" ## These are my changes: Option "UseFWPLL" "true" Option "MergedFB" "true" Option "AGPMode" "4" EndSection Section "Device" Identifier "radeon_clone" Driver "radeon" Option "DDCMode" "true" Option "CloneMode" "1280x1024" # "1024x768" Option "MetaModes" "1280x854-1024x768 1024x768-1024x768 800x600-800x600" Option "CRT2HSync" "31.5-80" Option "CRT2VRefresh" "56.3-75" Option "CRT2Position" "Clone" EndSection ## My changes stops here Section "Monitor" Identifier "COLOR LCD" Option "DPMS" HorizSync 28-49 # Changed by me. VertRefresh 43-72 # Dto. EndSection
It makes sense to backup “xorg.conf” before setting it up. In this case you overwrite the new file in the command line when the configuration goes wrong.
After restarting Xserver you can display the screen on an external monitor by using the (optional) DVI-adapter. Curiously enough you cannot get video output from programs like VLC or Xine on the external monitor. On the iBook screen the video shows up fine.
The problem is that XV-acceleration does not support multiple monitors. For video output on the external monitor you have to switch acceleration. You can do this with xvattr from the Universe repository.
sudo apt-get install xvattr
You can switch to the external monitor with the following command:
xvattr -a XV_SWITCHCRT -v 1
In order to go back to the starting position use this:
xvattr -a XV_SWITCHCRT -v 0
By the way I got this hint from “Thias’ Home – Installing Ubuntu on iBook”. And I have written a short script for the switch:
#!/bin/sh # Name: switch (switch monitor) # Usage: ./switch [0|1] case "$1" in 0) xvattr -a XV_SWITCHCRT -v 0 ;; 1) xvattr -a XV_SWITCHCRT -v 1 ;; *) echo "Usage: type './switch 0' or './switch 1'." ;; esac
After doing a “chmod 755 switch” you can execute “./switch 1” and “./switch 0” even if a video is running.
Multimedia: Watching videos and listening to MP3’s
For watching videos you need a streaming program like Totem which can also play MP3’s. Unfortunately proprietary codecs are missing and you have to install them additionally from the Universe and Multiverse repositories.
sudo apt-get install totem-xine libxine-extracodecs \ totem-xine-firefox-plugin libquicktime0 libmad0
If you want to watch DVD’s you need codecs from the unofficial Debian repository “debian-multimedia.org”. First you have to add the source to “/etc/apt/sources.list”:
deb http://honk.sigxcpu.org/linux-ppc/debian/ mplayer/ deb-src http://honk.sigxcpu.org/linux-ppc/debian/ mplayer/
Than you have to install the GPG-key:
wget http://honk.sigxcpu.org/misc/sigxcpu-archive-key.gpg sudo apt-key add sigxcpu-archive-key.gpg sudo apt-get update
After that you can install a library for watching DVD’s with css encryption. As far as I know a guide to install this library is illegal in Germany. So I do not want to talk about it. Further information you can get on Wikipedia’s article “libdvdcss”.
Read the ext3-filesystem in Mac OS X
If you want to mount and read the ext2- or ext3-filesystem in Mac OS X you need to install ext2fsx from “sourceforge.net”. You can install it by double click. After that you have to restart the iBook.
Remove Linux from iBook
I cannot imagine why you should do this, but this is the way to do it: In order to remove Ubuntu you should remove the boot loader yaboot. Go to “System Preferences” and “Startup Disk” and click on “Mac OS X, 10.4.8 on xy”, “xy” in this case stands for the name of your disk, and click on “restart”. After reboot Mac OS X starts as usual.
You can do what you want with the new partition. You can format it as Dos partition with “vfat” to exchange files with the Windows world or you can format it as HFS+ partition for your Mac. Another possibility is to partition the disk with pdisk. I discussed this program beforehand.
ibook:~ christian$ sudo pdisk /dev/disk0 Edit /dev/disk0 - Command (? for help): h Commands are: C (create with type also specified) c create new partition (standard type) d delete a partition h help i initialize partition map n (re)name a partition P (print ordered by base address) p print the partition table q quit editing r reorder partition entry in map s change size of partition map t change a partition's type w write the partition table Command (? for help):
You can format the Linux partition with HFS. Then you can delete it with the option “d” and resize your Mac partiton with “s”. But I have not tested it yet because I want to keep Ubuntu on my iBook.
I killed my boot manager with this bauble, though. To get back to the old state I restarted the iBook by pressing the Option-key (that is the Alt-key) until I was asked which operating system I wanted to boot: Mac OS or Linux. I decided for Linux and I typed following in the Gnome-Terminal after log in:
sudo ybin
After the next restart I had got back to the old state.