macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

iBooks Love Linux
Pages: 1, 2

Installing Debian

I won't document the ins and outs of a Debian install: they're described in detail in other places. I will describe, however, the quirks that are specific to the iBook.



Debian is often criticized as being difficult to set up. In part, this is due to the poor user interface at the package selection stage. My personal policy is to select as little as possible for installation during the install process, and install the software you need later. In particular, selecting the laptop-specific package isn't much use for the iBook, as it has a different style of power management and doesn't have any PCMCIA devices (even if you have an Airport card, it does not use PCMCIA).

The machine booted the first time with a Debian 2.2.x series kernel. One of my first steps was to install a 2.4.x series kernel (Debian PowerPC currently has 2.4.16). I then proceeded to try and configure as much as I could. I had read that to get the most from the iBook you needed to compile your own kernel, but I intended to see how far I could get with the standard kernel as provided in Debian.

I had no problems at all with the built-in ethernet port, screen, USB ports, or CD-ROM drive. They all worked just fine. Even configuring X Windows turned out to be easy enough: just run dpkg-reconfigure xserver-xfree86 and answer the questions.

Screen shot -- click for full-size view.
GNOME running on the iBook (Click for full-size view)

Getting Airport to Take Off

Setting up the Airport wireless access was a little more difficult. For users accustomed to using wireless PCMCIA cards on Intel laptops, there are some differences. The main one is that there's no wireless.opts file that you can edit to set up your wireless network configuration, so when the machine enables the Airport card it can't find which network to join. I set up a simple workaround for this, after installing the wireless-tools package.

In /etc/network/interfaces, I added:

iface eth1 inet dhcp
    pre-up /usr/local/bin/inet_wireless.sh eth1

And created the /usr/local/bin/init_wireless.sh script:

#!/bin/bash
IFACE=$1
iwconfig $IFACE nick MyMachineName mode Ad-Hoc
iwconfig $IFACE rate Auto
iwconfig $IFACE essid MyNetworkName
iwconfig $IFACE enc on
iwconfig $IFACE enc s:MyNetworkPassword
iwspy $IFACE 00:02:2D:02:9D:9D

It would be easy to adapt this script for your own needs, and indeed write some housekeeping scripts so you can easily change between wireless networks. Note that I run an ad-hoc network, rather than owning a base station. That iwspy line enables me to keep a log of the signal strength to the machine I'm using as a gateway to the rest of my network.

Support for the Airport can either be started manually, by running modprobe airport as root, or by adding airport into your /etc/modules file.

As soon as the Airport card worked I breathed a sigh of relief: the rest of the configuration could take place from the comfort of my armchair!

Installing a New Kernel

One major physical difference with the iBook is that the trackpad has only one button. To do the install, I plugged in a USB mouse to circumvent this problem. However, a more permanent solution needed to be found. Another issue was that I had no access to sound, either. Investigation on both of these scores led me to conclude that the time had come to compile a new kernel.

The hero of the PowerPC Mac Linux scene is Ben Herrenschmidt. He maintains a version of the Linux kernel with all the latest toys in it, as well as some other useful tools. I followed the directions on his page to obtain a copy of his kernel. Compiling a new kernel for Linux isn't really that scary, and it went without pain for me. I was helped along the way by following the excellent instructions at iBookLinux.net. The only additional information I required to enable sound I found in a posting on iBookLinux, which showed me which options I needed. I added i2c-core, i2c-keywest, i2c-dev, soundcore, dmasound_core and dmasound_pmac lines to /etc/modules, rebooted, and was away.

Adding second and third mouse button emulation was quite simple. The latest "benh" kernel sets up an easy way to get Linux to interpret keyboard keys as mouse keys. I simply had to run these commands in order to make F10 work as the middle button and F11 as the right-hand button.

echo "1" > /proc/sys/dev/mac_hid/mouse_button_emulation
echo "68" > /proc/sys/dev/mac_hid/mouse_button2_keycode
echo "87" > /proc/sys/dev/mac_hid/mouse_button3_keycode

Every Silver Lining...

I got everything I've mentioned so far here done within 24 hours, even managing a little sleep. However, there was one fly in the ointment. According to all the newsgroup posts I'd read, there should be no problems using the iBook's internal modem. However, I had no joy.

Further scouring of newsgroups turned up the suspicion that Apple had recently changed to using a software modem inside the iBooks, as they had done recently with the PowerBooks. Repeating the steps one of the posters had gone through confirmed that I, too, had a software-based modem. Resourceful though the Linux community is, it's highly unlikely that a driver will emerge for this modem for some time, if at all.

