My goal is to dual-boot between Mac OS X and Gentoo. No Mac OS 9 for me. I will most likely spend 90% of my time in Linux, but I plan to use OS X for watching quicktime movies, using the video out on my tv, and for doing a little bit of Cocoa development.
The laptop came home Friday night, September 20, 2002, and I had gentoo booting by early afternoon the next day.
First, my hardware spec. It's a "new-world" iBook, with the 14" screen, one firewire port, two USB ports, a 700 MHz G3, 27.96GB hard drive, 640mb RAM. (I bought a 512mb ISO dimm from 18004memory, way cheaper than from Apple.) It also has the ATI Radeon with 16mb video memory. I saved the full spec sheet from Apple.
Coincidentally, my desktop system is a 700MHz Athlon Thunderbird. Since I will have the same operating system and clock speed on the two systems, I've put up a page with lots of performance comparisons between the two systems. My preliminary feel is that the iBook is faster for integer operations, but I think its memory subsystem has less bandwidth than the Athlon, and the Athlon is WAY faster for floating point. Also, unless your app uses altivec or lots of memory (thus using the L3 cache), a G3 is faster than a G4. Go IBM! (IBM manufactures the G3 now, Motorola makes the G4.)
also, after installing panther, then gentoo, yaboot won't run. An openfirmware reset seems to be required after installing yaboot (hold down command-option-p-r at boot).
here's my new partition layout.
Also here's the output of df -h after installing 283 packages, including ppc-sources-2.4.22-r1 and ppc-development-sources-2.6.3-r2 (I typically use 2.6 now, I only installed 2.4 so that gnucash would compile).
I booted it up, filled out the registration stuff, sent out a couple emails, and surfed the web for a while in The Browser Which Shall Not Be Named. I had read it was a good idea to run the battery down the first time you turn it on before plugging it in to AC, so I just played with it for a while. After about 2 hours, I decided to go for the re-install.
My main partitioning reference was a Debian Linux Install Guide. The problem I had was that it's difficult to find the "Disk Utility". In fact, I rebooted several times in both the OS X 10.1 and Jaguar CDs before I found it in the Jaguar installer. It turns out you want to put in the Jaguar disc, reboot, hold down the "C" key to boot from CD. As soon as the installer comes up, THE VERY FIRST THING YOU MUST DO is go to the "Installer" menu and you will be able to select "Disk Utility". If you do anything else in the installer, it won't let you go to Disk Utility.
From there, I could mostly follow the partitioning directions at the link above. I made two HFS+ partitions, the one on top (which is at the front of the disk) I labelled "Gentoo" and the one on the bottom (at the end of the disk) I labelled "MacOSX". The MacOSX partition I made about 12gb, and the Gentoo partition was the rest of it (about 16gb).
Then I tried to install Jaguar, and found out it would only upgrade an existing OSX install. Oh well, I just rebooted with the OSX 10.1 install disc, installed that (I did the custom install and turned off all the international language packages), had to register again, then rebooted with the jaguar disc and upgraded, again turning off the international packages.
The battery meter on the bottom of the laptop was invaluable here, I could keep watch on the battery while the OS X installers were doing their work. It eventually got down to one light (out of four) and about 10 minutes after that I went ahead and plugged in the AC power. This was somewhere during the Jaguar upgrade I think.
Now I had a working Mac OS X version 10.2 Jaguar system. At this point I took a break and played with OS X for a while. It's pretty damn nice. I also ran Software Update and ended up with Mac OS X version 10.2.1. It wasn't long (probably 20 minutes after running Software Update) before the pull of the penguin took hold and it was on with the Gentoo install.
Really I wanted to try out Gentoo 1.4rc1, which has gcc 3.2. But there was no ISO for ppc, just stageX tarballs, so I stuck with Gentoo 1.2. That's what I have on Raven, my desktop Athlon system I keep talking about. I'm sure in a few weeks I'll be able to upgrade with a simple 'emerge -u world'.
So I downloaded gentoo-ppc-1.2-r1.iso from one of the mirrors and tried out Mac OS X's "Disk Copy" to burn a cd on the laptop. Made a coaster (dog bumped the drive door), then finally got a CD on the second try. Rebooted, held down "C" and saw the penguin! (The frame buffer in Linux draws a penguin at the top of the screen.) Then I was in the Gentoo install.
Partitioning in PPC is different than x86. The program is called "mac-fdisk". The paradigm is a bit different from x86 fdisk. Everything is specified in "Blocks" which are the same concept as "cylinders" in x86. You can have as many partitions as you want. Each partition is listed by its length and starting block. Here is my final partition map as displayed in mac-fdisk, and gnumeric spreadsheet I used to plan the partitions. As you can see, I'm a purist who believes in a separate partition for everything. I made a swap partition of just over 640mb since I plan to have 640mb of physical RAM, and I look forward to the day when the software suspend patch from Linux 2.5 works for PPC. Also, Mac OS X's cheesy "Disk Utility" lost 8 or 9 blocks for me at the end of the disk, even though I thought I was making the MacOSX partition go all the way to the end of disk. But they tell me guis are better! :P
To create the partitions, I first deleted the "Gentoo" partition I created in the Jaguar installer. Then I used the special mac-fdisk command to create the bootstrap partition, that's where yaboot which is kind of like lilo goes. Then I used the 'c' command over and over again to create all the other partitions, specifying a name, starting block, and number of blocks for each. I was a bit nervous at first because there seemed no way to differentiate between a Linux swap partition and a regular Linux partition. But simply naming the partition "swap" caused mac-fdisk to create a partition of type Linux swap.
Here's the output of df on my laptop after getting 210 packages installed, including mozilla and gnome and gnumeric.
disk utilization with 409 packages installed, March 3, 2004
After partitioning, I could pretty much just follow the gentoo install instructions. I wimped out and used the stage 3 tarball, mainly because I knew it was a bit out of date and I would be recompiling it all later, and I wanted to boot from the hard drive into the live Gentoo system as soon as possible. The only wrinkles were kernel configuration and installing yaboot.
I'm running sys-kernel/ppc-development-sources-2.6.2_rc1-r1 now.
Suspend/resume works great, much faster than with 2.4, almost as fast as in OS X.
pmud doesn't work anymore, so now I just run pbbuttonsd. I've updated to pbbuttonsd-0.5.8
Audio mostly works (had to install alsa-lib and alsa-utils). I believe I'm still using the oss interface (alsa's oss emulation)
CD ROM access is no longer through the ide-scsi emulation layer. CD burning no longer requires the SCSI emulation (use 'cdrecord -scanbus device=ATAPI' and 'cdrecord dev=ATAPI:0,1,0') and DVD movies play better without it. Be sure to leave out the 'append="hdb=ide-scsi"' line from your yaboot.conf file if you also drop scsi emulation.
No need to use xfree-drm anymore, the proper kernel module for the ATI Radeon graphics chip is included in the kernel.
On to the config files.
gentoo-dev-sources-2.6.7-r5
ppc-development-sources-2.6.2_rc1-r1
ppc-development-sources-2.6.1-r1
/etc/modules.autoload.d/kernel-2.6
/etc/modules.d/alsa
newest /etc/pbbuttonsd.conf
The kernel on the Gentoo CD was 2.4.19-r6. I can configure an x86 kernel in my sleep, but I was expecting, and got, a few surprises in a PPC kernel. The guide at ibooklinux.net was quite helpful. Here's my kernel config. Sound works with this config; I can play mp3s with xmms.
Don't forget to run 'make vmlinux' rather than 'make bzImage'. So the full command would be 'make dep vmlinux modules modules_install'
newer configs:
ppc-sources-2.4.20-r1
ppc-sources-2.4.20-r3
ppc-sources-2.4.21-r2
ppc-sources-2.4.22-r1This is the last 2.4 kernel which worked for me. The newer versions wouldn't resume from sleep correctly. But you should be running a 2.6 kernel now anyway.
dmesg output at boot:
dmesg
dmesg 2.4.20-r3
dmesg 2.4.21-r2
Homar on the gentoo forums created a kernel patch which allows the touchpad to emulate a scrollwheel. I modified the patch so it applies cleanly to the stable ppc-sources-2.4.21-r2 kernel, and uses the apple key to activate. (any vertical movement on the touchpad while either apple key is held down results in scrolling). This is similar to the effect you can get from ucontrol in OS X.
To turn off the buffering while trying to debug something:
killall -USR1 metalog
To turn buffering back on:
killall -USR2 metalog
metalog's home page
my metalog.conf file
For the CD burner to work properly, the burner is best accessed through the SCSI emulation layer. ide-cd and ide-scsi were both compiled as modules. By default the first module loaded will take control of the CD drive, so the kernel must be explicitly told to let ide-scsi control the CD drive, by using the kernel command line flag "hdb=ide-scsi" and the file /etc/modules.d/ide-scsi.
The file /etc/modules.autoload causes the modules for the sound chip and ide-scsi to be loaded at boot time.
Here's my /etc/fstab file.
I have now changed most of my filesystems to reiserfs. WARNING: be sure to
use a 2.4.22 kernel if you use reiserfs. I experienced hangs on I/O with
reiser and a 2.4.21 kernel. (I'm currently using ppc-sources-2.4.22-r1
which seems to be fine). If you're paranoid, you may want to stick with
ext3. (But reiserfs is much faster, especially for 'qpkg')
new fstab
I tried to tinker with the airport's settings, especially the multicast rate, and it got quite flakey, so those are the settings I came back to.
Also, I turned off the DHCP server in the airport and set the airport to use a fixed IP address.
eth1 (airport) uses a fixed IP address, and that's what I use at home. eth0 (my hard wired ethernet) I set to DHCP and I use eth0 at work.
Right now, I only use one interface at a time; I shut down one before I turn the other on.
I read the docs about the runlevels and found it quite simple to add virtual runlevels. I added "work", "driving", "home", and updated "nonetwork". Now when I get to work, as root I type "rc work". This turns off eth1 and turns on eth0. Then when I go home I can type "rc home" and eth0 turns off and eth1 starts up. Then if I'm away from a network entirely I can type "rc nonetwork".
All I did was mkdir /etc/runlevels/work then use rc-update to add appropriate services to the new runlevels. "home" has net.eth1 in it and "work" has net.eth0 in it.
The only problem with virtual runlevels and different network settings is that sometimes you need different values in /etc/conf.d/net. I wrote some trivial perl scripts which copy different files to /etc/conf.d/net and then switch the runlevel:
rchome (airport, fixed IP)
rcwork (wired, dhcp, but static /etc/resolv.conf file)
rcdriving (airport, dhcp)
Here are the files I put in /etc/conf.d and reference in the above scripts:
Here is a list of all the files in my runlevels (generated by 'cd /etc/runlevels; ls *').
When my ibook boots, the runlevel 'default' has no networking services turned on. This prevents me having to wait forever for ntpdate to fail setting the clock because I'm in the wrong place. I log in and either run 'rcwork' or 'rchome'.
update: here's an ebuild for an orinoco driver for the 2.6 kernels. this is required for kismet to work with a 2.6 kernel
Also, check out this page about wireless network sniffing with an ibook. Following the links on that page, I installed a different orinoco driver for my airport card, and applied two patches. The first patch allows the airport card to be put into monitor mode, the second fixes problems while channel hopping the card.
The ppc-sources-2.4.20-r3 kernel has the patched orinoco driver for the airport which supports monitor mode. But unfortunately, I still had to apply the second patch I mentioned above for it to work.
The ppc-sources-2.4.21-r2 kernel needs no modification to run kismet.
Once you're running the patched orinoco driver you can install kismet to detect wireless networks and airsnort to recover WEP keys.
Here is a tarball of my old /etc/kismet directory.
Update: new kismet.conf file
I just type 'rc nonetwork' then '/etc/init.d/kismet start' as root. Then as my regular user I can run 'kismet_client'.
I also created a perl script called /etc/dhcpc/dhcpcd.exe which starts up a firewall whenever I get a new IP address.
There is an ebuild for hcfusbmodem in portage now, with '~ppc' keywords. I emerged that and used it.
Run the 'hcfusbconfig' script. The serial device created for the modem is /dev/ttySHCF0.
You must have ppp support in your kernel, and install the 'ppp' package. I had to turn off dial tone detection with 'ATX3' in my chat script.
In /etc/init.d/clock, there is a line which looks like this:
errstr="$(/sbin/hwclock --adjust ${myopts} 2>&1 >/dev/null)"
You will want to comment this line out. This tries to adjust the clock for the amount of time since last time the system was booted. Works great until some one else (like Mac OS X) starts independently adjusting the clock. eventually, the dynamic correction factor can get large enough that your clock can be hours off on boot.
I've gone against the PPC grain and made a separate partition for /boot to put my kernel in. Gentoo nicely put a symbolic link called "boot" which points to "." in the /boot directory, so in yaboot.conf I can specify my kernel as either /boot/vmlinux or /vmlinux whichever makes more sense to me when I install the kernel. I'm dual booting with Mac OS X in /dev/hda11, yaboot's bootstrap partition is /dev/hda2, my /boot partition with my kernels is /dev/hda3, and my root partition (/) is /dev/hda9! All that resulted in my yaboot.conf file.
You can see I've already tweaked my kernel config. The dmasound_pmac
module for sound wouldn't modprobe in a kernel without /dev/nvram
support (CONFIG_NVRAM). I had to recompile the kernel and add support
for /dev/nvram (under "Character Devices"). The kernel config above is
my second one, with the /dev/nvram on.
sys-apps/yaboot-1.3.11 /etc/yaboot.conf with a 2.6 kernel installed. (Mon Feb 16 2004)
sys-apps/yaboot-1.3.7 /etc/yaboot.conf (Thu Jan 23 2003)
# Enables new keycodes on PPC 0=disabled
# only use this next line with a 2.4 kernel.
# It will fail on a 2.6 kernel (Which is why it is commented out)
#dev.mac_hid.keyboard_sends_linux_keycodes = 1
# Enable mouse button emulation
dev.mac_hid.mouse_button_emulation = 1
# Set 2nd button to 87 - F11
dev.mac_hid.mouse_button2_keycode = 87
# Set 3rd button to 88 - F12
dev.mac_hid.mouse_button3_keycode = 88
newest /etc/pbbuttonsd.conf, 0.5.8
older /etc/pbbuttonsd.conf
You don't need to run pmud if you're running a 2.6 kernel. But in case
you're running a 2.4 kernel:
sys-apps/pmud-0.10.1-r2 /etc/power/pwrctl-local (Thu Jan 23 2003)
sys-apps/pmud-0.10.1-r2 /etc/power.conf (Thu Jan 23 2003)
A great feature of pbbuttonsd is that if you dim the screen all the way down and keep dimming it, the kernel will turn the screen off! Great for when you want to start a big compile (e.g., Mozilla or KDE) then go to bed.
gtkpbbuttons is a nice gui program which gives you feedback when you press the special buttons. it too dies after a suspend/resume. So far I just run it by hand since I'm not always in X. I will probably put it in pwrctl-local too.
newest /etc/pbbuttonsd.conf (feb 16, 2004)
sys-apps/pbbuttonsd-0.5.2 pbbuttonsd.conf (Thu Jan 23 2003)
update Wed Mar 19 16:20:09 MST 2003
DRI works with XFree86-4.3!
emerge rsync
emerge -u xfree
emerge xfree-drm
emerge -u xeasyconf
Xeasyconf
XFree86 log, july 2, 2003: xfree log
x11-base/xfree-4.3.0-r2 XF86Config-4(Thu Aug 28 2003)
Switched from the "ati" driver to the "radeon" driver.
old config files:
x11-base/xfree-4.3.0 XF86Config-4(Wed Mar 19 2003)
Here is my XF86Config-4 file I used
with x11-base/xfree-4.2.1-r2. (Thu Jan 23 2003).
Original XF86Config-4 without DRI.
Finally I realized that the ebuilds have a flag called "KEYWORDS" that lists which architectures (x86, sparc, ppc, etc.) the package is known to work on. Well it turns out that quite a few packages only have "x86" or "x86 sparc". I've been sticking "ppc" in the list too and then the package installs.
On the Gentoo PPC forum, there is a post about this. They basically say to email gentoo-ppc-dev@gentoo.org with a report of the exact builds you installed so they can then add the ppc KEYWORD. So I plan on doing that as much as possible. You may have to subscribe to the list to send messages though. It's pretty low traffic.
xine is near perfect for playing dvds now. a frame gets dropped now and then, but not very often. Here's the versions I'm using now:
media-libs/libdvdcss-1.2.8
media-libs/libdvdnav-0.1.3
media-libs/libdvdread-0.9.4
media-libs/xine-lib-1_rc4-r1
media-video/xine-ui-0.9.23-r2
For ethernet, the tun.ko kernel module is installed in a different directory than the mol.ko module, and mol can't find it. I copied it to the same directory mol.ko was in. After that, ethernet was fairly easy. tun5 became a new ethernet interface in linux. my linux then had eth0 and tun1. tun1 was 192.168.41.1. Inside mol, there was a new interface called "Ethernet Adaptor 2 (en2)" (After running the mol installer which shows up on your OS X desktop). I set it to use dhcp. then in linux I can rsync and ssh in to it, and in mol I have network access. Quicktime even runs inside it! I have some screenshots of mol running inside X in a window on my screenshot page. Now my favorite way to run mol is fullscreen on the console.
There are a few small issues with mol: if a disc is in the DVD drive, mol will not start. Once started, the backtick/tilde key (just below 'escape') doesn't work, and if I put the ibook to sleep while mol is running, it won't wake up.
Last updated: Thursday, 20-Dec-2007 22:50:42 MST