Linux On an iBook

In this article I'll tell you about my experience installing Linux on an Apple iBook.
First of all you might ask "why Apple?". Well, there's a lot: my 800MHz iBook goes just as fast as an x86 laptop running at more than twice the clock, weighs much less and wastes so little of electricity. Now that the battery is new it lasts about 5 hours of normal use (such as what I'm doing now, sitting on the train, writing on Mozilla and listening to some mp3's). Just find me an x86 that can do this, given this weight and price.
And don't forget, Apple are cool! I've seen quite a lot of people hypnotized by the lit apple i have at the back of the screen!
I have decided to install Linux either because OSX doesn't really catch me up, either because of the "ethic" cause of Free Software.
Ok I know you're here just for one thing. Here are the screenshots.

Update 05.03.2005:

It's now about 8 months I have dumped YDL to switch to Debian, and in the last few months a lot of distributions put out some new releases. iBook now ships with a 1.2GHz CPU and at a lower price, and all hardware (apart from internal modem and Airport Extreme) is fully supported by linux. Starting from kernel 2.6.11 even sleep is working.
I'd like to suggest to take a good look at Ubuntu (as for the x86 version it is a solid distribution and very easy to setup and use), not forgetting the new 4.0.1 YDL release, Mandrake 10.1 and the continuous Debian development.

This page hasn't much more to say, but some good things remain, as does my email address for any info you might need.

0. Techical Specs

My iBook has: In the base configuration HD is 30GB, there's no BT and you get 256MB of RAM. I also bought a 3 button mouse, since the one button trackpad didnt' satisfy me at all.

1. The Distribution

There are quite a few PPC distros out there: I chose Yellow Dog because I'm a long time Red Hat user, so it's been the "natural" choice.
So I downloaded the 3 isos, checked the MD5SUMs and I was ready to go.

2. Preparation

First of all I had to partition the HD.
To do this, just insert the "OSX Install 1" CD that comes with the iBook and reboot the machine keeping the "c" key pressed.
When the Apple Installer is up, choose the "Disk Manager" and create 2 partitions, one for Linux and one for OSX. Resize them as you wish, just remember to leave the space for Linux as "free space".

READ THIS

Partitioning WILL DESTROY ALL DATA ON DISK. If you have any data backup them!
After partitioning I reinstalled Panther and rebooted with the first YDL cd inserted, holding down "c".

3. First Round

On the YDL website there was written nice and clear that my video chipset wasn't supported. Anyway I decided to try to install: as expected the OS was installed in a breeze, but without X.
So I wrote to YDL support, and in less than 2 hours I got an answer from Troy Vitullo (thanks again pal!) that pointed me in the right direction.

4. Second Round

So I downloaded 3 new isos:
http://ftp.terraplex.com/~dburcaw/yellowdog-3.0.1-sirius-20040118-install1.iso
http://ftp.terraplex.com/~dburcaw/yellowdog-3.0.1-sirius-20040118-install2.iso
http://ftp.terraplex.com/~dburcaw/yellowdog-3.0.1-sirius-20040118-install3.iso

It's been brought to my attention that those isos are not online anymore, and the official isos haven't been replaced by those that worked for me. So try these eDonkey links:

ed2k://|file|yellowdog-3.0.1-sirius-20040118-install1.iso|659095552|DD007BF7370ADE55D6393D7807DCB7F4|/
ed2k://|file|yellowdog-3.0.1-sirius-20040118-install2.iso|674398208|0C90F1B16E19242F79F2D06D89D99141|/
ed2k://|file|yellowdog-3.0.1-sirius-20040118-install3.iso|579956736|C06EFBA7F433FE63EF996A3BD6DB7FA2|/
ed2k://|file|yellowdog-3.0.1-sirius-20040118.md5|342|85D1B1FA756A706A67CDB2A60F8129BE|/

Else, the kind people of linuxcd.org added the three isos to their offer: you will get them for just $5.97. Here is the page.
Robin Ganter has a SMALL ftp where I have uploaded the isos. Please contact him if you really cannot get the files anywhere else.
For other info contact me.

and I started again installation.

For those of you that already installed a Red Hat there will be no problems using Anaconda, the YDL installer.
After preparing the partitions as desired (I made two, a / and a /home) I chose which packages to install. Keep in mind that YDL 3 is based on RH9, so many packages are quite outdated (Gnome 2.2, for example).
PPC bootlader is called Yaboot and works like lilo: after any change in /etc/yaboot.conf you should run

# ybin

The first time it didn't add OSX among the boot options. It was enough to add the line:

macosx=/dev/hdaX

changing X with the correct partition number (should be 4 or 5, more or less).
Installation went in about 20 minutes (on my PIII 550MHz it took almost an hour to install RH9!), then I rebooted.