This left me with an obvious problem, as a modem connection while travelling is important to me. A search of the Linux USB hardware compatibility charts turned up some likely options. I particularly liked the look of the Multi-Tech MultiMobileUSB modem, as it was tiny. It is also quite expensive, so I had a quick look through eBay. I managed to find that modem's bigger brother for a fraction of the price, and settled for that. It's still smaller than an average paperback book, so won't add too much to my luggage -- especially as it's USB bus-powered and doesn't need an external power adapter. The modem works fine with the iBook, using the "acm" driver.

Handy Toys

To get the best from owning your iBook, there are several useful packages you can install.

Power Management

The iBook uses a different power management architecture from PC laptops. Whereas PCs use "APM," iBooks use "PMU." I installed the pmud and pmud-utils packages from Debian. Power management controls what happens when you close your iBook lid in order to put it to sleep, and when to spin down the hard disk to save power. I was really happy with the way power management worked: sleep and resume were near instantaneous, and a lot more reliable than with my old Dell laptop.

Special Keys

The iBook has keys for adjusting the volume and screen brightness, as well as ejecting the CD. With a "benh" kernel install, the brightness keys worked but neither of the others did. Stefan Pfetzing has written a small program called ikeyd, that makes the other keys work as advertised with a minimum of pain for the user.

Hot Plugging

Since most of the devices I will plug into my iBook are USB-based, I don't want to be manually configuring all the kernel modules I need to drive these devices. Instead I installed the hotplug system. Hotplug implements plug-and-play, and loads the correct device drivers when you plug the devices in. This also keeps your /etc/modules file down to a short and manageable size.

So far, I've verified compatibility with a USB mouse, my Frontier NEX II MP3 player, Kodak DC3400 digital camera -- and all work just the same as with the PC.

The Verdict

Buying the iBook for its hardware alone turned out to be an excellent decision. It is, however, a big change for PC laptop users. There are no mouse, parallel, serial, or docking ports. Instead you get two USB ports, a Firewire port, a mini-VGA port for external monitor (adapter provided), and a speakers/headphone jack. The biggest difference is probably the lack of PCMCIA slots. This inevitably means that if you own any PCMCIA cards, this investment will be lost if you move to an iBook. This also puts you more at the mercy of whatever hardware Apple decides to put into the machine.

One of the iBook's best features is the screen, which is rock solid, bright, and very sharp. I was a little worried that such a small screen would be a problem, but my fears turned out to be unfounded, even at the maximum resolution of 1024x768 pixels. The keyboard is easy to type on, and feels satisfying to use. The sound through the built-in speakers works surprisingly well: a lot less tinnier than I had expected.

The iBook is very portable. Although not the world's lightest laptop, at just over 2kg it's eminently totable, and appears pretty rugged in its construction. It also runs at a pretty cool temperature, so you can use it resting on your legs for prolonged periods. Putting the iBook to sleep by closing the lid works just fine, and waking it up again takes next to no time. Both Windows and Linux have problems doing this reliably on many PC laptops, so I was delighted to find how well it worked on the iBook.

Visually, the iBook is a winner. It has some great little touches, such as the LED indicator on the power cord that shows whether the battery is being charged. The machine's simplicity is very appealing. With other PCs there's a trend to add many blinking lights and extra keys to the keyboard: Apple has chosen the minimalist route with great success. There are some cute surprises too: the first time I put the iBook to sleep, it was late at night and dark in my office. I nearly fell off my chair when I noticed the book "breathing in its sleep" with a little white light next to the lid clasp slowly pulsating.

There was one disappointment, however -- that Apple changed the modem inside the iBook to one that wouldn't work with Linux. As described above, I've got a remedy, but I'd love to see native support for the internal modem.

All in all, I'm exceedingly happy. The iBook feels, both inside and outside, as though it was designed to be a whole. It is a pleasure to work with: so much so, that I'm considering replacing the Windows PC on my home network with an iMac. Modem troubles aside, the iBook makes a fine platform for running Linux.

Edd Dumbill is co-chair of the O'Reilly Open Source Convention. He is also chair of the XTech web technology conference. Edd conceived and developed Expectnation, a hosted service for organizing and producing conferences. Edd has also been Managing Editor for XML.com, a Debian developer, and GNOME contributor. He writes a blog called Behind the Times.


Return to Mac DevCenter.