Linux PPC on iBooks
This tries to be a short guide for driving you getting
linux working on your new iBook2. I'm sure that something here
will be useful for you, even if you are Andrea Arcangeli.
By the way, since this document's getting bigger and bigger,
i decided to put here a short index. I'm going to leave this document
"monolitic", without splitting it in shorter slices.
Contents:
- what to know before starting
- what to decide before starting
- installing debian
- importants post-installation notes
- building a new kernel
- getting audio working
- fighting against X
- getting network
- setting up modem drivers
- getting Airport (Wireless network) working
- building a multimedia station
- using external video dongles
What you hafta know before
Before starting, you should know something.
- linux ppc is still under heavy development, so
something not working well could depend on bad setups
as well as bad code.
- working with i386-linux, you can browse google for
searching help. You'll probably find someone who run into
your same problem. Working with ppc-linux, you can do the
same, but this time you probably won't find help.
- it doesn't matter which distro you chose: if (when) you
need help, (ab)use the debian-powerpc mailing lists. Of course,
its help will be more effective if you're using debian GNU/Linux.
- MacOS is quite untolerant vs other OSes. This will steal
you some more hours. Besides, this forces you to choose a good
partition scheme from now: you'll not be able to give linux more
or less disk space without erase osx too. thx apple.
- iBook2 hw is great. Some choice, however, is quite
excessive IMHO (for cheapness). Modem, audio, powermg will
be things you'll get fed up with.
- apple powerpcs boot sectors are 8Mb large, and the
boot method results completely different as the i386 machines.
You should pass through OpenFirmware
Here, lilo and grub (...) don't exist. You have yaboot.
What you hafta choose before
You've your new iBook in his pack. Free him.
He will want to install MacOS X. Don't let him.
You have to decide something before this.
First, you ought to choose which distribution you're
going to use. Take a look here: Mandrakeppc,
Yellowdog,
Debian.
Debian is the best choice right now. A lot of developers
are using it, and it results to be the most updated.
Besides, debian can claim to have one of the best
user support. You can count on his high-traffic mailing
list and irc channels for live-help. His ml archives are
very rich too. It's more easy-to-use than what say most people,
and stable as well.
Finally, it's the ones completely free linux distribution survived.
Thus, I'll refer to it for this little guide.
Second, you have to get your distribution. I recommend you get
Debian GNU/Linux release "Woody" from one of the
debian's mirror, but if your inet link doesn't enjoy huge downloads
you can choose to buy official cds from debian cdroms vendors.
You can find a list of them directly on debian's site.
If you choose the first solution, don't build isos yourself,
get the official ones instead. And *verify md5sums*.
The first cd (iso) should be enough. If you like to ride your 10Mb
internet connection, you could like to get the second and the third
one too; otherway, you can get a minimal iso-image called net-install.
When you have your cd(s), you're ready to read what follows.
Fire
We said you must not install MacOS. Instead, boot its first cd
and reach the "Disk" util. With its help you have to
partition your disk as you've planned. Follows an example:
You have 20Gb disk space. Say you like to give 10 G each os.
It's important you leave MacOS partition first. I recommend you
to choose HFS+ for MacOS. Leave the 10G remaining unformatted
(Blank space). Apply and install MacOS without thinking more to linux.
Installation should last about 25 minutes.
After that, you could think to debian. Put the cdrom into the drive and
fire up.
Installing debian
There is a really
good guide about install process for debian. Writing this section I noted
it's been updated since my last access. However, it's a very fine document,
thus i won't spend needless words on this theme.
The only thing I'll add is needed on some boot failure. If your kernel taints the screen
after few lines, you'll have to pass "video=ofonly" as kernel arg.
I recommend you use "reiser" as fs for your partitions instead of ext2.
You can choose ext3 as well.
If you need something (quite logorroico, but really) complete, peruse directly
the debian
official installation guide.
| *Tip*: You could run into problems with your monitor. When
the machine boots, the screen blanks and draws nice plasma colors and after just
a few steps and you can't see anything more. This problems comes from
broken framebuffer drivers. If this happens, just pass the argument "video=ofonly"
to the kernel at the boot prompt. This simply specifies to use a generic framebuffer
driver instead something specific (but broken). |
After OS installation
So you washed upon a debianized ibook and want to start using their thousand features.
Now begins the battle.
I sure you wanna use all hardware you got on your ibook, and this is actually the challenge.
Actual installation lets you to control your linux box via console and to use eth network.
We need both of them to reach a fully-usable linux system. If some troubles drove you
unable to use eth || you don't have eth internet connection, you have to get needed software
otherway: go cdrom way.
Elsewhere, you could go ahead reading what follows.
You're supposed to be at first-time-installing stage, however sections should be indipendent
enough you to jump this or that.
Anyway, the first thing you have to do is recompiling kernel. As said, ppclinux is still
under heavy development. This means every version your kernel is it will be old for you.
This means the first thing you have to do is getting and compiling the new kernel.
New kernel
Your notebook carries great hardware, but you probably won't need all working.
Consider disabling IEEE 1394 (<=> firewire) if you don't such devices. Consider disabling
scsi if it isn't needed by something external.
It's fine that all of these machines are built exactly by the same way. This lets us public
ready working ".config" kernel configurations. See kernel section for this.
Take care doing this: a good kernel is necessary for getting your machine working correctly.
If you won't have one, care for fine sw configuration will be time throw away.
What's important for your own kernel is to include:
- developmental code
- ide disk && cdrom support over "Builtin PowerMac IDE support"
- frame buffer device + fb driver for your specific videocard (ATI Radeon) and
fb fonts
- Input core support for Keyboard and Mouse
- Machintosh-specific drivers like PMU+apm emu (if you're going to use power management
features) and ADB Apple Desktop Bus (if you're gonna use mouse and keyboard
- Char devices and specifically I2C support [M, i recommend]
- /dev/agpgart and Apple UniNorth support and disable DRM support
- naturally you have to include fs drivers for all fs you adopted on your machine
- I recommed you include "/dev file system support". It's signed
EXPERIMENTAL while its unstability is thousand lesser that profits it will give
- sound and "PowerMac DMA sound support" if you like to have soundcard
working
- USB support + "Preliminary USB device filesystem" + "OHCI" if
you're going to use USB devices. USB is getting more and more
widely used for its simplicity. I recommend you include it in your kernel even if
you own nothing USB right now
- thanks to Marc Boucher now you can use your internal
56k modem; you must include USB modem support for this.
Notes about devfs: unfortunately devfs isn't yet a linux standard, so you'll need
a wrapper for getting old-style /dev-based applications working: devfsd.
Using debian you only need to "apt-get install devfsd" for having this behaviour.
Do this before rebooting with the new kernel.
| *Tip*: you're working on debian: you must not use the old and
strong inefficient way to compile a kernel other distros requires. Use make-kpkg
tool (found in kernel-package) instead. Peruse the kernel
section for more infos. |
| *Tip*: once bootstrapped with the new kernel, you could
get keyboard not working. Don't panic: reboot the box and append
the kernel argument "keyboard_sends_linux_keycodes=1". Once
gotten control of the system, you can set this to be a default arg through
configuring the boot loader. |
| *Tip*: I recommend you ask the kernel to use the newly compiled
framebuffer driver. This is done by passing the argument "video=radeonfb"
at boot time, (manually or) passing through your bootloader. |
Audio
Linux has two ways for driving audio cards: OSS and ALSA.
Open Sound System
is the linux standard audio system at the moment.
Every app using audio support it, most of them are built actually against it.
Advanced Linux Sound Architecture
otherwise is something newer.
It's aimed to give a new, better audio system which has a longer list of supported
hardware and of supported features.
Since OSS is included in the linux kernel (<= 2.4) while ALSA isn't, most
people still use the first way. It's enough for almost everything you could
do with your soundcard. Your iBook will work well with (nice allitteration, isn't?)
OSS, but it weast a lot of CPU cycles. It's very heavy on a G3. The result you
see is, most videos jitter continuously and don't let you wathing your films in peace.
OSS is easy and fast to set up and maintain. ALSA takes a bit longer.
I recommend you choose the first one only if you'll use some ogg/wav here and there.
Otherwise, go the second way.
OSS audio system
Getting soundcard working with such a system is no longer a big job. If you built your kernel by the
right way, you simply should load some module and set device permissions.
Thus, just two steps:
- probe modules you need. We're going to use oss, cos alsa isn't
mature enough so far.
modprobe dmasound_pmac
You have "/dev/sound/dsp" device file now.
- set correct permissions. If you like (as you have to) to let soundcard
access to user processes, you should instruct devfsd to set correct permissions
automatically:
vi /etc/devfs/perms
and replace original "^sound/" entry with
REGISTER ^sound/.* PERMISSIONS root.audio 0666
ALSA audio system
Let us try to get everything working with the shorter time needed.
- su - and shot your password. Then apt-get install alsa-source
Don't try apt's alsa-0.5 version since it simply doesn't work.
- installing this package, you'll be asked some things:
- which cards should I support? Answer pmac
- shall I include ISApnp? say no
- ya like debugging code? You don't need it
- cd /usr/src/, where you'll find a new "alsa-driver.tar.gz" package.
Just uncompress it with tar zxf alsa-driver.tar.gz: everything is gonna go under
"/usr/src/modules/alsa-driver"
- cd linux, or wherever you hold your kernel sources. I hope you compiled
a kernel yet. If you didn't, take a look here.
- make-kpkg modules
You'll have to wait a bit (∼15m) now. When everything will be done, you get an alsa-module-xxxx.deb.
Use dpkg to install them as a common debian package file: dpkg -i alsa-modules-xxxx.deb.
To use them: modprobe snd-powermac snd-pcm-oss && chmod 666 /dev/sound/*.
Please consider that I have some trouble with devfsd+alsa oss emulation: /dev/sound/* devices
permissions aren't set correctly with the entry in /etc/devfs/perms. Hope yours will be ok.
You should have sound working now.
| *Tip*: kernels before 2.4.19 have dma_sound buggy. It gives great
problems on ibook with mixer. Thus, use up-to-date kernels. |
X
It's important to have audio working at this point. Now it's mandatory you
play something soft, because getting X working isn't a quick job.
Getting XFree86 satisfactoring working requires some step you have to
follow ordinately. The first one will bring you a graphical display onto you
can work. The second one a good window manager. At the last you'll
work for getting acceleration.
-> Starting from the former; first thing: don't use XFree86 package shipped with debian.
You have to get Michel Daenzer's one. Michel is a xfree86 developer that contributes
to linuxppc very much.
You can walk two ways to get daenzer's xfree86 on your debian box:
The first one is more "debian" and really much easier. Theoretically,
you could notice updates to these packages and/or let the system upgrade them
automatically. Actually, Michel says it's not a big woth to maintain this apt source
up-to-date, and he prefer to save some hour of work and let you get and install these
packages manually.
Finally, I recommend you use the second way, which's more up-to-date. Newer package
here means better package almost always. You can check periodically (say, steps of 3 weeks?)
whether new packages have been released, and if you like install them. If you use
the ibook for work, wait some day before updating these sensible components. Elsewhere,
if you feel to contribute the community, you bug
reports on the newest release will surely be appreciated.
At this point, you have to configure the server. For the reason I reported in the
introduction, you could just get a working configuration
and use it for your machine. You can find one here.
Simply download "XF86Config-4" file and put it into "/etc/X11/".
This should be enough to starting to have a graphical screen. Try. Log a console and do:
X &
then return to the console with Alt+Ctrl[+Fn]+Fx where x = consolenum and
export DISPLAY=:0
xterm &
turning back to the graphical screen (Alt+Ctrl[+Fn]+F7 or F8) you should see a terminal opened
on the classic X gray screen, at the resolution of 1024x768. If you get this, you're ready to proceed.
-> The second step you have to do is choosing a window manager you'll work on.
ibook's cpu is not too powerful; result: the lighter wm, the faster work. You're free to choose
windowmanager like Gnome or KDE. How fast they will run depends only from which (and how
much) applications you're going to use. This is only the first aspect you should care, but there are
a lot more: your amount of RAM and swap, number of workspaces you use concomitantly and
so on.
I'll give some reference: I have 256M RAM and 300M swap; about 170M is the amount of mem user procs eat.
I tried ximian gnome for just 2 weeks before coming back to WindowMaker, that I sincerely
suggest. If you need to run just a browser, a mail client and a music player, however,
you can try gnome. You can get both of them through apt-get.
Anyway, you already know, "de gustibus non disputandum est".
-> The last part is giving xfree graphical acceleration. You have to get some other software
for this. You installed daenzer's xfree a bit ago. In the same way, you could go manually
(same URLs) or through apt to install drm-trunk-module-src. You need kernel sources to
build this piece by debian way. Once installed drm-trunk package, you should find
"drm-trunk.tar.gz" file under "/usr/src/". Reach this location and
decompress the file; you get a (new) "modules/" directory. Now, go under
the kernel top level directory and enter command
make-kpkg modules
for getting a new debian package ready to be installed under "/usr/src/". Then,
simply do
dpkg -i drm-trunk-module-2.4.xxxxxxx.deb
| *Tip*: you should have excluded kernel's DRM following
what said upper. Differently, you'll get a lot of
errors by dpkg, and even forcing it to overwrite original modules, probably
you won't have drm working by the right way. |
Network
Easy step.
Sometimes ago "gmac" module was used as lan card driver;
now it's been replaced by the newer "sungem".
Wanna getting onto network? Just:
modprobe sungem
If you get error messages check for its inclusion in the kernel, and if necessary
take a look on new kernel paragraph.
Above two fast examples for "/etc/network/interfaces", which contains
definitions for network interfaces:
# eth0 autoconfigured through dhcp
iface eth0 inet dhcp
# eth0:0 aliased for local network
iface eth0:0 inet static
address 192.168.0.1
netmask 255.255.255.0
Modem
Modem is been a long time problem on ibook. You have to know some history.
Different models have different specifications: "old" models were having
a serial bus dedicated only to their internal modem, so that these latter behave
as common serial modems.
On the newest iBook, Apple preferred to remove all this serial circuitery for embed a
usb modem from "Conexant".
Under MacOS things has been kept completely transparent to the user, by the Apple
uses. Linux suffered all this really much; many help sites recommend to buy an external
modem+a usb->serial adapter for getting an effective internet dial-up link.
Now thing are a bit different. Marc Boucher wrote a pseudo-opensource linux driver
for conexant usb modems. Benjamin Herrenschmidt ported it to ppc platform. Poor words
tell you can finally connect to internet using your internal modem. Condictions are:
- you taint your kernel. Driver's core is closed source for preserving component
technologies. An open source layer keeps independent from current kernel version.
- you reboot your system hundred times more than you did so far. This module
is actually very unstable. It won't give problems when it's not running, but during
analogical connections you could experience a huge number of kernel panics.
Known that, you can go aware getting
usbmodem modules.
Unpack the tarball gotten and reach the main package directory:
tar xjf hcfusbmodem-xxx.tar.bz2
cd hcfusbmodem-xxx
Now you need to setup, compile and install these modules.
make install
hcfusbconfig
This will probe needed modules too. By now you can use your scripts to dial your provider.
It's possible that you'll need to use "hcfusbconfig" each time you want to use your modem.
This module is quite unstable and I experienced a "modprobe" isn't enough to get
all working.
| *Tip*: if you can't dial because you keep getting a "NO CARRIER"
message from the modem, just disable default waiting for dialtone before dialling. This is done
by adding the string ATX3 to the modem's initialization string. Thus, edit "/etc/wvdial.conf"
or "/etc/chatscripts/xxxx" files this way. |
Airport - WiFi
WiFi is a wonderful technology. Imagine wires overriding your home/office, imagine being forced
to browse at your desk, cos your laptop is chained there. Imagine then having one access point only,
hidden in your lumber room, no wires and being free to move wherever you like leaving connected.
iBook's fine for wireless. It doesn't need external stuff like most other PCs: an antenna is integrated, and
the only thing you need is an internal card from Apple. Apple named its IEEE 802.11b implementation
"Airport".
Setting up the airport card under Linux is surely more difficult than under MacOS X, but you only have to
know some things and you won't find problems.
First of all, some theory. I've written two versions of it. The first one took me a bit more time, and
is longer and more complete. The second one is shorter but more clear. I recommend you to read the first one
if you're new to wireless networks: one minute to get well started.
- Say we have a big wireless network, composed by five wireless bases. They maintain three "virtual
networks". Each one is maintained by one or more bases roaming data. Such a virtual networks are
identified by a nominal id, called "ESSid". Differently, there could be a
distinction between any single cell (base): each base has its own "NWid".
Bases and clients talk together through particular "channels", distinguishing the frequency
the signal is broadcast.
It is evident it have to be the same on both the clients and the bases. This is often automatically detected,
anyway.
Clients could identify theirself through a "nick"s, somethings like a network hostname.
Finally, you have to consider wireless signals couldn't be "isolated", so you should care other
people can't spoof your own network activity. This is simply done by encrypting wireless communications with
a key.
This encryption takes names of "WEP", Wired Equivalent Privacy. (This is the basical idea, but don't
believe being this system bulletproof).
This is enough.
You need something before starting your setup. First, include "Network device support
-> Wireless LAN (non-hamradio) -> Wireless lan+Hermes chip 802.11b+Apple Airport" support in your kernel.
Second, get "wireless-tools" (from apt, for example).
Wireless-tools suite iw* tools (notabily: iwconfig the most relevant), needed for setting up the whole
structure. Now you can use them directly through "/etc/network/interfaces" file.
- As each network device, airport is driven by a kernel module which makes avalable a new ethx
interface. So, the kernel module you need is called "airport", and it's stacked above
"orinoco" and "hermes" modules: include them in your kernel ("Network device support ->
Wireless LAN (non-hamradio) -> Wireless lan+Hermes chip 802.11b+Apple Airport"). This is the hw-related
stuff. You'll need then some software to fine-setup your card's options, like wep-keys/channels/essids/nicks etc:
apt-get install wireless-tools. "iwconfig" will be now available for doing these things.
Now, knowing that "/etc/network/interfaces" is the standard file debian uses for network interfaces
configuration, you can take some example here.
Take a look at this example:
iface eth1 inet dhcp
wireless_essid "My_Essid"
# wireless_key s:my_ascii_key
wireless_key my_hexadecimal_key
wireless_nick my_hostname
Note the remarked line. You can inform your airport card of the network key by two ways: the first, defaulting
(choosed when no particular flags are specified), is the hexadecimal key. Alternatively, you could choose to
put the ASCII corresponding key prepending an "s:" to the ascii key value.
Such a field in your interfaces file is enough to raise the wireless network interface through ifup, as you do
usual with the LAN card too.
Naturally you can use other ethernet settings as you do for a normal eth card:
iface eth1 inet static
wireless_essid "duffy"
wireless_key s:donald
wireless_nick mOliTRiX
address 1.15.18.96
netmask 255.255.0.0
Nice thing now. If you're running devfs and you have (apt-get install ) "hotplug", doing a "modprobe
airport" will take up automagically the airport-associated network interface. Alternatively, you can use
"pre-up" and "post-down" interfaces' file options, specifying to "modprobe airport"
and "rmmod airport orinoco hermes". The first way is better because it doesn't fires conflicts lan with
wlan interfaces.
| *Tip*: if you have an airport base running as access point/wlan router, you can obtain
the hexadecimal key by using the airport base configurator under MacOS X. Get into the base options
and find the "Network equivalent password". |
Videos
Hurry: empty line.
Sometimes ago linux users didn't ever imagine they can watch videos and films under
their cool operating system: I still remember my happyness the first time I get my
ISA soundcard working under linux! Well, now things are pretty different. People
protest when they can't see their holydays films under linux. And they make good.
If you introduced linux just some weeks ago you won't know the suffered history of
videos under linux. There have been tons of problems: strange licences, close codecs,
unefficient video drivers... Result: there were many different players, each one playing
only a few formats, and none of which working good.
Some years ago finally started up the project "MPlayer". Thanks to it now
we have a great integrated multimedia system that plays almost every format you can
find run into browsing the net. It's easy to use, fast and portable: it can run on
many platform, thus on linux/powerpc too. (this isn't so normal: a) portable apps requires
very well-written code and b) multimedia stuff requires huge computings from your CPU:
often developers choose the easy way and optimize their code with arch-specific code).
Mplayer is still under heavy development, but most of all because they're continuosly
trying to support new codecs. Bug fixes and optimizations follow the run, however.
The empty line if you don't care the Amazing History Of Multimedia Under Linux.
Well, let's begin. Follow this list:
- go to http://www.mplayerhq.hu and reach
the section "dload"
- you have to download some stuff: the latest mplayer source package, the
fonts package and, if you like to use the (experimental) gui available, a skin
package
Now I suggest you to put everything you downloaded into a "private" folder
like "mplay/", and unpackage everything under this point:
tar xjf MPlayer-xxxx.tar.bz2
cd MPlayer-xxxx
Yes, sources. It does sound bad under debian, but it's necessary for speed. Moreover,
mplayer group ships their packages yet "debianized". You don't know what
I mean? This means you can get the speed for the local-build and the ease of manage
of a debian package. You build a debian package yourself:
fakeroot debian/rules binary
dpkg -i ../mplayer_0.90pre9-0_powerpc.deb (of course replace the correct filename... look for ../mpl*.deb)
Yes, it takes really long time to compile, but this worths any seconds it requires.
You use it from a terminal, running:
mplayer filename.avi/mpg/ogg/mp3/wmv/wav/mov*(not all!)/...
| *Tip*: if you feel "hackish" enough you can build a
personalized package: your-own-language and support for some further format.
let's see what you like to include with "./configure 2>&1 | less", and
put the options you choosed into the "debian/rules" file, after the evenience
of the "./configure" script call. |
Using external video dongles
Apple ships some nice components to get your ibook interfaced with
external monitors. The most common is the "Apple VGA display adapter"
which lets you mirror ibook's screens onto an external RGB monitor. Every
ibook user has one, since it's included in the base pack.
Another device is what apple calls "Video Adapter": it lets you
get ibooks screens onto external devices which support Composite or S-Video
input.
Both of them are plugged into a dedicated bus on the left of the case. [Older ibooks
didn't have svideo out capabilities, while composite was extracted from a strange
magic from phones out.] Of course under MacOS X averything works fine, you just
have to plug your dongle, whathever it is, and the system automagically detects
what it it and what it's linked to. Unfortunately Linux doesn't act the same way so far.
Now, what works and what does not?
- VGA out does whith some trick. You should shut down
your machine, plug in the vga adapter then push the power button to power it up and
suddendly close the lid. OpenFirmware's gonna detect you want
to use an external monitor and will enable it itself. You'll get a clean
framebuffer console but probably X will give some problems. For my
direct experience you can not get both X and console working well.
I prefer to have the first one, and I managed (thanks to several people around
the web/mls for pieces) to get it working. You can find a XF86Config-4 file
here (peruse its comments and adjust them). Note you hafta resume
the old one when you'll no longer use external monitor.
- Video Adapter seems not to. More informations as soon as I'll get them
(and i'll have time to update that stuff).
You can contact me by mail.