5. Horror!

On reboot X wasn't loaded. So I contacted again big Troy that gave me the good hint. As root I gave

# Xautoconfig --fbdev

and I restarted X: IT WORKED!
Here you find my XF86Config.

6. Configuration

Once X was up and running I could configure the system to my wishes.
First of all I added on the panel the Battery status icon: the only APM function not supported is sleep mode.
Then I tried DVD and CDRW, and worked 100%.
Sound is active and obviosly there is no 3D acceleration. There is an ongoing petition asking ATi to support ppc, sign it.
Keys F1 to F5 and F12 have special functions on OSX: F1 and F2 change the brightness of the screen, while F3 F4 and F5 are the volume control. Thanks to the pbbuttons daemon they work out-of-the-box.
Even F12 works as eject, while you change console with fn+ctrl+alt+Fx.
I have no firewire things so I cannot test it (but the kernel seems get it) and USB 2.0 works good.

7. Software Additions

Since I didn't have an internet connection available I downloaded in advance some packages I knew I would have needed, such as Gnome 2.4 and the freshrpms repository.
Gnome 2.4 rpms come from Fedora's FTP: there you'll find most of the packages compiled for ppc arch (and even ppc64 if you're so lucky to have a G5). Here you'll find a list of packages to download to have Gnome 2.4 working: most of them comes from Fedora, I found the missing using rpmseek.com.
After Updating Gnome I fell into a problem: gdm was looking for the Bluecurve theme from Fedora, that obviously YDL doesn't have. So I did this:

Fn+Ctrl+Alt+F1
login as root
# startx -- :1
# gdmsetup


and I set the Wonderland theme. Going back on the F7 console gdm was up and running.
Yellowdog comes with apt installed: updating is as easy as:

# apt-get update
# apt-get upgrade

If you add freshrpms to your sources.list (that I attach here) you're done.
Then I added some more rpm compiled from src.rpm: I put them here for you if you don't want to recompile it or if you don't know how to do it (read further). You'll find them here, and useless to say that they are distributed *without any warranty*.
I have not installed Openoffice (it's 1.02), but I have downloaded 1.1 from  Yellowdog.

8. Compiling

Let me say something about adding software to this distro.
Obviously starting from source code the procedure is as usual

$ ./configure
$ make
#make install

or what's indicated in README.
If you want to keep the system a bit cleaner you should use RPM.
First of all check out checkinstall, a great software that is meant to be run instead of make install: it will install the binaries and add the new program to the rpm database, so that it can be uninstalled with a simple

# rpm -e <packagename>

You'll find a rpm in my rpm directory.
If you want to enter the astonishing world of rpmbuild you have two ways: src.rpm and specfiles.
To rebuild a src.rpm you should use:

# rpmbuild --rebuild <packagename>.src.rpm

and if everything goes right you'll find your rpm ready to be installed in the /usr/src/redhat/RPMS/ppc directory. To install them:

# rpm -ivh <packagename>.rpm

If you want to do it the hard way you should either get a lot of luck or patience.
Writing a specfile isn't so easy: Matthias Saou wrote a nice article about it.
If you're lucky you'll find a specfile right in the source package: to build an rpm just give:

# rpmbuild -tb <filename>.tar.gz

and if everything goes, you'll find your rpms as above,

9.Tips & Tweaks

There are a couple more things to do to make the iBook fully functional on Linux.
First of all the keyboard is meant to be used with OSX, as well as the trackpad.
I remapped the "apple" key to be the "altgr". Here I'll tell you how.
F10 is used as the middle mouse button, and F11 is the right button.
Then there are 2 things distro-specific: enabling the Gnome menu editing and adding TTF fonts.

10. Mac On Linux

Ok, here's the big deal. MOL is a virtual PC that lets you run OSX right inside Linux. It is installed by default, but for me it didn't work, so I went to the website and downloaded the src.rpm to rebuild.
They are built against the default 2.4.24-1.ydl.1.1016 kernel, and will work ONLY with that kernel: if you want to get them they're always there.
After installing MOL you should configure the video:

# molvconfig

and then create a /etc/molrc file in which you'll write:

blkdev: /dev/hda -rw

Now start MacOnLinux (first time as root):

# startmol --osx

and you're done!

11. Bluetooth

YDL says BT isn't supported. I have installed these rpms, and when I find a BT device to test I'll update the page.
Bad news: the bluetooth module does not work. Stay tuned.

12. Conclusion

Ok, this is what I did to make YDL on my iBook work the way I want.
For any issues contact me!

DISCLAIMER

All that's written up here WORKED FOR ME, but I don't give ANY guarantee it will do for you. Your mileage may vary. So please don't consider me liable for any complaint about it.