Apple_iBook_G3
| Laptops • TV Tuner Cards • Wireless • Servers • Storage • Other Hardware • Motherboards • Related |
Building Linux on a PowerPC can be a bit of a challenge - support for PPC isnt as well developed, and answers to questions can be more difficult to come by - but building Gentoo Linux on an iBook is not only possible but can provide a brand of Linux that is customized and optimized for the computer.
Gentoo Install Stage1 Introduction
Stage1 installs build Gentoo Linux from the ground up. stage1 installs though aren't necessary and know that only stage3 installs are officially supported by Gentoo. Stage1 installs though are thorough and provides a good oppurtunity to learn how Gentoo and Linux work. A stage1 install's only difference over a stage3 install is that the system will be fully optimized for the computer's architecture. stage3 installs are base systems pre-built for a basic architechtures (toolchain, compiler...).
The basic install of Gentoo Linux is about the same for all architechtures, parts that are Macintosh specific are "Partitioning" and the "Bootloader".
It is recommended to use this guide along with the Gentoo Handbook.
Picking an Installer
I use the Gentoo Minimal Install CD. The Gentoo Minmal Install CD provides a well tested means to install Gentoo Linux and includes numerous pages of documentation to help the process. For CD users burn the CD at a low speed to ensure that the medium is transfered correctly.
Disk Setup
I choose to have a dual-boot Linux alongside my Mac OS 9 install. To create a dual-boot system the disk must be partitioned. There is no way to partition the disk without erasing it's contents first. So be sure to save the important data on the Mac OS 9 install or better yet backup the entire system.
Partition with MacOS Install CD
There are two ways to partition either use the Mac OS "Disk Setup" utility or use the mac-fdisk utility on the Linux Install CD. I choose the former.
Restart the system and hold C on boot with the Mac OS Install CD inserted to load the Mac OS Installer. With Disk Setup utility, partition into 3 volumes. Example:
2.7G / - Unallocated 384MB swap - Mac OS Extended 2.6G / - Mac OS Extended
Mac OS needs to be on the last partition - this is important for the bootloader to run correctly.
When partitioning is done install Mac OS.
Gentoo Install CD Setup
Now restart the computer and zap the PRAM (Apple-Option-P-R). The Mac OS keeps several system settings in the PRAM it's best to empty these first. Then load the Linux Install CD.
The Minimal CD is all that's required but a connection to internet is necessary.
Start the Gentoo CD and type:
gentoo docache
Or just hit enter. The docache option will place the CD's contents in RAM and installation will be smoother.
The CD may occasionally hang, just restart and try again.
Quick tip:
To look up information during the install and another computer isn't around the links text browser can be used: Switch consoles (alt or alt-option + F1,F2...) and type links.
Time and Date Rule
Linux is very strict with settings for keeping an accurate time and date. If the clock is not configured or misconfigured, set the hardware clock before booting! Some programs may not run correct it this isnt' done. Setting the hardware clock on a Macintosh can be done through Open Firmware. Hold down Apple + O + F when starting the iBook to get to the Open Firmware prompt.
To set the time to: 1:23:45 PM June, 7th, 2007
decimal dev rtc 45 23 13 6 7 2007 set-time
When Linux is booted, check the software clock. Linux should set the software clock with the hardware clock time:
date
To enter a software clock time manually:
date MonthDayHourMinuteYear date 013105172007
Most computers use "Universal Time" (UTC - also known as Greenwich Mean Time) but Mac OS 9 uses localtime. If dual-booting with Mac OS 9 make sure Linux understands this. Tell Linux to set the system clock to the hardware clock then tell the Linux the hardware clock is localtime. (Don't use "--localtime" if using OS X or above or if just installing Linux).
hwclock --systohc hwclock --localtime
- A note about dead batteries and time skew.
Firing Up the Network
If this message is seen at boot:
- Error, timed out waiting for a valid DHCP server response Network is down.
Then the MinimalCD wasn't able to automatically detect the local network.
Most networks cards are detected though. If not, try typing net-setup code>.
For an airport network:
modprobe airport net-setup
Remote Install
Gentoo Linux allows the system to be installed from another computer with ssh. This process allows one to follow the Gentoo handbook through a GUI interface and allow some commands to be just copied and pasted in.
I give the CD a password to be safe here and the start the ssh daemon:
passwd /etc/init.d/sshd start
Now type ifconfig to show the current computers IP address and then on the remote computer:
ssh -l root 192.168.1.101
Setting Partition Types
In earlier Linux releases hard disk settings would often be set to safe levels which meant poor disk performance. Now these values are auto-discovered in most instance and this is no longer necessary. If experiencing extremely bad hard disk preformance see the hdparm article.
Defining the Partition Map
The partition map was already created with Disk Setup. mac-fdisk will be used to specify what each partition will be used for.
mac-fdisk /dev/hda p #print current partition map Create Apple_Bootstrap b #for Apple_Bootstrap select 8p #selects eighth block device root setup c #custom setup 9p #first start block, 9th partition 9p #end block, 9th partition / #name of root partition swap setup d 10 c 10p 10p swap #name of partition w #write changes to disk y #to write partition map q #quit
Formatting the Partitions
There are several good filesystems in Linux. The "ext3" file system is a tried and true - it offers journaling and is very dependable. There is also reiserfs, which is newer and has better support for smaller files. Format the partition(s):
mkfs.ext3 /dev/hda9
or
mkfs.reiserfs /dev/hda9
With memory less that 512MB in Linux it is best to make a swap partition and activate it. If more than that I wouldn't bother, a swapfile can be created later if the user decides swap is needed.
mkswap /dev/hda10 swapon /dev/hda10
Mount the now root partition to the temporary directory.
mount /dev/hda9 /mnt/gentoo && cd /mnt/gentoo
Download Base Stage and Change Root
Nearby mirrors can be found for most users. Use that location and use wget to retrieve the stage1 file. Or use "links" to download the file as well.
Download and Unpack it:
wget http://gentoo.cites.uiuc.edu/pub/gentoo/releases/ppc/2006.1/ppc32/stages/stage1-ppc-2006.1.tar.bz2 tar -xvjpf stage?-*.tar.bz2
Remove the stage if confident:
rm stage?-*.tar.bz2
iBook Configuration Files
Only really useful for a first generation iBooks.
Changing Root
Copy domain name server(DNS) info from the CD to root filesystem, mount temporary filesystems, and change root.
cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf mount -t proc none /mnt/gentoo/proc mount -o bind /dev /mnt/gentoo/dev chroot /mnt/gentoo /bin/bash env-update && source /etc/profile export PS1="(chroot) $PS1"
- env-update will complain about an empty portage tree because one hasn't been installed yet, but will be done so shortly.
Configuring Portage
With the download and unpacking of Stage1 there is now a compiler and basic tool chain necessary to begin building a Linux operating system. First Portage (Gentoo's compiling system) will need to be configured so it can build a system that is tailored to the computer.
The Portage Tree
Portage is the compiling system of Gentoo, almost everything in Gentoo gets compiled.
Before beginning to compile the portage-tree is needed. The portage-tree is the directory of available packages and how they compile. To get the tree:
emerge --sync
- emerge --sync will download the portage-tree but may not cache right the first time, this is because there isn't a fully running portage yet.
make files
First there is the make.default which is already set with basic USE flags and settings needed to build the system (compiler, compiler tools...). This file should never be touched.
Next are the make.profiles. These are the files Gentoo developers build for basic types of computers (desktop, server...). A generic make.profile is already setup but usually it is better to choose a more specific one. To see what the make.profile is set to:
ls -gF /etc/make.profile lrwxrwxrwx 1 root 46 2007-03-20 17:34 /etc/make.profile -> /usr/portage/profiles/default-linux/ppc/2007.0/
For a different make.profile remove the link and link to the new one:
rm -f /etc/make.profile ln -s /usr/portage/profiles/default-linux/ppc/2007.0/ /etc/make.profile
The "desktop" or "server" profiles:
/usr/portage/profiles/default-linux/ppc/2007.0/desktop /usr/portage/profiles/default-linux/ppc/2007.0/server
Setting up make.conf
The make.conf is for personal USE flags and settings that run on top of the make.default and make.profile. The make.conf overrides settings found in make.profile and make.default.
The single most important thing to do to having a successful Gentoo build is providing as complete a make.conf as possible. Think about what the system needs and what it doesn't. How detailed the make.conf is is a fundamental part to how the system will run. Here are the make.conf variables that are best to detail:
To edit the make.conf:
nano /etc/make.conf
CHOST
- CHOST defines the architecture of the PC. This is important to get right.
- -- "... it is a lot of work and dangerous to try and fix this later in the build, research and be sure that it is right one."
CFLAGS
- CFLAGS can define the CPU architecture more specifically, usually though they match the CHOST.
LDFLAGS (Not Recommended)
- Some people use tip safe LDFLAGS, but the hassle of a slight speed increase over some packages having issues emerging can become a hassle.
USE Flags
- When compiling programs these programs often have variables that can turn on and off support options. These options can be set globally by adding them to make.conf.
- A basic set of USE flags are included in the chosen make.profile. To see what the Gentoo developers have set up as the basic USE flags type: cat /etc/make.profile/make.defaults.
- A couple of examples: For older computer OpenGL, CD burning,(-opengl, -cdr) won't be used, also consider "nodoc" for limited space.
ACCEPT_KEYWORDS
- The ACCEPT_KEYWORDS variable defines what software branch to use on the system. In Gentoo, there is a stable branch for already tested software and an experimental branch. If user is willing to test more recent software, consider using the testing branch, but expect more time debugging problems. To have Portage use the testing branch, add a ~ in front of the architecture.
VIDEO_CARDS
- Value defines video card type. This value will tell xorg-server what video card DRI to build in. Also a video card DRM is required either by the x11-drm package or by seperate ati or nvidia packages. Many values are available, see: TIP VIDEO_CARDS.
INPUT_DEVICES
- Tells xorg-server what basic devices are or will be connected. Items include keyboard, mouse ...
LINGUAS
- Open Office users should specify their language (e.g. LINGUAS="en")
Locale Selection
Location selection is important for items like currency and language.
nano /etc/locale.gen
Uncomment the one to use, I use the first two for United States.
en_US ISO-8859-1 en_US.UTF-8 UTF-8
(Optional) Using a Temporary Filesystem
emerge is the program that directs compiling for Gentoo's portage. For the rest of the process, it'll be used to compile the system. If the computer has enough RAM, a person could use a wrapper script for emerge ( called temerge ) that mounts a temporary file system in memory that can greatly speed up compile times. Most programs don't require alot of memory to compile, but for gcc around 1GB of RAM will be needed.
To use temerge, Stage1 doesn't include the programs mount or unmount so add them first;
emerge sys-apps/util-linux
Beginning to Build
The first step is to build a new compiler and toolchain. There will be a lot of compiling that can take several days to build on older computers. Portage is a well tested and complete compiling system and eases the process. Here are a few tips:
- Previous Versions: Occasionally during compiling errors can occur. If choosing to use the unstable branch, the newest updates and less tested programs come with it. If there is a problem compiling along the way, check the Gentoo Package Page, and revert back to an older version to compile. Or better yet add eix emerge eix and then run eix-sync. This will update the portage tree so eix is aware of it. Then run eix <package>. To emerge a specific package:
emerge =program-(version)
- Dependencies: Check the dependencies of a program to see if a problem can be discovered.
emerge -pv --tree program
- Custom USE flags: Apply custom USE flags for a package (e.g. media-sound/lame -gtk) and put in:
nano /etc/portage/package.use
Bootstrapping the System, Emerging System
Now to begin compiling the compiler and toolchain. This step takes about 15 hours on a 300mHz laptop.
The bootstrap script will begin the process:
/usr/portage/scripts/bootstrap.sh
- On some systems it may be necessary to install a new perl system for the bootstrap process to run right:
emerge --nodeps gdbm libperl perl
- If the bootstrap process needs to be restarted, it's possible to skip a step of an already compiled program by using ctrl+c.
Add a Few System Settings
Completing the bootstrap correctly will give a reliable compiler and toolchain to build the rest of the system. A few settings need to be set now.
Generating Settings
The locale information (currency, languange...) was created by glibc when it compiled, so now to generate the locale set earlier:
locale-gen
Locate the timezone and link it to correct file.
ls /usr/share/zoneinfo rm /etc/localtime ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
Set the Linux clock on the new system to the right type: "UTC" for PC's and Mac OS X, "local" time for use Mac OS 9. Add the timezone here too.
nano /etc/conf.d/clock
CLOCK="UTC" TIMEZONE="America/Chicago" CLOCK_SYSTOHC="yes"
Keymap Setup
nano /etc/conf.d/keymaps Keymap="mac-us"
nano /etc/rc.conf UNICODE="yes"
Also in rc.conf can be set the default terminal text editor, nano ok, but many users prefer vim.
env-update && source /etc/profile
Using a Compiler Cache (Optional)
Theres a myth that using a compiler cache (ccache) can speed up compile times. This myth is actually true but only if compiling from the same source - otherwise, forget it.
Finish with the Base System
Now it's recommended that the compiler (gcc) and toolchain be built with the new compiler. This appears redundant but often is a good idea.
emerge --deep --emptytree system
This command won't recompile the compiler but will compile the other system tools:
emerge --deep --noreplace system
When done, update the enviroment:
env-update && source /etc/profile
The preferences will need updating.
etc-update
etc-update is the Portage system configurations updater. etc-update either allows one to keep the previous configuration files or replace the old with the new. When updating configuration files the "-3" option will give a choice if the file should be replaced.
System Daemons
These daemons run with the system as necessary tools and support - there is a single command line at the bottom.
System logger:
emerge sysklogd emerge logrotate rc-update add sysklogd default
- Use syslog-ng for an advanced logger. (It will have to be configured. Configure syslog-ng.
A manager of internet-based activity:
emerge xinetd rc-update add xinetd default
Time scheduling daemon:
emerge vixie-cron rc-update add vixie-cron default
The virtual device filesystem for the system device tree:
emerge sysfsutils
Allow remote sessions to/from computer:
rc-update add sshd default
As One Command:
emerge sysklogd logrotate && rc-update add sysklogd default \ ; emerge xinetd && rc-update add xinetd default; \ emerge vixie-cron && rc-update add vixie-cron default \ ; emerge sysfsutils udev; rc-update add sshd default
etc-update
Filesystem utilites for ext3 and reiserfs:
emerge e2fsprogs emerge reiserfsprogs
File system Settings
fstab setup
The fstab file tells what drives/partitions and their respective filesystem are available to Linux. A fstab is included in the configuration files.
nano /etc/fstab
It is good idea to create an /etc/mtab here before installing the kernel and its bootloader.
grep -v rootfs /proc/mounts > /etc/mtab
The mtab is similiar to the fstab only it defines every file system virtual or not.
Creating a Kernel
The kernel is the core of Linux. The kernel communicates directly with the hardware on the system. Compiling a kernel requires two steps: learning about the computers hardware, and typing a basic command to compile.
To configure to the kernel (like the make.conf) it is important to get the hardware information correct. General rule of thumb is: if unsure about a component - leave it in.
Download the kernel source with patches from Gentoo:
emerge gentoo-sources
Or use the unpatched kernel:
emerge vanilla-sources
Some of the devices can be detected with lspci;
lspci > hardware.txt
An iBook kernel configuration is provided in the configuration files.
cd /usr/src/linux cp /boot/config-version .config
Compile the kernel:
make oldconfig make menuconfig make clean zImage modules modules_install
- clean isn't necessary if this is the first compile and make pmac32_defconfig can be used to create a generic ppc .config.
To install (make install doesn't work for PPC) manually copy the kernel and config files to the /boot directory:
mv vmlinux /boot/vmlinuz-<version> cp System.map /boot/System.map-<version> cp .config /boot/config-<version>
The kernel can be named just about anything, but it needs to be put in /boot.
Adding Video Support
The DRI component of video should be built into the kernel:
Device Drivers - Character devices ---> <*> /dev/agpgart (AGP Support) [*] Apple UniNorth support [*] Direct Rendering Manager (DRI support) <*> ATI Rage 128 Device Drivers - Graphics Support ---> <*> ATI Rage 128 display support
The video DRM component usually better supported outside the kernel:
emerge x11-base/x11-drm
Installing separate kernel modules
Some drivers that are installed make themselves aware to udev but it's a good idea to list them anyways:
Substitute the kernel's version to find the modules:
find /lib/modules/2.6.<version> -type f -iname '*.o' -or -iname '*.ko'
Determine the modules needed and add them to the module load file (/etc/modules.autoload.d/kernel-2.6).
A modules sample:
# Filesystems udf vfat fat hfsplus msdos # Firewall ip_tables # Video Modules drm mach64 # Sound snd-powermac # Others lcd # needed? usb-storage
update-modules
Networking Setup
Choose a hostname (a name for the computer). Its common practive to use a last name followed by the computer name so it's easy to find on a network.
nano /etc/conf.d/hostname HOSTNAME="smith-ibook" rc-update add hostname default
Add hostname and Internet Protocal v6(if used) to /etc/hosts:
nano /etc/hosts 127.0.0.1 localhost partridge-ibook
If the wireless device is on eth1 make sure a there is a link to the script in /etc/init.d. Then have it start at boot:
ln -s /etc/init.d/net.lo /etc/init.d/net.eth1 rc-update add net.eth1 boot
- Networking Handbook
- Bug:The init script for networking may not load right the first and will need to be restarted. A more dynamic option (NetworkManager) is discussed later).
Dynamic Host Configuration Protocol
DHCP is a daemon used to lookup internet addresses and will be necessary to install for most users. "dhcpcd" is the default (and more tested) choice for install, but I liked the ability and size of udhcp last time.
emerge udhcp
Setting Up the Network
Install wireless-tools here. It's needed for a wireless setup but some of it's programs are also needed for a wired connection.
For wireless add wpa_supplicant for modern routers. Wireless-tools alone will not be enough to provide a reasonable amount of security.
emerge wireless-tools
In /etc/conf.d/net write the settings for wireless-tools.
essid_eth1="any" mode_eth1="auto"
Adding these will allow the network script to connect to the strongest wireless network automatically.
Make sure that:
nano /etc/conf.d/rc RC_NET_SCRIPT_CHECKING="no"
NTP
Network Time Protocol(NTP) keeps the computer in sync with an internet time server. Several clients are available including ntp, openntp and rdate but most people use the standard ntp.
A Note Before Using NTP
Using NTP programs "net-misc/ntp" or "net-misc/openntpd" creates a file that marks discrepancies and a calculated drift value of hardware and software clocks. An incorrectly set clock can be caused by misconfigurations or such items as a dead battery or a Linux system incorrectly set to use UTC or local time (Most operating systems use UTC though Mac OS 9 and a few rare other systems use local time). Failure to set time and clock values correctly can have an NTP program set an exaggerated clock drift that will incorrectly set the software clock. This will cause modifications times of files and directories to become incorrect and can occasionally lead some programs not functioning correctly.
- Discussed in Forums: time setting issue.
To be safe, remove the time drift file /etc/adjtime now. Make sure the date is still correct, and set the clock to UTC or localtime.
rm /etc/adjtime date hwclock --localtime
- /etc/adjtime will be re-spawned and is safe to delete.
Standard NTP users
emerge ntp rc-update add ntp-client default
NTP uses pool of servers to find the correct time, so no more needs to be done.
Some users like to add their servers. Find the time servers and add them to the preferences file:
nano /etc/conf.d/ntp-client NTPCLIENT_OPTS="-b -u firstserver secondserver thirdserver"
System Details
Root user has been used until this point but this is very dangerous to use continually. First add a password for root (administrator):
passwd
Then create a regular user. For privledges to certain programs and actions groups are used. These are the basic groups for a good number of instances.
useradd -m -G adm,audio,cdrom,cdrw,cron,portage,users,usb,video,wheel -s /bin/bash USER passwd USER
The sudo command adds the ability for a normal user act as root without the risk of root login.
emerge app-admin/sudo visudo
A regular user part of the wheel group allows the possibility to run root commands as a regular user. To have the full functionality of root uncomment:
Defaults:%wheel !env_reset %wheel ALL=(ALL) ALL
Increase default 5 minute timeout of sudo to a more reasonable 16 or 122 (using sudo is only a security locally - i.e. if another user gets has physical access to the computer):
Defaults:ALL timestamp_timeout=122
To be able to locate files quickly, emerge slocate and create a database.
emerge slocate updatedb
updatedb runs once a day which is tasking for a slow pc, to change that behavior move slocate from the daily folder to the weekly.
mv /etc/cron.daily/slocate /etc/cron.weekly
BootLoader Setup
Yaboot is the bootloader for New World PPC computers (which is any Macintosh from the iMac on). Yaboot will allow the user to choose their OS at boot.
emerge yaboot
Now exit the chroot and return to the LiveCD shell:
exit && exit
Run this command to have yaboot try and automatically setup a /etc/yaboot.conf file.
yabootconfig --chroot /mnt/gentoo
If yabootconfig cannot find a kernel, it will need to be typed in manually:
/mnt/gentoo/boot/vmlinux-<version>
Make sure the virtual file systems are still mounted and change root once more:
mount -t proc none /mnt/gentoo/proc mount -o bind /dev /mnt/gentoo/dev mount -o bind /sys /mnt/gentoo/sys chroot /mnt/gentoo /bin/bash env-update && source /etc/profile
Have yaboot installed to the bootstrap partition:
ybin -v
If this doesn't work, it may be necessary to enter a Universally Unique Identifier (UUID) of the partition in the yaboot.conf.
Discover the UUID:
ls /dev/disk/by-uuid -alh
and add it to yaboot.conf
ofboot=/pci@f2000000/mac-io@17/ata-4@1f000/disk@0:8
Restarting
Exit the rooted enviroment and umount the partitions first.
exit && exit cd / umount /mnt/gentoo/proc umount /mnt/gentoo/dev umount /mnt/gentoo/sys umount /mnt/gentoo swapoff /dev/hda10 reboot
The New System
With everything setup properly Linux will boot now. Since a user beside root is created now, log in as that user. From now on all commands will needed to be run prefixed with sudo.
ALSA - Adding Sound
emerge alsa-utils alsa-oss
Also emerge "alsa-driver" here if alsa isn't built into the kernel. To configure alsa run:
alsaconf
Setup the correct soundcar and then start alsa:
/etc/init.d/alsasound start
To change the sound level use alsamixer.
Save the sound level and add it to boot:
/etc/init.d/alsasound save rc-update add alsasound boot
To test alsa:
emerge media-sound/mpg321 mpg321 song1.mp3
Power Management
If you choose to install Gnome there is gnome-power-manager, but gnome-power-manager functionality for PPC is spotty at best. The best alternative is to use pbbuttonsd. Pbbuttonsd includes support for suspend, trackpad adjustments, and key mappings of function keys, sleep and brightness. A pbbuttonsd.cnf is included in the configuration files. Alternatively, these can be done manually.
pbbuttonsd
emerge pbbuttonsd powerprefs /etc/init.d/pbbuttonsd start rc-update add pbbuttonsd boot
Edit /etc/pbbuttonsd.cnf to taste or emerge powerprefs for a graphical configuration tool and type:
sudo powerprefs
to open it.
pbbcmd config TAG_TPMODE notap pbbcmd saveconfig
Manual Sleep
The iBook uses a legacy sleep and suspend system call APM (Advanced Power Management). It's possible that the APM software in the kernel is depracated, not completely working, or just never configured for the iBook. Thankfully HAL has a script that can set the PMU switch.
To manually put the machine to sleep put in a bash script to set the pmu switch:
#!/bin/bash sudo /usr/libexec/hal-system-power-pmu sleep
Keyboard and Trackpad
A few manual tweaks to control keyboard and trackpad behavior.
Function key behavior
Function key remapping is possible by several kernel options. Make sure CONFIG_MAC_EMUMOUSEBTN is enabled in your kernel config first.
Function key always off
Functions keys [FN1-F6] by default (like in Mac OS) are always on. This can be counter-intuitive in Linux.
echo -n 0x02 > /sys/module/hid/parameters/pb_fnmode
Function keys as mouse clicks
Mouse buttons 2 and 3 (middle click and right click) can be mapped the the Function keys. Use showkeys in console and to get the corresponding key code. I, for instance, use F9 and F10:
echo 1 > /proc/sys/dev/mac_hid/mouse_button_emulation echo 67 > /proc/sys/dev/mac_hid/mouse_button2_keycode #for F9 echo 68 > /proc/sys/dev/mac_hid/mouse_button3_keycode #for F10
Apple Key as Control
The X server has a list of known keyboard mappings in /usr/share/X11/xkb/rules/xorg.lst. Then to map the Control key to Apple put this in /etc/X11/xorg.conf in the Input Device Keyboard section.
Option "XkbOptions" "altwin:ctrl_win"
Power Button as Suspend
With manual configuration the power button is unmapped. Since suspend is just about as good as shutting down in preserving hardware, the power button can be mapped to suspend.
vim ~/.xbindkeysrc # xbindkeysrc # power button to suspend "sudo /usr/libexec/hal-system-power-pmu sleep" m:0x0 + c:222
Allow regular user privledges to suspend:
sudo visudo %users ALL=/usr/libexec/hal-system-power-pmu
Trackpad tapping
Trackpad tapping can get in the way of typing, "powerpc-utils" is necessary to disable it.
emerge powerpc-utils trackpad notap
A simple bash script can constantly monitor whether notapping is enabled and re-enable it (notapping gets disabled during sleep). Also an init script can be used to start it at boot. Place this bash script in /usr/bin code>.
#!/bin/bash
while true
do
echo 'Testing if trackpad tapping is on.'
if trackpad show | grep "settings tap" >/dev/null
then
echo "Trackpad tapping on, turning off"
trackpad notap; else
echo "Trackpad notap funtioning. 15 second till next test."
sleep 15
fi
doneCreate init script in /etc/init.d/ code> called touchpad-notap with this information:
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need
use
}
start() {
ebegin "Starting Touchpad Daemon"
nohup /usr/bin/touchpad-notap-daemon &> /dev/null &
}
stop() {
ebegin "Stopping Touchpad Daemon"
killall touchpad-notap-daemon
}sudo rc-update add touchpad-notap default
Building the X Server
The original iBook has four MB of video memory, with video cards with less than eight MB of memory 3D acceleration may be disabled by driver.
To begin the desktop top build xorg-x11 is needed. This is another time-consuming step that can take up to five hours.
emerge xorg-x11
env-update && source /etc/profile
The X server will need it's preference file (/etc/X11/xorg.conf) configured. There are several programs in Portage that can do this try the one included with the X server first:
Xorg -configure
Now the environment variables for the locale can be added, this matches the locale.gen file configured earlier:
nano /etc/env.d/02locale LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8"
To test the locale:
locale
Samba
Samba is common file sharing protocol for Windows, Mac and Linux.
emerge samba env-update && source /etc/profile
The configuration file will need to be set up:
nano /etc/samba/smb.conf
Alternatively, when Gnome is set up go to System > Administration > Shared Folders and set it up a samba folder.
Start it at boot:
rc-update add samba default
Disk Space
Disk space is a challeging for an older PC for a basic install a three GB partition can be gotten away with, but five is more comfortable. Before installing Gnome make sure there is enough space:
df -h
If not, the unpacked sources can be removed:
rm -r /var/tmp/portage/*
Also the package tarballs can be removed:
cd /usr/portage/distfiles rm *
Gnome Basic Desktop Install
Gnome is the most common desktop but there are other alternatives like KDE or the lighter XFCE. A very light Gnome 2.22 runs fine on this iBook.
This last step is the longest build of the entire process - +100 packages that took over 24 hours to compile. If wanting a light desktop start with "gnome-light", more can always be added later. For a full gnome install use emerge gnome. Both "gnome-base/gnome" and "gnome-base/gnome-light" are meta packages - containers of gnome packages and not actually programs themselves. Any programs they contain will be re-emerged next time they are.
emerge gnome-light
When it's finished, update the environment.
env-update && source /etc/profile
Now its ready to test, start the run-time levels first:
/etc/init.d/hald start rc-update add hald default /etc/init.d/avahi-dnsconfd start rc-update add avahi-dnsconfd default
Select "Gnome" in /etc/rc.conf to set GNOME as the global desktop. Or use
echo "exec gnome-session" > ~/.xinitrc
to set gnome locally (per user).
Test it now:
startx
If everything goes well, the computer will start up Gnome the desktop will be loaded.
Now to install a graphical login. This step isn't necessary, many users still use startx to begin the Xserver.
Setup A Login Manager
Gnome Display Manager (GDM) is standard for Gnome installs but I think Slim Soars.
Setting up Slim
GDM
GDM is the login screen, but there are other options too. I like SLiM but it isn't as tightly integrated in the the desktop.
Change default display manager and add the runtime level:
nano /etc/conf.d/xdm DISPLAYMANAGER="gdm" rc-update add xdm default
To configure,
gksu gdmsetup
.Xauthority code> (it will be replaced with a new one), as this can sometimes be buggy following a GDM install.Gnome Add-ons
Finishing gnome-light is sorta-like being put in the middle of a desert - there just isnt' much there. There are a few more basic utilities that most people would use but a few details first.
Gnome Volume Manager
Gnome Volume Manager adds ability to recognize and mount disks, cameras, usb drives on insert.
emerge gnome-volume-manager rc-update add dbus default
Add user to plugdev group and update enviroment
gpasswd -a USER plugdev env-update && source /etc/profile
Gnome Basic Utilities
emerge --noreplace gamin gnome-system-tools gnome-system-monitor file-roller evince Archive-Tar gnome-spell gnome-utils Archive-Tar gnome-applets gcalctool
Printing Support
For printing support:
emerge gnome-cups-manager
Tuning the System
Now's a decent time to tune the system. Look through the control panels in the System > Preferences menu.
Add more fonts if needed, because there aren't many and they look better then those already installed. On some systems Microsofts corefonts look poor also there is the outdated adobe type fonts. Many applications try to emerge them but they aren't necessary. There is a way to trick portage and still leave them off on the system.
rm /usr/share/fonts/100dpi/* rm /usr/share/fonts/75dpi/* rm /usr/share/fonts/corefonts/*
Rebuild the font cache:
fc-cache -vf
emerge --noreplace freetype freefonts artwiz-fonts sharefonts ttf-bitstream-vera unifont dejavu ttf-gentium liberation-fonts-ttf
A Few Recommended Applications
These applications are lightweight and work good on slower PC's.
emerge sylpheed-claws abiword audacious audacious-plugins eog alacarte zim
Sylpheed is a mail program, Abiword is a basic word processor, audacious is a music player, Eye of Gnome is a basic picture viewer and alacarte will help edit the Gnome menu, zim is lighter than tomboy when there are large amounts of notes.
Gnome Network Manager
This really nice to have access to wireless(and wired) networks from the desktop.
Mail Notification Applet
echo "mail-client/mail-notification gmail" >> /etc/portage/package.use emerge mail-notification
A software guide to help:
Java
Don't put java in the USE flags unless planning to develop in java.
echo "dev-java/sun-jre-bin nsplugin" >> /etc/portage/package.use emerge sun-jre-bin eselect java-nsplugin list eselect java-nsplugin set javatype-version
(Not Recommended) Desktop Sound Effects
Enlightenment Sound Daemon can provide support for desktop sound effect but I found it buggy and it really slowed down the system.
"esd" will need to be build into the system, best to put in make.conf.
emerge esound rc-update add esound default /etc/init.d/esound start /etc/init.d/alsasound restart
Finishing the Desktop
Disable the Annoying Firefox Warning
- Tired of seeing Firefox is Missing Plugins... It's easy to disable. First, type "about:config" in address bar, and then in the filter line type "plugin". Find "plugin:default_plugin_disabled" and double click on it.
Add user to game group
- To play games, some of them require being part of the game group.
gpasswd -a user games
Library Dependency
- Now that everything is setup, it's a good thought to make sure the programs meet all the dependencies.
emerge gentoolkit revdep-rebuild
Odds and Bits
A couple tips and troubleshootings.
Dead Battery
I ran into a couple issues because of a dead battery
Clock Skew
This will most likely be seen if the computer battery is dead. If the computer has been unplugged and the time and date isn't set by the Open Firmware, Linux will have issues. NTP will set the system clock but the hardware clock will still be set to it's reset value. NTP then creates a file that tells the system of the clock skew. In case this accidentally occurs it helps to remove the clock skew file and match the hardware and software clock.
In local.start:
rm /etc/adjtime hwclock --localtime hwclock --systohc
local.start gets loaded after ntp is run, a few timestamps will be off but should be fixed on next start.
Date isn't Rolled Over After Sleep
When the iBook is sleeping the date refuses to change if left overnight. This is likely a bug in the sleep process as the time doesn't have issues. To fix this use NTP to set the time and date at regular intervals - cron is good for this. This script will check the time and set the hardware clock. I put it in cron.hourly.
#!/bin/bash ntpdate 0.pool.ntp.org hwclock --systohc
Checking Filesystem on Boot
fsck would refuse to check filesystem on start stating:
(check deferred; on battery)
To fix create /etc/e2fsck.conf and add a defer check option.
[options] defer_check_on_battery = false
4MB Video-Cards
4MB is a low amount of memory for displaying material on the screen. Any value over 16 bit depth in the /etc/xorg.conf will cause excessive paging and long draw times.
The Apple Key as Control Key
The Apple Key can be used as control. The easiest and most reliable way is to define the Apple key with the Xserver starts(see xorg.conf).
Alternately xmodmap can be used in conjunction with xkbset can be used (xkbset can stop key set experation timeouts.)
emerge xkbset (may be in bugzilla)
vim ~/.scripts/keymap-ctrl2apple
xmodmap -e 'remove control = Control_L' xmodmap -e 'keycode 115 = Control_L' xmodmap -e 'add control = Control_L' xkbset exp
Settings Lost Waking From Sleep
Note: not a problem with pbuttonsd.
Touchpad settings are lost waking from sleep so I created a small daemon that will reset them. First I made a script to detect and reinitialize the settings, then I made a daemon that runs the script persistently.
vim /usr/bin/reset-sleep.sh
#!/bin/bash
while true
do
echo 'Testing if trackpad tapping is on.'
if trackpad show | grep "settings tap" >/dev/null; then
echo "Trackpad tapping on, turning off"
trackpad notap
echo "Trackpad notap funtioning. 15 second till next test."
sleep 15
fi
donevim /etc/init.d/reset-sleep-daemon
#!/sbin/runscript
# Distributed under the terms of the GNU General Public License v2
# Daemon to reset settings lost on sleep.
depend() {
need
use
}
start() {
ebegin "Starting Suspend Daemon"
nohup /usr/bin/reset-sleep.sh &> /dev/null &
}
stop() {
ebegin "Stopping Suspend Daemon"
killall reset-sleep.sh
}Replace Nautilus with Thunar
Gnome uses Nautilus which is a heavyweight file manager for older systems. Consider using Xfce's Thunar instead.
Prelinking
Prelinking can provide a small speed boost on slower systems.
Security
Backup config_files
cd / tar cvpzf Backup-Gentoo_iBook_Configurations.tgz /etc/ /boot/ --exclude=/etc/gconf
FBSplash
I haven't tried this but I looked it up. ;) A frame butter splash screen will display a graphical startup, here are some PowerPC details:
The kernel is already configured but to add a splash (i.e.) image to the boot proccess.
emerge -va splashutils splash-themes-gentoo splash-themes-livecd
rm /etc/splash/default
view theme:
splash_manager --theme=livecd-2006.1 --cmd=set --tty=1
ctrl-alt-f1
cd /etc/splash/
splash_geninitramfs livecd-2006.1 -r 1024x768 -g /boot/fbsplash-livecd-2006.1-1024x768 -v
Resources
- Another Gentoo on iBook guide.
- Much thanks to other install guides particularly The Gentoo Developers Method with NPTL and 2.6 from Stage1
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.

