Updates on how I got everything working will follow as I get time to write.
Old items removed
Apple has released several generations of Titanium PowerBook (aka. tibook). Mine is the generation released in November 2002, this is the last generation before Apple switched to aluminum in 2003. This is the hardware in my machine:
This is "legacy free hardware", it has no floppy and no IRDA (IRDA
got "legacy" quite quickly :-) The lack of floppies makes a USB memory
stick a perfect accessory (I would even say killer-accessory). They
are small USB-mass-storage devices. They're really a FLASH memory
stick with a USB disk interface. They are compatible with Linux,
Windows and (I fully expect, not tested yet) OS X. Thanks to Linpro,
my employer for that Christmas present!
This machine weighs about 3Kg (6lbs), and is quite thin. It comes to about NOK35000 (US list price in December 2002 is about 3600USD) including a Targus sports backpack, Norton Anti Virus for OS X and AppleCare additional warranty for 3 years.
To get a corresponding Dell I would have to accept a heavy (>4Kg/8lbs) and thick machine with worse design at about the same price (but I could probably have two batteries in it, at additional cost). To get a corresponding IBM Thinkpad I would have had to shell out a lot more money. Sony is not available in Norway. Compaq and Toshiba did not have a chance comparing price and features.
BUT, the Dell or IBM would have Pentium CPUs running at about 2GHz. You will hear a lot of Apple Mac users saying that the G4 is so fast pr. MHz. It's not. It's about as fast as a Pentium III at the same MHz. It is true that Apple has shown off Photoshop running 4 times faster on G4 than on PIII but the demo tasks seem to have been very carefully chosen. See CPU speed for more information on this.
One may wonder why Apple insists on a low-res screen like this while the rest of the Laptop manufacturers do 1400x1050 or 1600x1200 pixels in 14" or 15" panels on their high-end models. 1280 pixels across is the lowest resolution I can manage to work with and I find it quite acceptable even after using 1400x1050 on a 15" panel for 3 years. The screen is crystal clear.
As of Yellow Dog Linux 3.0 the support for this hardware is very good. You should be able to get "XVideo" support for full motion video as well as hardware accelerated GL (3D). Possibly with a custom kernel. For Mandrake 9.1/PPC the situation should be the same. The key elements are XFree86 4.3.0 along with a 2.4.21-"pre" kernel for PPC. In the case of Debian the situation is a bit unclear to me. Apt sources should be available. Gentoo 1.4 works quite well, as long as you use a custom kernel (which you can emerge).
It is good Linux hardware, that works for the most part:
As for software: Mozilla works as well as it works anywhere, and Opera is available. ... But your favorite browser plugins are probably not available. Acrobat Reader and Flash plugins are not available. In the case of Flash this is a boon, it makes for a much quieter web experience. And you CAN boot OS X if you find you miss these things. PDF documents are quite well supported by xpdf and gv.
I'll tackle installation as a two step process, first installing OS X, and partitioning the disk in the process, and then Linux. This will work with all distributions, though some distributions may support more convenient ways to do things.
First I had to install OS X (10.2, aka Mac OS X aka Jaguar aka Darwin). In the initial install screen go to the menus and select the disk tool to do partitioning.
With YDL I wanted a 4 partitions scheme. The first partition is for Linux boot, type HFS+. The second is for Linux OS. The third partition is for Linux swap. Set the type of the Linux partitions to "UFS" (or was it FFS? The Berkeley Unix Fast File System). If you want more than one Linux OS partition (separate /, /usr, /var and /home perhaps) you want to add these partitions at this point. The forth/last partition is for OS X, it should be "HFS+" type. Running this disk tool again is a very bad idea. Whenever you repartition your disk in any way it re-initialized the whole disk. Apparently you need third party partitioning software to avoid this. Or Linux partitioning software.
Debian has a horrendous, but very powerful partitioning program. Therefore you can use Apples Disk Tool to create only a boot partition at the start of the disk and a OS X partition at the end of the disk. And then do the rest of the partitioning in Debian.
The Apple partitioning tool is quite tricky. You must use the lock function once you're happy with a partition otherwise the tool will resize your partitions as it sees fit. It seems to be very bad at math, and may change the size of your locked partitions while partitioning, so check the sizes afterwards and tinker more with it if it came out wrong. It's also a bit tricky but you can actually give the partitions exactly the size you want, try specifying the size in MB instead of GB. The disk tool that comes with OS X 10.2 does not allow several partitions of "unused" space (unlike earlier versions) and will override you if you try this, therefore you should make the Linux partitions ufs. Give all the partitions names so you can identify them by name later.
Once the disk is partitioned do a basic install of OS X. When you are happy with your OS X it's time to boot the Linux install CD.
If you're installing Debian please look at this page: Debian GNU/Linux on a TiBook III, very good and detailed install doc for Debian. As a supplement use Adventures in Apple Titanium Powerbook IV land which is about the same hardware as I have.
The first page also shows how to use Debians partitioning program. Read his whole page, you'll need it all to get things right. You especially want to install the kernel like he does, and the dri-trunk package xserver-xfree86-dri-trunk which will save you the trouble of compiling X yourself.
With recent PowerBooks, combined with recent kernels and Debian and a non US keyboard layout you can get into a lot of trouble. There is a new keyboard setting in the kernel that has a very inconvenient default. If you load a Linux keymap while the setting is wrong your keyboard will be unusable. Debian "Sid" (unstable) attempts to remedy this but falls short.
To avoid messing up your keyaboard all-together: Do not activate CONFIG_MAC_ADBKEYCODES ("Support for ADB raw keycodes" under "Macintosh device drivers"). If it's too late do this:
dev.mac_hid.keyboard_sends_linux_keycodes=1
The lack of space between around the "=" is very important.
mount /proc && sysctl -p /etc/sysctl.conf
The page above uses F10 and F11 for middle and right mouse button emulation. A more usual arrangement is F11 and F12. Your /etc/sysctl.conf should read this:
dev.mac_hid.mouse_button_emulation=1 dev.mac_hid.mouse_button2_keycode=87 dev.mac_hid.mouse_button3_keycode=88
To get KDE 3.1 I added this to /etc/apt/sources.list:
# KDE 3.1 deb ftp://ftp.uninett.no/pub/kde/stable/3.1/Debian woody main deb-src ftp://ftp.uninett.no/pub/kde/stable/3.1/Debian woody main
To save yourself trouble you should install KDE 3.1, if you want it, before you do any upgrades to Sarge or Sid.
KDE 3.1 supports sub-pixel rendering, this is a very cool tweak that increases the apparent resolution on your display. It was first invented and patented by Apple on the AppleII and since re-patented by Microsoft for ClearType (yes, the Microsoft patent should be invalid). If you go into the control panel, select "Appearance & Theme" and then "Fonts" you can enable anti-aliasing and sub-pixel rendering. The correct pixel order for my panel is "RGB", but "BGR" is not that unusual, and if Apple uses different sources for the panels then BGR may be right for you. For a very good explanation of how this works turn to Sub-pixel Font Rendering Technology, How It Works. The page will also help you determine if you have a RGB or a BGR panel.
![]() |
The following applies to Yellowdog 2.3. Installing YDL 3 should be a breeze as the graphics is supported out of the box. Which makes most of this section obsolete.
I got a Yellow Dog Linux 2.3 ISO CD image by ftp from a nearby Linux site. I found that Yellow Dog Linux installed easier and everything worked perfectly afterwards. Debian requires more work on your part, but all is explained in the document I point to above. Yellow Dog specializes in PPC and Mac hardware and also sells pre-installed systems on the US market. Yellow Dog 2.3 seems very closely related to Red Hat 7.3 and I have been able to recompile many Red Hat 7.3 SRPMs I've tried.
The Yellow Dog online manuals does not seem to be updated for 2.3 (they're for 2.2) so I'll summarize the install process here.
I inserted my YDL CD-ROM and powered the machine up again. You have got to press the "c" key from power on until CD-ROM boot is evident, there is no boot device ordering as in PC-BIOSes. Of course there isn't! How many times have you seen PCs boot (or fail to boot) from floppies or CD-ROMs forgotten in the drives? It's not user friendly to boot automatically from secondary storage devices. Apple has worked hard at this for ages.
The install of YDL was straight forward, but graphical (GUI) install did not work, the graphics chip set is too new. As you will see there is no Red Hat disk druid or fdisk to partition disks here. You can however use the parted tool which is also used on Intel Linux.
I seem to recall that the YDL install process asked me what run level I wanted to boot to. I answered "3" and so should you, otherwise your screen will start blinking whenever your machine boots until it gives up starting X. ... Or it asked me if I wanted a text or a graphics login. In that case chose a text login. This can also be done after installation by editing /etc/inittab: The line starting in "id:" should read
id:3:initdefault:
Whenever you change this line (or indeed the inittab file at all) give the command "kill -HUP 1" afterwards.
Networking will work right away, almost. I did not find the YDL netconfig program too helpful for the Airport card on my home WIFI network (though it may work well on the builtin ethernet), so here is how to roll your own: Edit /etc/modules.conf, adding two lines:
alias eth0 sungem alias eth1 airport
Don't switch them around, didn't work too well for me. Sungem is the 1Gibit ethernet chip set in all tibooks. In /etc/sysconfig/network-scripts you want two files. ifcfg-eth0 should read like this:
NAME=localhost DEVICE=eth0 IPADDR=10.0.0.135 BOOTPROTO=dhcp ONBOOT=no NETMASK=255.255.255.0 GATEWAY=10.0.0.1 DNS1=10.0.0.1
Except for the obvious one line the ifcfg-eth1 file is identical. Change "dhcp" to "static" if you want it to have a statically assigned address.
Now you can run "ifup eth1" and "ifdown eth1", as root, to get your Airport card up and down.
If you want to be able to give the ifup and ifdown commands as your normal user you should look into consolehelper and look at how the /usr/bin/kbdrate program does it (two more hints: /etc/pam.d/kbdrate and /etc/security/console.apps).
By the way: kbdrate does not work on PowerBooks, but YDL installs it, and it's a good example for ifup and ifdown.
First of all, a new kernel is needed. The YDL 2.3 kernel and the stock 2.4.20 kernel almost works, but they are unable to support the machine in more than 8 bit graphics mode. These days we want at least 16 bits of color.
What I needed was the benh (Benh is something of a PPC/Macintosh guru) 2.4 development kernel. You can get this yourself from http://penguinppc.org/dev/kernel.shtml.
In case you're not familiar with compiling kernels yourself I have made a two tar balls that you may want to use instead. You may want to refer to the The Linux Kernel HOWTO for further assistance with configuring, compiling and installing kernels.
Note that on this hardware you want to boot the machine from the vmlinux file in the kernel tree, not any odd zImage or bzImage files.
Once your kernel is in place you have to update /etc/yaboot.conf. This is very much like lilo.conf and I'll assume that what to put in it to boot from your new kernel is self evident. Make sure you remember to include the 'append="hdc=ide-scsi"' line, otherwise you will get into some trouble later.
When yaboot.conf has been updated you run mkofboot to update your bootstrap to know about the new kernel:
# mkofboot mkofboot: Create hfs filesystem on /dev/hda9? [y/N] y
Time to reboot.
This change is the most radical change in the whole install process. There is a risk of breaking some things, but nothing that can't be fixed with rm and reinstalling X RPM packages. What I describe below worked flawlessly for me.
If you look around on the Web and in newsgroups you may find people taking about overriding chip IDs and such. This will almost work, but the colors on your screen will be all wrong. To get X11 right you have to do the complete compile and install.
The XFree86 project is in the process of making release 4.3 of XFree86. This will support the ATI Radeon Mobility 9000 out of the box. Since the XFree86 guys publish their source tree in CVS we can get to it before the release is made, which clearly saves the day. And since they are in a pre release cycle now they are only putting in bug-fixes, so the CVS version-of-the-hour is very stable. But before you follow the instructions below you should check if 4.3 has been released at http://www.xfree86.org/, it could make everything a lot simpler for you.
The XFree86 source is huge so I will not include it here. If you visit XFree86 Public CVS Access they'll give you the whole picture about the CVS source. Follow their instructions for "Anoncvs Via ssh". Then check out the source. It should come down to these commands:
# CVS_RSH=ssh # CVSROOT=anoncvs@anoncvs.xfree86.org:/cvs # export CVS_RSH CVSROOT # cd /var/tmp # cvs co xc
The checkout will take a while. Many hours. Over broadband. It's not reasonable to do it over a 56K modem - unless it's free to keep the line up. But it's quite doable to do in several interrupted batches if you only have fast Internet access for a short while at a time.
Once it is downloaded I took a look at the INSTALL document. I needed to configure a little bit, all my configuration was done in site.def. There are three changes: ProjectRoot should point to where you want to install this new X. It is reasonable to set it to /usr/X11R6, but I didn't like to overwrite RPM installed software so I chose /usr/local/XFree86-4.3-pre-cvssnap. Later I've come to prefer to install on TOP of the distribution's X, /usr/X11R6. Then at the end I appended two lines:
#define LinuxDistribution LinuxRedHat #define InstallXserverSetUID NO
LinuxRedHat because YDL is very close to being Red Hat. I believe this is the right choice for Mandrake too. If you run Debian or something else look in some around in linux.cf to find the right value.
Now I built it (make world) and installed it (make install) according to the INSTALL document. You just installed on top of your old X installation. If you reinstall packages with the X server or XDM or such you may find that things break. They will be fixed again once you do make install again, so keep your source tree.
Almost done, you need a good /etc/X11/XF86Config-4 file. As you see mine is set up for Norwegian keyboard. Any (Europeans or others) that use ALT-GR on their PC keyboard to get characters you use (for example any of {[]}@£$øæåßöü) and so on) will want to claim that their keyboard is "pc105" like I do. If you don't have ALT-GR on your PC keyboard use "pc103". Then change the "XkbLayout" to the right two letter country code. Otherwise there are no changes needed. I will get back to how the keyboard is set up later, this will be enough for now.
If you type "X" as root now you should get a fine white and black diagonal mesh pattern on your screen and a mouse cursor you can move around. Which means that X worked. Press ALT + CTRL + Backspace to terminate X. If X worked you can invoke /etc/X11/prefdm -nodaemon and you should get YDL login screen. Congratulations, the hard work is over. You can now change the /etc/inittab (see above) line to read 5. The middle mouse button is emulated by F11 (you may have to press fn+F11) and the right mouse button is emulated by F12 (or fn+F12). If you have a USB mouse you can just plug it in, it will work.
If something is wrong you should get your usual text screen back. If it didn't work I'm afraid you're pretty much on your own, you have to debug your problems. It may be helpful to look at /var/log/XFree86.0.log to find out what failed.
|
Gentoo Linux is not for the faintest of heart. There is no graphical installation and you have to compile all your software yourself - through a very smooth and automated process.
It was my third distribution on this machine since I felt that Yellow Dog 2.3 had many issues (limited selection of packages, hard to compile a good deal of things), Debian Woody was too old and Debian Sarge/Sid not very mature. Gentoo I've found admirably stable, complete, feature-full and pleasantly edge.
The big issue with Gentoo is that you get to compile everything yourself. This takes a long time, but it works very well. I've been able to install all the software I wanted, including KDE 3.1, lame and DVD stuff without having to add special lines to something like sources.list or upgrading my compiler and other awkward things.
I installed from a pre-release of the Gentoo 1.4 install CD, and built everything from stage 2 and up to KDE and Mozilla. KDE 3.1 requires some "masked" (experimental) packages for a complete build. When you bump into these you can build them by hand by locating the ebuild file and going ebuild /full/path/foobar.ebuild merge and Bob's your uncle. The whole build process was very smooth, if lengthly. When it got up it had XFree86 4.3 and supported XV right away. For accelerated GL I needed to emerge ppc-sources-benh-2.4.20-r10 or some 2.4.21 kernel (lately you want xfree-drm in addition to your kernel). And then that worked. It can be a bit tricky to select the correct options.
You may experience problems with a messed up keyboard under Gentoo. Please refer to the Debian section if this happens to you, or to avoid it in the first place.
The Powerbook keyboard has function keys to adjust sound volume and screen brightness. In addition the norwegian layout lacks a good number of keys that one needs in Unix, and it has some keys that I don't need that I can reuse to get the keys I do need.
My Norwegian Mac keyboard is not very good for Unix use. There is no "|" (pipe), no "{" and "}" (braces) and no "[" or "]" (brackets). There is a soft line break key beside the right Apple (option) key which is useless, and there are two Apple keys which have no function. I know that US Apple keyboards are better in this respect, But let's face it, it's a word processing keyboard, not a programming keyboard or a Unix keyboard. To get all this working I'm going to put the ALT-GR key onto the Apple key, and put some of the missing keys on ALT-GR combinations.
Since I have already claimed to have a "pc105" keyboard my Apple keyboard is mapped out like a standard PC keyboard, and not all the keys give what the cap symbol says. For example, to the left of my return key there is a key whose cap says @ and * when shifted. It returns ' (quote) and * when shifted. Exactly like a Norwegian PC keyboard. The really Nice thing would have been to look at Apples keyboard tables and construct a Apple keymap containing all the symbols I need. You can do that as an excercise if you want. I'll just flesh out the pc105 setup to get it usable. The pc105 keyboard is in my fingers, I can ignore the key cap symbols.
A pc105 keyboard has everything set up for ALT-GR, all I had to do was use "xev" to figure out the keycode of the Apple keys (both return 115) and the code for the soft line break key (108). I'll use the Apple key as ALT-GR and the line break key for Compose to easily be able to key umlauts and such (ö = Compose " o, ß = Compose s s). Also I want all the numeric keys to have a lot of missing symbols. And since the tibook keyboard lacks Delete I'll want Delete to be Apple + Backspace.
In the file .Xmodmap (this is a standard X setup file, the login scripts reads it automatically, but not KDE startup scripts) I entered this:
keycode 10 = 1 exclam exclamdown onesuperior keycode 11 = 2 quotedbl at twosuperior keycode 12 = 3 numbersign sterling threesuperior keycode 13 = 4 dollar EuroSign onequarter keycode 14 = 5 percent onehalf cent keycode 15 = 6 ampersand yen fiveeighths keycode 16 = 7 slash braceleft division keycode 17 = 8 parenleft bracketleft guillemotleft keycode 18 = 9 parenright bracketright guillemotright keycode 19 = 0 equal braceright degree ! There is no Delete key on Apple keyboard, some X apps need it keycode 22 = BackSpace Terminate_Server Delete ! Soft-LineBreak key -> Compose keycode 108 = Multi_key ! Apple key -> AltGR keycode 115 = Mode_switch
Then give the command "xmodmap .Xmodmap" after which a press of the Apple key + 2 gives a "@". --- And so on. And this file will be reinstalled every time you log in. But it is NOT installed before login so at the login screen none of these extensions are available. You need to keep your password clean of symbols that are not on your keyboard.
The PowerBook keyboard has screen brightness controls on F1 and F2. It has sound volume controls on F3, F4 and F5. When I finished installing YDL 2.3 these controls were directly on the keys, no shift or fn key needed. I found this awkward, I need the function keys for window manager operations, and I don't need to adjust the volume and brightness that often, so I wanted the function keys to be function keys first, and adjustment keys second.
These keys are controlled by pbbuttonsd, and YDL 2.3 comes with version 0.4.2 which does not support the function swap. The newest version available does. Look at the pbbuttonsd project homepage to get a new version. While you are at it get a new version of GTKPBButtons as well. The pbbuttons in Gentoo is new enough.
Each program has a nice GNU configure script. But by default they install themselves in /usr/local, which I didn't want so I ran all of them with one option "--prefix=/usr". After install you have your pbbuttonsd.conf in /usr/etc and not /etc. It contains quite a few settings affecting power saving, including the "suspend" button. Key 116 is the power key beside the keyboard. You want to change two lines so that they read like this:
dev_cdrom = "/dev/scd0" ejectcdkey = 161
Note that these keycodes are not the same as the X keycodes. Unfortunately.
Start pbbuttonsd: "/etc/init.d/pbbuttonsd start". If you now run "powerprefs" it will let you set some basic preferences, for example the mode of your touchpad, whether you want to press the "fn" key to get the function keys, and some other things. The settings you give with powerprefs are not saved..., you need to edit the pbbuttonsd.conf file yourself to make this permanent. I didn't change anything. If you run "gtkpbbuttons" you will get on-screen display of all changes you do with your keyboard. YDL starts gtkpbbuttons as part of the X startup sequence, but it dies if pbbuttonsd dies, so you may have to restart it.
| Key | Function |
|---|---|
| F1 | Reduce screen back light |
| F2 | Increase screen back light |
| F3 | Mute sound |
| F4 | Lower sound |
| F5 | Louder sound |
| F6 | Num Lock (never missed that, some use it as compose key) |
| F7 | ? |
| F12 | Eject |
| ALT+F1 | Change trackpad "tap" mode, cycling backward |
| ALT+F2 | Change trackpad "tap" mode, cycling forward
|
OS X identifies this as a 1GHz PowerPC machine. Linux boots it to 667MHz (66% speed). This helps save battery power of course, and makes it run cooler even when power is connected. But, it's not for that I got a 1GHz CPU.
To do something about this you need a kernel which supports "CPU frequency scaling". This is found in the "Platform support" menu of the kernel configuration. (Note that this may break Linux if you run OS X 10.2.8 or later.)
If you take a look at /proc/sys/cpu/0, you will find three files: speed-min, speed-max and speed. To change the CPU speed all I have to do is
# echo 1000000 >/proc/sys/cpu/0/speed
Even /proc/cpuinfo and the bogomips rating changes when you do this. But of course giving these commands becomes very tiresome. You could imagine a GUI that lets you change the CPU speed manually at need. But that too is very manual. If you take a look at /proc/cpufreq you get to see the current CPU speed policy in power:
$ cat /proc/cpufreq
minimum CPU frequency - maximum CPU frequency - policy
CPU 0 667000 kHz ( 66 %) - 1000000 kHz (100 %) - performance
Very neat, if I could only get the speed to change based on need. For this I needed "cpufreqd". Not bundled with YDL yet. A general introduction to CPUFreq is found at http://www.brodo.de/cpufreq/. But cpufreqd lives here. It should be run at boot, so you need a cpufreq init script to start it then.
Now your CPU speed and battery charging level will be watched by
cpufreqd, and the CPU speed changed according to
/etc/cpufreqd.conf. I have cut it down to two policies, when
AC is connected run at 66-100% in "performance" mode. At high battery
power (95-100%) run at 66-100% in "powersave" mode. At lower battery
power run at 66%. cpufreqd would be even better if it would measure
the system load and increase the CPU speed if the system became CPU
bound. Unfortunately it does not to that yet. Here is your
chance to write a cool patch.
There is a lot said back and fourth about the relative speed of
Intel IA32 CPUs and PowerPC CPUs, and it seems accepted that PPC does
more pr. MHz than IA32 does. It makes it harder to compare when
neither Apple or Motorola publishes SPEC benchmarks for their CPUs.
IBM does publish PowerPC benchmarks but their CPUs are different from
Mototolas so this is not relevant for us.
Of course benchmarks are pointless unless you measure for
your application. I don't have one application. I
have gathered some numbers that are not particularly relevant for me,
they are shown below.
CPU speed
| Name | Selidor | Roke |
|---|---|---|
| CPU | PPC 7455 (G4) | Celeron (Lobotomized Pentium III) |
| MHz | 1000 | 635 |
| MHz ratio | 1.0000 | 1.5748 |
| Disk | IDE | IDE |
| RAM | 1GiB | 1GiB |
| Kernel | 2.4.20-ben1 | 2.4.20 |
| Gcc | 2.95.4 20010319 (prerelease/franzo/20011204) | 2.96 20000731 (Red Hat Linux 7.2)
|
| Selidor | Roke | Roke scaled time | Aparent result | |
|---|---|---|---|---|
| Emacs compile time | 152s-156s | 240s-240s | 152s | G4 compiles like a Celeron |
| bc fac function | 13.6s | 13.1s | 8.3s | Celeron is better at arbitrary precision math
|
Benchmark notes
define f (x) {
if (x <= 1) return (1);
return (f(x-1) * x);
}
f(10000)
Based on this scant evidence I'm still going to say that for most operations a G4 MHz is about as fast as a Pentium III MHz. Recently a photographer that works a lot on computers, Rob Galbraith, wrote an article that finds Intel faster. Apple should wake up if they want to continue. Cool hardware design can compensate for a lot, but not if they keep lagging behind, even if the saying goes "you can fool some of the people all of the time".
Later I installed GCC 3.2 which supports the G4 and Altivec. Gzip ran 10% faster when compressing a large file when compiled with these options: -O2 -maltivec -mcpu=7450 -mabi=altivec -mpowerpc-gfxopt.
I have not gotten very far on this subject. You should even expect bad advice here, since I have not experimented much. The battery life seems to be something like 3 hours or more. Quite good IMHO. But some tweaking helps.
First read the Battery Powered Linux Mini-HOWTO, Power Management Techniques section. This is the basic stuff for saving your battery. The advice about sysloging is very good. Look at all possibilities.
PowerBooks don't have APM, but they have a PMU (Power Management Unit). And the Linux kernel emulates /proc/apm so that battery monitors and such have a well known information source about battery status. The time left field is fairly funky: Sometimes when the battery is nearly full it goes large or to -1. And sometimes the time increases. I suspect that this time is calculated by the kernel somehow, and the numerical oddness comes from odd math :-) In Dell laptops this number came from the batteries themselves and has nothing to do with how long you can actually hope to get the battery to last.
The CPUs can save power when idling. And of course I just installed the cpufreqd program to help reduce CPU power consumption. The big drains left are back light, disk and CD-ROM/DVD.
The back light is up to you, and pbbuttonsd. You can tune this in /usr/etc/pbbuttonsd.conf:
onBattery_sleep = no onBattery_dim = yes onBattery_blank = no onBattery_Tsleep = 3000 ; time in 1/10s onBattery_Tdim = 600 ; time in 1/10s onBattery_Thdoff = 60 ; time in multiple of 5 second intervals
onBettery_dim controls whether the display should be dimmed after onBattery_Tdim tenths of seconds. All these are described in the pbbutonsd.conf(5) man page. Read and tune.
pbbuttonsd also helps with IDE disk spin down, it's "HDoff" parameter corresponds to hdparms -S switch. HDoff should be set to something suitably short, 12 is 60 seconds (it measures in 5 second intervals between 1 and 240). 12 should work. Now we only need to get the disk to be able to spin down in 60 seconds. If you disabled flush on sysloging earlier, we can hunt for other causes.
One thing that gets us is that whenever a file is opened and read the files "atime" timestamp must be updated. This results in a meta data update and at some time later a disk write. There are two ways to defeat this: Go around looking for files that are accessed often and use ext2's chattr command to turn off A time updates for each file and directory. If you use ext2/ext3. I tried this once. It was impossible. What I do is disable atime updates altogether. In /etc/fstab i insert the word "noatime" in the options column for all disk based file-systems. On my tibook I have only one filesystem:
/dev/hda10 / ext2 noatime 1 1
The battery-powered HOWTO also suggests disabling swap. This can have (has had in the past) detrimental effects on the kernels memory management, so I have not done that. Of course, disabling atime can have detrimental effects too, which could be bad on a file server, but not on most laptops.
Now I know of one more thing: Tuning bdflush. Bdflush is a kernel process that manages the kernel disk/io buffers and writes stuff to disk when it has been updated ("dirty pages are flushed"). Bdflush can be tuned through the file /proc/sys/vm/bdflush as documented in the kernel. Read the documentation before you go on please. I do this in /etc/rc.local:
echo 60 5000 0 0 500 300000 60 20 0 >/proc/sys/vm/bdflush
First it sets the nfract parameter to 60, this is how high a percentage of dirty buffers that will be tolerated before writing to disk is forced. The other thing it changes is setting dirty data buffers timeout to 300000 jiffes (100 jiffies/sec) which is 50 minutes. The theory behind this is that you would like to keep the disk stopped once it is stopped. If you're writing something important you may find that the disk spins up anyway when you save. This is because
And if you want to force the disk buffers to be written to disk you may give the command "sync" at any shell prompt. But of course you're only goofing and surfing on the Internet anyway, and your Mozilla cache is not worth spinning up the disk for.
If this is a sound theory I hope to find out eventually.
The Apple "SuperDrive" is a CD/CD-R/CD-RW/DVD/DVD-R reader and burner. The speeds are 24x/8x/4x/6x/1x respectively.
This "just worked". As I have eluded to earlier IDE-SCSI emulation should be enabled. The rest is according to the CD-Writing-HOWTO, with SCSI emulation. For reference my "cdrecord --scanbus" looks like this:
# cdrecord --scanbus
Cdrecord 1.10 (powerpc-unknown-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
scsibus0:
0,0,0 0) 'MATSHITA' 'DVD-R UJ-815 ' 'D0C4' Removable CD-ROM
0,1,0 1) *
0,2,0 2) *
0,3,0 3) *
0,4,0 4) *
0,5,0 5) *
0,6,0 6) *
0,7,0 7) *
For the benefit of configuring any burning software that does not auto detect devices the burning, or generic device is /dev/sg0, and the block, or cdrom device is /dev/scd0.
I have not attempted to burn a DVD-R, but I understand that the process is the same, and it should likewise just work.
This is not an ideal ripping machine. In theory it should be able to do 24x. In practice cdparanoia with no options rips at about 2x (a 5 minute track in about 2 minutes 30 seconds), with no errors. With the -Z (disable paranoia) option it rips at about 5x (same track in just under 1 minute). Ripping with -Z is probably a bad idea with damaged disks though. All in all I'll keep ripping my CDs with the Plextor drive in my desktop computer.
This works. I've used AcidRip which is a GUI for Mencode. It's a bit beta (or alpha) at this time but it holds great promise.
The PowerMac hardware has a sleep (suspend) mode, but it has no suspend to disk function. Unfortunately with kernels around 2.4.20 the sleep mode results in a garbled screen when it wakes up again. This turned out to be a kernel issue, and is fixed in later 2.4.2x kernels.
Suspend to disk (also known as "hibernate") is a very useful function on PC laptop hardware. PowerBooks don't support this at all. But apparently the Linux 2.6 kernel series will have this as a function themselves. This will be nicer than on PC hardware too since you can boot OS X between a Linux suspend and the resume. I hope the disk I/O for this function will be fast though, most of my colleagues with 512MiB laptops does not care to wait for the resume from disk, much less the suspend which is very slow at saving state.
To get GL and screen lighting control and such you need to roll your kenels right. Base this on a 2.4.21 kernel. If you have not compiled kernels before you should seek advice or read the Linux Kernel HOWTO carefuly.
You can test GL by running glxgears. If it shows about 100 FPS you are on software GL and it didn't work. I get more than 1000FPS when GL works. Once GL works install "tuxracer". Cool game.
To get controll of the screen backlight simply enable CONFIG_PMAC_BACKLIGHT. And run pbbuttonsd.
Do not CONFIG_MAC_ADBKEYCODES or you risk a messed up keyboard.
After upgrading OS X 10.2.8 many people have had problems booting Linux. At a early point in the boot process they will simply power off. Apparently Apple included some patches to the power management firmware that caused Powerbooks to behave this when CPU frequency scaling and backlight control is enabled. Booting from a older boot CD helps a lot. My Gentoo 1.4 pre CD worked, so does older Debian PPC CDs, the kernels on these does not have the features that causes the behaviour. Also 2.4.23 and 2.4.24 kernels work fine. So either postpone your upgrade to 10.2.8, or if you already did it boot from a old CD and mount your filesystems (root and /usr needed), chroot into your filesystem and build yourself a new kernel.
If you have a kernel version that causes your machine to shut down these are the two things you want to disable, from my .config:
# CONFIG_CPU_FREQ is not set # CONFIG_PMAC_BACKLIGHT is not setIf you have a kernel build tree you can simply remove these from your own .config and run make oldconfig.
Of course the screen brightness buttons won't work anymore. Nor can you speed the CPU up to full speed.