Differences between revisions 344 and 346 (spanning 2 versions)
Revision 344 as of 2009-10-04 07:24:26
Size: 87434
Editor: OsamuAoki
Comment:
Revision 346 as of 2009-10-04 10:30:54
Size: 88067
Editor: OsamuAoki
Comment:
Deletions are marked like this. Additions are marked like this.
Line 69: Line 69:

See also: [[InstallingDebianOn/Apple]]
Line 140: Line 143:
 Grub2 has also been fine, which was installed from Lenny beta 2. This is the PC version not EFI which doesn't exist for Debian yet. This is tested on amd64.
Installing
Grub2 has also been fine for Lenny. This is the grub-pc version which boot through {{{rEFIt}}} (not grub-efi). This is tested on amd64 and i386.
Line 250: Line 255:
=== If i386 Debian installed, change the kernel to amd64 (MacBook Core 2 Duo) === == GRUB as bootloader ==

Lenny install CD can install GRUB as bootloader. Its dialogue can be misleading if you wish to install bootloader to MBR. You must create proper MBR/GPT hybrid. It can be done by:
 * {{{gptsync}}} command on Linux
 * menu from {{{rEFIt}}} boot loader

If you wish to switch from lilo to GRUB, please read and understand some basics at: [[http://www.debian.org/doc/manuals/debian-reference/ch03.en.html#_stage_2_the_boot_loader]]. The choice of GRUB bootloader is the {{{grub-pc}}} package. Having bootable GRUB CD is good idea.

Installing {{{os-prober}}} package eases GRUB configuration. So please consider to do this before reboot via console.

= Cross-mount file systems =
To make a double boot system really useful it is desirable to cross-mount file systems, i.e. to make Mac OS X-filesystems readable (and writable) under Linux and vice versa. Mac OS X uses a file system called HFS+ while Linux uses ext3.

Even though cross-mounting is possible in either direction, there seems to be some scepticism (and possibly bad experience?) concerning the reliability, so that the common advice seems to be to only use small partitions mounted under both operating systems and use them for data exchange. Mounting and using large partitions for regular usage under both operating systems seems to be not advisable. (Please let us know if you have experience with that.)

== Mount Mac OS X filesystems (HFS+) under Linux ==
If you want to mount a Mac OS X-filesystem under Linux in read-write mode (not read-only) then you have to turn off journaling first under Mac OS X. If you leave journaling on, you can only mount in read-only mode and will not be able to write or modify files in the Mac OS X-filesystem. This is a trade-off, of course, because journaling gives you security that your Mac system lacks if you turn it off. It might thus be advisable to have one partition for the Mac operating system with journaling (which is the default) mounted from Linux read-only (if at all) and one partition with user data without journaling mounted from Linux read-write. See [[http://gentoo-wiki.com/HOWTO_hfsplus|HOWTO hfsplus]] for more information about HFS+ under Linux.

'''Step 1 (if mounting read-write) - turn off journaling under Mac OS X:''' If you want to mount the Mac OS X-filesystem in read-write mode (not read-only) then you have to turn off journaling.

(i) Boot into Mac OS X.

(ii) Start a terminal.

(iii) As root (e.g. with {{{sudo}}}) use {{{diskutil}}} to turn off journaling ([[http://docs.info.apple.com/article.html?artnum=107248|Disabling journaling via diskutil]]):

{{{
mac:user> sudo /usr/sbin/diskutil disableJournal /data
}}}
This assumes your partition is mounted to the directory {{{/data}}}. If you want to turn off journaling for your Mac operating system partition, use {{{/}}} instead.

(iv) Reboot into Linux.

'''Step 2 - mount the Mac OS X-filesystem under Linux:''' If {{{/dev/sda2}}} contains the HFS+-filesystem of the Mac OS X you want to mount, then run under Linux the following as root [[http://www.intuitive.com/blog/ubuntu_linux_yellowdog_linux_and_mac_os_x_all_on_one_powerbook.html|Dave Taylor, 2005-05-14]].

{{{
root# mkdir /media/macdata
root# mount -t hfsplus /dev/sda2 /media/macdata
}}}
This mounts {{{/dev/sda2}}} on the directory {{{/media/macdata}}} (only read-only if the HFS+ partition is using journaling, which is the default when Mac OS X creates a HFS+ partition). Of course, you can also create and mount on a different directory.

 . '''Verify:''' To check whether your mount was successfull, as root go into the directory {{{/media/macdata}}} and list the files, create a file, and remove it again. To check whether users have access, as root create a directory for that user in {{{/media/macdata}}}, change ownership to that user, change into that directory, su to that user and perform the same test actions as before (list, create and delete a file).
'''Step 3 (optional) - edit {{{fstab}}} to auto-mount at boot time:''' If you want to mount the partition automatically at boot time, you have to add an entry like the following in the file {{{/etc/fstab}}}.

{{{
/dev/sda2 /media/macdata hfsplus defaults 0 2
}}}
 . '''Verify:''' To check whether automount should work, unmount the partition (if it is still mounted from Step 2), and remount it with the {{{-a}}} option.
 {{{
root# umount /media/macdata
root# mount -a
}}}
 Then perform the same checks as in Step 2.
'''TROUBLESHOOTING (cannot write on HFS+ filesystem anymore):''' If you cannot write on the HFS+ filesystem anymore, boot into Mac OS X and perform a filesystem check, maybe that helps [[http://www.tgunkel.de/it/hardware/doc/ibook_g4_linux.en|Linux on an Apple iBook G4]].

== Mount Linux filesystems (ext3) under Mac OS X ==
To mount Linux filesystems (ext3) under Mac OS X the only open source option seems to be to use ext2fsx [[http://sourceforge.net/projects/ext2fsx/|Mac OS X Ext2 Filesystem at SourceForge]]. You have to use the newest version (1.4d4 as of 2007-09-02), which is not stable yet. Version 1.3 does not work for recent Mac OS X versions.

= Hardware configuration =
== Devices that work ==

The following features work for lenny (kernel 2.6.26):

 * Ethernet (as of kernel 2.6.16) (works out-of-the-box) (sky2)
 * Video (as of 2.6.26 wors out of the box)
 * Sound (as of kernel 2.6.18) (works out-of-the-box) (snd_hda_intel)
 * CD-R (works out-of-the-box)
 * backlight (works out-of-the-box)
 * bluetooth (works out-of-the-box)
 * Suspend (works out of the box in 2.6.26)
 * Video (works out of the box in 2.6.26)
 * Wireless (works out of box in 2.6.30)
 * USB usual EHCI, UHCI stuff

(See below for more)

== Backlight + Volume + CD Eject button ==

Backlight keys (Fn+F1 and Fn+F2) work using [[http://www.technologeek.org|Julien Blache's]] [[DebianPkg:pommed|pommed]] (there is a new project homepage at [[http://alioth.debian.org/projects/pommed/|alioth]]); you can even turn off the backlight using the keyboard; pommed also enables the CD Eject button's functionality, Fn behaviour and remote control. Besides, you can also install [[DebianPkg:gpomme|gpomme]]: a GTK+ client suitable for all environments (you should start it when your session starts) and [[DebianPkg:wmpomme|wmpomme]] (a WindowMaker dockapp)

By default on Debian testing, the F1, F2 ... FX keys are disabled and act like Fn+F1, Fn+F2 ... To enable the keys and make use of Fn+FX, modify /etc/pommed.conf by changing fnmode = 1 to fnmode = 2 and restart pommed with /etc/init.d/pommed restart.

Backlight also works using frankie's [[http://hackweb.altervista.org/forum/index.php?act=ST&f=2&t=7&st=0#entry8|backlight]], that can be controlled with [[http://ubuntuforums.org/showthread.php?t=215801|macbook-backlight-control]].

To enable the sound keys (Fn+F3, Fn+F4 and Fn+F5), you have to modify /etc/pommed.conf : change init = -1 to init = 80 and (at least on Macbook 2) change volume = "PCM" to volume = "Front" and after that restart pommed with /etc/init.d/pommed restart. (Are you sure? I've set it to PCM. If so please explain why)

== Video ==

Video now works automatically withour manually installing {{{915resolution}}}.

=== Configure highres video playback ===

For highres video playback something like the following is needed in the Device section:

{{{
        Option "LinearAlloc" "6144"
        Option "CacheLines" "1080"
}}}

=== External monitor ===

Note when using an external display: unless the display resolution is in the small builtin supported list (it won't be if it's widescreen or highres) then you may need to use 915resolution to set a mode for the external display.

Note when using multiple displays: the order for MonitorLayout is "pipe a, pipe b" but this corresponds to "screen 1, screen 0", not "screen 0, screen 1" as you might expect (and isn't documented in the man page...)

You need a [[http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore?productLearnMore=M9320G/A|mini-DVI/VGA adaptor]].

=== Configure dual screen ===

Dual screen configuration for etch does not work for xorg 7.2 and later on lenny. Just use the usual single-screen xorg.conf, and configure output later.

You can control X with xrandr.

LVDS is the liquid display, VGA is the external output. (see output of xrandr command)

To enable dual screen

{{{
xrandr --output VGA --mode 1024x768
xrandr --output VGA --right-of LVDS
}}}
or in one big command including handling of disabling unneeded output:

{{{
xrandr --output TMDS-1 --off --output LVDS --mode 1280x800 --crtc 1 --output VGA --mode 800x600 --right-of LVDS --crtc 0
}}}
You also need to set 'Virtual' the get the most out of you hardare, this is the overall space you have to work with in your screens. The intel driver supports a max of 2048x2048 before turning off DRI. I dont thik you can chnage this while X is running so xrandr won't be able to make use the extra space until x is restarted. If you have a wide screen already, I suggest setting up the macbook below the screen as you can then fit a 1920x1200 monitor.

{{{
Section "Screen"
        Identifier "Default Screen"
        SubSection "Display"
                Virtual 2048 2048
        EndSubSection
EndSection
}}}
To disable dual screen, simply specify VGA to off

{{{
xrandr --output VGA --off
}}}

== Sound ==

{i} This is written under linux-image-2.6.26-1-amd64 @ version=2.6.26-2 as of 2008-080-17 for lenny.

It works out of box with ALSA after disabling '''mute'''.

In case you have trouble, reconfigure sound system with "{{{dpkg-reconfigure linux-sound-base}}}" to use ALSA. Then udev system picks snd_hda_intel and required modules with proper parameters at boot time.

## Does model=mbp3 needed now?
## Richard Shore: I still needed it. That's with Lenny-Stable (both i386 & amd64) on a late 2007 Macbook.
## Does alsaconf helps setup?
Please note '''Surround''' output is connected to '''speaker''' via '''headphone''' plug. Neither ''Center'' nor ''Front'' are connected. You need to customize mixer default to unmute '''Surround''' to hear sound and optionally maximize its volume for ease of use. (You can do this via alsamixer or gnome volume control. For gnome volume control, you need to customize it to get menu for surround enabled.)

=== For MacBook Aluminum (late 2008) ===
 * Open Terminal.
 * Run alsamixer (as root).
 * Set all up Master, PCM, Line-Out and switch from 2ch to 6ch.
 * Run '''alsactl store''' and enjoy.

== Wireless ==
 ''See [[MacBook/Wireless]]''

Different MacBooks use different WiFi cards – in some more recent kernels, WiFi will work out-of-the-box; in other cases, it requires more hacking.

== Keyboard ==
After the standard installation of Debian Linux, what you type on the keyboard might not be what you see on the screen, and some characters, such as curly brackets, might not be available at all. This is due to an incorrect keyboard mapping. In particular you might want to add/change/configure the following:

'''Swapped keys:''' Even if you have chosen the correct general keyboard layout, e.g. German for a German keyboard, there may still be keys swapped, e.g. you press the '<' key and get a '^' and vice versa. This can be corrected with a global option.

'''Alt-Gr:''' Alt-Gr stands for 'alternate graphic' and is a modifier key, much like Shift or Ctrl, used to type special characters, typically the 'third symbol' on the lower right of a key. The Mac keyboard does not have such a key, so we want to configure the right Apple key as an Alt-Gr key.

'''Function keys:''' You may also want to configure the function keys.

The keyboard mappings are configured separately for the X11 (X Window) system and for the consoles.

=== X11 (X Window) ===
The recommended place to configure the keyboard mapping for X11 is the configuration file {{{/etc/X11/xorg.conf}}}, which has the advantage of effecting all users. Each user can also configure his/her keyboard individually in the (Gnome) Desktop Preferences.

'''{{{/etc/X11/xorg.conf}}}:'''

To set options for the keyboard you can use the {{{XkbOptions}}} field in the keyboard section of file {{{/etc/X11/xorg.conf}}}. To activate the right Apple key as an Alt-Gr key add {{{"lv3:rwin_switch"}}}. To correct the swapped keys add {{{"apple:badmap"}}}. To do both combine them with a separating comma, as shown below.

{{{
Section "InputDevice"
        Identifier "Generic Keyboard"
        Driver "kbd"
        Option "CoreKeyboard"
        Option "XkbRules" "xorg"
        Option "XkbModel" "pc105"
        Option "XkbLayout" "it"
        Option "XkbOptions" "lv3:rwin_switch,apple:badmap"
EndSection
}}}
To activate the changes restart X11 by pressing Ctrl-Alt-Backspace, but close all sensitive applications first.

'''Desktop Preferences:'''

It is probably best to change the keyboard mappings discussed here centrally in {{{/etc/X11/xorg.conf}}}. However, it is also possible to change them in the Desktop Preferences. For Gnome click 'Desktop' -> 'Preferences' -> 'Keyboard'.

For the basic keyboard definition go to 'Layouts'. As 'keyboard model' choose 'MacBook/MacBook Pro (Intl)' (although 'Generic 105-key (Intl) PC' seems to work fine as well). As 'selected layout' add and make default 'Germany' -> 'Macintosh' or 'Macintosh, eliminate dead keys' (although 'Germany Eliminate dead keys' seems to work fine as well).

For the configurations under discussion here go to 'Layout Options'. To configure the right Apple key as an Alt-Gr key select 'Third level choosers' -> 'Press Right Win-key to choose 3rd level.'. To correct the swapped keys select 'Miscellaneous compatibility options' -> 'Swap keycodes of two keys when Mac keyboards are misdetected by kernel.'.

When I did this I actually got obscure error messages. So this seems to be buggy and I would not recommend it also for this reason.

=== Consoles ===
To configure the right Apple key as an Alt-Gr key for the consoles (the black and white screen you get with Ctrl-Alt-F1 etc.) add the following line to {{{/etc/console-tools/remap}}}.

{{{
s/keycode 126 =/keycode 126 = AltGr/;
}}}
Correcting swapped keys should also be possible, but I have not figured out how to do that yet.

To set up the correct keyboard mappings in the console do:

{{{
dpkg-reconfigure -p low console-data}}}
and select "Select keymap from the full list" and then select "pc / qwerty / British / Apple USB / Standard" (or whatever country you prefer).

=== Fn-key behaviour ===

If you want to change the bahaviour of the Fn-keys look at /etc/pommed.conf after you've installed pommed on lenny. (Or look at the parameters of the hid kernel module.)

Has anyone made the ''fn'' key work? --> Yes, on MacBook2,1(osamu) with current stable (lenny, 2.6.26). The use of [[DebianPkg:pommed|pommed]] program as written above makes it work better.

=== Other issues ===
Screenshots:

 * [[http://www.webalice.it/zinosat/macbook/macbook_kb.jpg|Italian keyboard]]
 * [[http://flickr.com/photos/brianwc/151797592/|U.S keyboard]]

Alternatively you can work around this with xmodmap and xkbset for missing keys and mouse clicks. xkbset is useful for emulating mouse buttons with the keyboard.

{{{
xmodmap -e "keycode 115 = Alt_L" # left-apple
xmodmap -e "keycode 116 = Zenkaku_Hankaku" # right-apple
xmodmap -e "keycode 108 = Pointer_Button3 Pointer_Button2" # KP-ENTER
xkbset m
}}}
DebianBug:379789 has been filed to track down a problem with keymap

<!> See below "Mouse 2nd and 3rd buttons" for mouse click emulation and fixing unresponseve Keypad equal in num lock mode.

To work around issues of missing/unresponsive keys on the MacBook Japanese models with older Linux kernel, see MacBookJp for helpful scripts (Japanese page but scripts are in English). This problem has been fixed in Debian kernel 2.6.24-1-amd64 for sid (as of Feb 4, 2008). If the patch is present the kernel outputs a message: "Fixing up MacBook JIS keyboard report descriptor".

== Synaptics Touchpad ==

=== Basic configuration ===

<!> Addition of "{{{Section "ServerLayout"}}}" to {{{/etc/X11/xorg.conf}}} is important to get "{{{SHMConfig}}}" enabled properly by enabling '''Synaptics Touchpad'''.

The following basic {{{/etc/X11/xorg.conf}}} will enable your touchpad in sane mode under normal lenny. I mean no more accidental clicks by touching it but you can move pointer and scroll browser vertically.

{{{
# xorg.conf (X.Org X Window System server configuration file)

Section "ServerLayout"
    Identifier "Simple Layout"
    InputDevice "Generic Keyboard" "CoreKeyboard"
    InputDevice "Synaptics Touchpad" "CorePointer"
    InputDevice "Configured Mouse" "SendCoreEvents"
    Screen "Default Screen" 0 0
EndSection

Section "InputDevice"
 Identifier "Generic Keyboard"
 Driver "kbd"
 Option "XkbRules" "xorg"
 Option "XkbModel" "jp106"
 Option "XkbLayout" "jp"
EndSection

Section "InputDevice"
 Identifier "Synaptics Touchpad"
 Driver "synaptics"
 Option "SendCoreEvents" "true"
 Option "Device" "/dev/input/mice"
 Option "SHMConfig" "true"
 Option "MaxTapTime" "0"
 Option "HorizScrollDelta" "0"
 Option "VertScrollDelta" "30"
        Option "TapButton1" "0"
        Option "TapButton2" "0"
        Option "TapButton3" "0"
EndSection

# In case you have USB mouse
Section "InputDevice"
 Identifier "Configured Mouse"
 Driver "mouse"
EndSection


Section "Device"
 Identifier "Configured Video Device"
EndSection

Section "Monitor"
 Identifier "Configured Monitor"
EndSection

Section "Screen"
 Identifier "Default Screen"
 Monitor "Configured Monitor"
EndSection
}}}

<!> Section "InputDevice" with "Generic Keyboard" should be adjusted to your original localized configuration of xorg.conf generated by "{{{sudo dpkg-reconfigure -phigh xserver-xorg}}}". This example is for Japanese system.

You can configure your touch pad by installing "{{{gsynaptics}}}" package or similar. Under GNOME, you can access it from "System" -> "Preferences" -> "Touchpad".

As for missing mouse butons, see "Mouse 2nd and 3rd buttons". (I found relying on taps can get quite annoying. See below if you wish.)

=== Mouse 2nd and 3rd buttons ===

==== X level emulation ====

Left Apple key (keycode = 115, sometimes called left command key) may be used as replacements for mouse 2nd and 3rd buttons.
 * "Right click" by "Apple-key"
 * "Midle click" by "Shift-Apple-key"

This can be done by including following code in the {{{~/.xsessionrc}}} start up script of your home directory:
{{{
/usr/local/bin/mousekeys &
}}}

and create startup script {{{/usr/local/bin/mousekeys}}}
{{{
# wait for some program, here gnome-pane
until ps -C gnome-panel >/dev/null; do sleep 1 ; done
# set xmodmap, DEL is Fn-Delete, BS is Delete
xmodmap - << EOF >/dev/null 2>/dev/null
keycode 115 = Pointer_Button3 Pointer_Button2
keycode 157 = KP_Equal
keycode 19 = 0 parenright 0 Scroll_Lock
keycode 215 = Print Sys_Req
keycode 216 = Insert
keycode 217 = Pause Break
EOF
}}}

This binds these keys to mouse keys and some missing keys. (You may execute these from X terminal emulators too.)

<!> Redifinition of "keycode 19" for normal "0" key is for Japanese keyboard. Please adjust these key redifinitions as you like.

For GNOME, enable mouse keys by keyboard from "System" -> "Preferences" -> "Keyboard" -> "Mouse Keys" -> "Allow to control the pointer using keyboard" : "check to enable".

Alternatively, you may use "{{{xkbset m}}}" command by installing the {{{xkbset}}} pacakage.

Alternatively, you can use Fn-F8(keycode = 215), Fn-F9(keycode = 216), and Fn-F10(keycode = 217) keys on system without keyboad light with:
{{{
xmodmap - << EOF
keycode 215 = Pointer_Button1
keycode 216 = Pointer_Button2
keycode 217 = Pointer_Button3
EOF
}}}

If you would like to use other keys, here's how to do it:

 * Start gnome-terminal
 * Run xev, it will display the X11 events it picks up
 * Locate the keycode of the key you want to use:
  * Press the key you want locate and locate the KeyPress event in gnome-terminal
  * Write down the {{{keycode}}} of the keyevent
 * Run {{{xmodmap -e "keycode 115 = Pointer_Button3 Pointer_Button2"}}} to update your keyboard map (for this login session only for test.)

Instead of using generic X startup code via {{{~/.xsessionrc}}}, you may set it up via GNOME specific startup method: "System" -> "Preferences" -> "Sessions" -> "Startup programs" -> "Add" -> ...

<!> It is not wise to use {{{~/.xsession}}} to add small X startup code since this requires you to create the full X startup code.

<!> "{{{sleep}}}" command in the startup script "{{{/usr/local/bin/mousekeys}}}" was needed to avoid running "{{{xmodmap}}}" command too early. Otherwise, I do not see "xmodmap -pke" reflecting changes. Somehow, mouse keys only were working and regular key redifinitions were not working.

==== Kernel level emulation ====

<!> This needs to be verified. (osamu, based on debian-jp ML)

Recent kernel comea with "DeviceDrivers - Macintosh device drivers - Support for mouse button 2+3 emulation" enabled: {{{CONFIG_MAC_EMUMOUSEBTN=y}}}

Following command can enable Kernel level mouse button 2+3 emulation:

{{{
sysctl -w dev.mac_hid.mouse_button_emulation = 1
sysctl -w dev.mac_hid.mouse_button2_keycode = 116
sysctl -w dev.mac_hid.mouse_button3_keycode = 108
}}}

Here, "keycode = 116" is "Super_R" (Right-Apple) and "keycode = 108" is "KP_Enter" on US keyboard.

=== Synaptics touchpad for the new 2008 unibody Macbook and Macbook Pro ===
The new unibody MacBook Pro requires a new touchpad driver to work. This is discussed over at Ubuntu (http://ubuntuforums.org/showthread.php?t=840040). The driver bcm5974.ko is available here http://bitmath.org/code/bcm5974-dkms/. The snag is that there is no deb and installation is via the DKMS system (http://linux.dell.com/dkms/). But I managed it, so you almost certainly can.

First install git.

aptitude install git-core

Then download the latest source for the bcm5974 driver and the usbhid module, which you also need.

git clone http://bitmath.org/git/bcm5974-dkms.git

git clone http://bitmath.org/git/usbhid-dkms.git

You'll need to download the dkms too. I used the ubuntu deb at http://linux.dell.com/dkms/

dpkg -i dkms_2.0.20.4-0ubuntu1_all.deb

Then build a deb of the bcm5974 driver.

cd bcm5974-dkms/

Follow the instructions in the HACKING file, but not until the end.

make bump

You'll need debhelper and dpkg-dev installed to make the deb.

dpkg-buildpackage

cd ..

This makes the deb. Make the deb for the usbhid module.

cd usbhid-dkms/

make bump

dpkg-buildpackage

cd ..

Now you should have two packages which you can install. dpkg uses dkms to make the modules.

dpkg -i bcm5974-dkms_1.1.1_all.deb usbhid-dkms_0.11.1_all.deb

modprobe bcm5974 should load the module. Now all you need is to edit xorg.conf.

xorg.conf:
{{{
Section "Module"
   Load "glx"
   Load "synaptics"
EndSection

Section "InputDevice"
   Identifier "Generic Keyboard"
   Driver "kbd"
   Option "CoreKeyboard"
   Option "XkbRules" "xorg"
   Option "XkbModel" "pc105"
   Option "XkbLayout" "gb"
   Option "XkbOptions" "lv3:rwin_switch,apple:badmap"
EndSection

Section "InputDevice"

   Identifier "Synaptics Touchpad" Driver "synaptics"
   Option "SendCoreEvents" "true"
   Option "Device" "/dev/input/mice"
   Option "Protocol" "auto-dev"
   Option "SHMConfig" "true"
   Option "New AccelFactor" "0.03"
   Option "LeftEdge" "0"
   Option "RightEdge" "1280"
   Option "RightEdge" "1280"
   Option "TopEdge" "0"
   Option "BottomEdge" "800"
   Option "MinSpeed" "0.94"
   Option "MaxSpeed" "1"
   Option "AccelFactor" "0.0015"
#tapping

   Option "RTCornerButton" "2"
   Option "RBCornerButton" "3"
   Option "LTCornerButton" "2"
   Option "LBCornerButton" "3"
   Option "FingerHigh" "30"
   Option "FingerLow" "20"
   Option "MaxTapTime" "150"
   Option "FastTaps" "0"
   Option "TapButton1" "1"
   Option "TapButton2" "2"
   Option "TapButton3" "3"
#edge scroll

   Option "VertEdgeScroll" "0"
   Option "HorizEdgeScroll" "0"
   Option "VertScrollDelta" "5"
   Option "HorizScrollDelta" "0"
#two finger scroll

   Option "VertTwoFingerScroll" "1"
   Option "HorizTwoFingerScroll" "1"
EndSection

Section "Device"
   Identifier "Configured Video Device"
   Driver "nvidia"
EndSection

Section "Monitor"
   Identifier "Configured Monitor"
EndSection

Section "Screen"
   Identifier "Default Screen"
   Monitor "Configured Monitor"
EndSection

Section "ServerLayout"
   Identifier "Main Layout"
   Screen "Default Screen"
   InputDevice "Synaptics Touchpad"
   InputDevice "Generic Keyboard"
EndSection

}}}

This set up gives you tapping 1, 2, or 3 fingers for left, middle, and right clicks and two-finger scrolling.

== Processor ==

=== CPU frequency scaling ===

==== CPU frequency scaling in kernel (basics) ====

CPU frequency scaling is governed by SPEEDSTEP_CENTRINO kernel module. You should also enable the ''acpi_cpufreq'' module and one of its methods ''cpufreq_ondemand'' or ''cpufreq_conservative''.

{{{
echo speedstep_centrino >> /etc/modules
echo acpi_cpufreq >> /etc/modules
echo cpufreq_ondemand >> /etc/modules
}}}

Here, I chose the ''cpufreq_ondemand'' for responsiveness.

==== CPU frequency scaling in kernel (customization) ====

<!> For lenny, these do not seem to be needed anymore.

To avoid unnecessary overhead you can let kernel scale the CPU frequency automatically. Just load module ''cpufreq_ondemand'' or ''cpufreq_conservative''. The ''ondemand''-module is perhaps better choice if you want the system to be as responsive as possible.

Next add this to ''/etc/rc.local'' or to another startup script:

{{{
# Switch on "ondemand" CPUfreq governor
# This is more reliable and faster than using userspace governor and
# a userspace program to control CPU frequency.
# You have to do this for each CPU.
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# The "ondemand" governor in kernels prior to 2.6.22 something tend to
# have a bit high sampling rate, so we will modify it according to
# http://www.linuxpowertop.org/known.php
# This is not _required_, but reduces the amount of wake-up calls the
# processor makes each second
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
cat /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate
}}}

==== CPU frequency scaling in userspace ====

In case you want more complex CPU frequency scaling schemes, you can just load the module ''cpufreq_userspace'', set it as default (see above) install [[DebianPkg:powernowd|powernowd]] or [[DebianPkg:cpufreqd|cpufreqd]] package for CPU frequency scaling. There are several other daemons available, but those two work quite well.

You can use gkfreq to monitor the CPU frequency in gkrellm (currently it only supports one processor but can be easily modified to support 2 cores - I have send a small patch to the maintainer) : http://www.peakunix.net/gkfreq/

=== CPU throttling ===
CPU throttling means forcing the processor(s) to idle for a certain amount of their time. When processor is not heavily loaded this saves battery but also slows the processor down. With 1st generation Macbook switching both cores to 50% throttling so that they are idle 50% of the time can give maybe 30-40 minutes of extra battery life. The Macbook is perfectly usable even both processors are running at 1Ghz (scaled down) and throttled to 50%. So in most cases, it's a good idea to use CPU throttling when using battery.

There are various ways to enable CPU throttling. It is probably easiest to use laptop-mode, and make sure that throttling is enabled in /etc/laptop-mode/laptop-mode.conf:

{{{
# Should laptop mode tools control the CPU throttling? This is only useful
# on processors that don't have frequency scaling.
# (Only works when you have /proc/acpi/processor/CPU*/throttling.)
CONTROL_CPU_THROTTLING=1
# Legal values are "maximum" for the maximum (slowest) throttling level,
# "minimum" for minimum (fastest) throttling level, "medium" for a value
# somewhere in the middle (this is usually 50% for P4s), or any value listed
# in /proc/acpi/processor/CPU*/throttling. Be careful when using "maximum":
# this may be _very_ slow (in fact, with P4s it slows down the processor
# by a factor 8).
BATT_CPU_THROTTLING=medium
LM_AC_CPU_THROTTLING=minimum
NOLM_AC_CPU_THROTTLING=minimum
}}}
=== Powertop ===
If you are serious about saving power, take a look at [[http://www.linuxpowertop.org/powertop.php|Powertop]] program. It is a very good interactive program that gives suggestions on how to minimize CPU wakeups. I was able to drop wakeups from around 1500 to roughly 400 with the aid of this program.

With up-to-date lenny/sid, it's possible to drop to around 100 wakeups (with wifi and compiz).

== Infrared Receiver ==

Infrared receiver on MacBook is an HID device. For lenny,
 * lirc lirc_0.8.3-3_amd64.deb
 * lirc-modules-source lirc-modules-source_0.8.3-3_all.deb

Install them and follow their instruction.

== iSight ==
On the Macbook (Pro) iSight might work with the linux-uvc driver. It is now part of linux-image-2.6.26, the default kernel for Lenny. In the initial black MacBook, it doesn't work.

Locate the firmware from MacOS X, and note the location, you will need this later:

{{{
# mount -t hfsplus /dev/sda2 /mnt/mac/
# ls /mnt/mac/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport
}}}
Now we install the needed packages:

{{{
# aptitude install module-assistant linux-uvc-source isight-firmware-tools
}}}
When installing isight-firmware-tools, debconf asks about the path to the firmware. Specify the location you have found above.

Once the source and tools are installed, you should have /lib/firmware/isight.fw . If not, something went wrong installing isight-firmware-tools.

To try to extract the firmware again (only do this if you don't have /lib/firmware/isight.fw ) :

{{{
# dpkg-reconfigure -plow isight-firmware-tools
}}}
Keep repeating this until you get the /lib/firmware/isight.fw .

{{{
# modprobe uvcvideo
# /etc/init.d/hal restart
}}}
Test it with Cheese.

{{{
# aptitude install cheese
$ cheese
}}}
If you see your face, iSight is probably working :).

 * References
  * http://linux-uvc.berlios.de
  * http://bersace03.free.fr/ift/
  * http://blogs.gnome.org/view/rbultje/2006/07/18/0
  * http://zaheer.merali.org/articles/2006/07/21/isight-linux-thank-you-ronald (with screencast!)
  * http://johannes.sipsolutions.net/MacBook/iSight
  * http://sourceforge.net/mailarchive/forum.php?forum_name=mactel-linux-users
  * http://i-nz.net/projects/linux-kernel/ (Bundle SVN (rev.100 + isight.patch) + Howto)

== Support of SMC ==

[[http://en.wikipedia.org/wiki/System_Management_Controller|SMC]] means System Management Controller.

The gentoo wiki suggests loading the "applesmc" module, which works fine for me (albertl7). Among other things, t allows me to control the medium fan speed, which I increase because my Macbook gets so hot. I put this is rc.local:

{{{
echo "4000" > /sys/devices/platform/applesmc.768/fan1_min
}}}
The gentoo wiki has a different path, so it might be different on all the various Macbook computers. The higher fan speed makes more noise, but I'm comfortable with that.

== Direct EFI Boot support ==

CONFIG_FB_IMAC support is for booting from ELILO (EFI). You are most probably using lilo/rEFIt to boot, using IMAC driver will make your screen appear scrambled. Use CONFIG_FB_I810 driver instead.

== CPU Core Temperature Sensor ==

[[http://en.wikipedia.org/wiki/Model-specific_register|Model-specific register (MSR)]] can be used access CPU temperature sensor. You can use many standard applets to display temperature on lenny.


= Resources =

== Primary resources ==

[[http://www.mactel-linux.org/|Mactel-Linux]] has mactel specific kernel patch and hardware tool resource. Its subversion archive can be seen at http://svn.sourceforge.net/viewvc/mactel-linux by the browser or retrieved by:

{{{
 $ svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux mactel-linux
}}}

Helpful guide on compiling a mactel kernel: http://gentoo-wiki.com/HARDWARE_Apple_MacBook

== Secondary resources ==

 * http://desrt.mcmaster.ca/macbook.xhtml
 * http://sharealike.org/index.php/2006/05/26/macbook-triple-boot-howto-with-debian-etch-and-xp-upgrade-version/
 * http://modular.math.washington.edu/macbook/
 * http://gentoo-wiki.com/HARDWARE_Apple_MacBook
 * http://ubuntuforums.org/showthread.php?t=198453
 * Server irc.oftc.net, channel #mactel-linux
 * http://www.netfort.gr.jp/~dancer/diary/junk2006/debianmeetingresume200607-presentation-english.pdf for English-version presentation
  . see http://tokyodebian.alioth.debian.org/2006-07.html for Japanese instructions
 * http://stuff.der-marv.de/macbook/
 * http://dentifrice.poivron.org/laptops/macbook/
 * https://help.ubuntu.com/community/MacBook
 * https://wiki.ubuntu.com/MacBookPro
 * http://www.debianhelp.co.uk/lilo.htm
 * http://www.tgunkel.de/it/hardware/doc/ibook_g4_linux.en
 * http://www.ppcnux.de/?q=node/6767
 * [[http://lists.debian.org/debian-devel/2006/07/msg00008.html|Original thread in debian-devel ML]]
 * http://www.michaelvkim.net/?p=5

= Smewhat outdated contents =

== Installation ==
=== How to change the kernel to amd64 if i386 Debian installed (MacBook Core 2 Duo) ===
Line 293: Line 999:
== GRUB as bootloader ==

Lenny install CD can install GRUB as bootloader. Its dialogue can be misleading if you wish to install bootloader to MBR. You must create proper MBR/GPT hybrid. It can be done by:
 * {{{gptsync}}} command on Linux
 * menu from {{{rEFIt}}} boot loader

If you wish to switch from lilo to GRUB, please read and understand some basics at: [[http://www.debian.org/doc/manuals/debian-reference/ch03.en.html#_stage_2_the_boot_loader]]. The choice of GRUB bootloader is the {{{grub-pc}}} package. Having bootable GRUB CD is good idea.

Installing {{{os-prober}}} package eases GRUB configuration. So please consider to do this before reboot via console.
== Gigabit Ethernet ==
Your kernel must have support for the ''Yukon Gigabit Ethernet'' driver known as '''sky2'''; this is available in Debian 4.0 Etch (or kernel 2.6.16 and above).

See DebianBug:378521

== Suspend and sky2 ==

 * suspend (works, unload module sky2 before suspending; tested with kernel 2.6.20) (no longer necessary in kernel 2.6.26)

s2ram -f -p -m works (for some values of "work") with original macbook (sys_product = "MacBook1,1" sys_version = "1.0" bios_version = "MB11.88Z.0061.B03.0610121324") kernel 2.6.21.3 and mactel patches rev 126. Resumes with backlight off but can turn back on with pommed (usually...), also external display resumes with DPMS disabled. Apparently Ubuntu got the backlight turned on when resuming, need to investigate how to solve this issue.
Line 380: Line 1087:
= Cross-mount file systems =
To make a double boot system really useful it is desirable to cross-mount file systems, i.e. to make Mac OS X-filesystems readable (and writable) under Linux and vice versa. Mac OS X uses a file system called HFS+ while Linux uses ext3.

Even though cross-mounting is possible in either direction, there seems to be some scepticism (and possibly bad experience?) concerning the reliability, so that the common advice seems to be to only use small partitions mounted under both operating systems and use them for data exchange. Mounting and using large partitions for regular usage under both operating systems seems to be not advisable. (Please let us know if you have experience with that.)

== Mount Mac OS X filesystems (HFS+) under Linux ==
If you want to mount a Mac OS X-filesystem under Linux in read-write mode (not read-only) then you have to turn off journaling first under Mac OS X. If you leave journaling on, you can only mount in read-only mode and will not be able to write or modify files in the Mac OS X-filesystem. This is a trade-off, of course, because journaling gives you security that your Mac system lacks if you turn it off. It might thus be advisable to have one partition for the Mac operating system with journaling (which is the default) mounted from Linux read-only (if at all) and one partition with user data without journaling mounted from Linux read-write. See [[http://gentoo-wiki.com/HOWTO_hfsplus|HOWTO hfsplus]] for more information about HFS+ under Linux.

'''Step 1 (if mounting read-write) - turn off journaling under Mac OS X:''' If you want to mount the Mac OS X-filesystem in read-write mode (not read-only) then you have to turn off journaling.

(i) Boot into Mac OS X.

(ii) Start a terminal.

(iii) As root (e.g. with {{{sudo}}}) use {{{diskutil}}} to turn off journaling ([[http://docs.info.apple.com/article.html?artnum=107248|Disabling journaling via diskutil]]):

{{{
mac:user> sudo /usr/sbin/diskutil disableJournal /data
}}}
This assumes your partition is mounted to the directory {{{/data}}}. If you want to turn off journaling for your Mac operating system partition, use {{{/}}} instead.

(iv) Reboot into Linux.

'''Step 2 - mount the Mac OS X-filesystem under Linux:''' If {{{/dev/sda2}}} contains the HFS+-filesystem of the Mac OS X you want to mount, then run under Linux the following as root [[http://www.intuitive.com/blog/ubuntu_linux_yellowdog_linux_and_mac_os_x_all_on_one_powerbook.html|Dave Taylor, 2005-05-14]].

{{{
root# mkdir /media/macdata
root# mount -t hfsplus /dev/sda2 /media/macdata
}}}
This mounts {{{/dev/sda2}}} on the directory {{{/media/macdata}}} (only read-only if the HFS+ partition is using journaling, which is the default when Mac OS X creates a HFS+ partition). Of course, you can also create and mount on a different directory.

 . '''Verify:''' To check whether your mount was successfull, as root go into the directory {{{/media/macdata}}} and list the files, create a file, and remove it again. To check whether users have access, as root create a directory for that user in {{{/media/macdata}}}, change ownership to that user, change into that directory, su to that user and perform the same test actions as before (list, create and delete a file).
'''Step 3 (optional) - edit {{{fstab}}} to auto-mount at boot time:''' If you want to mount the partition automatically at boot time, you have to add an entry like the following in the file {{{/etc/fstab}}}.

{{{
/dev/sda2 /media/macdata hfsplus defaults 0 2
}}}
 . '''Verify:''' To check whether automount should work, unmount the partition (if it is still mounted from Step 2), and remount it with the {{{-a}}} option.
 {{{
root# umount /media/macdata
root# mount -a
}}}
 Then perform the same checks as in Step 2.
'''TROUBLESHOOTING (cannot write on HFS+ filesystem anymore):''' If you cannot write on the HFS+ filesystem anymore, boot into Mac OS X and perform a filesystem check, maybe that helps [[http://www.tgunkel.de/it/hardware/doc/ibook_g4_linux.en|Linux on an Apple iBook G4]].

== Mount Linux filesystems (ext3) under Mac OS X ==
To mount Linux filesystems (ext3) under Mac OS X the only open source option seems to be to use ext2fsx [[http://sourceforge.net/projects/ext2fsx/|Mac OS X Ext2 Filesystem at SourceForge]]. You have to use the newest version (1.4d4 as of 2007-09-02), which is not stable yet. Version 1.3 does not work for recent Mac OS X versions.

= Hardware configuration =
== Devices that work ==
The following features work

 * Ethernet (as of kernel 2.6.16) (works out-of-the-box) (sky2)
 * Video (as of 2.6.26 wors out of the box)
 * Sound (as of kernel 2.6.18) (works out-of-the-box) (snd_hda_intel)
 * CD-R (works out-of-the-box)
 * backlight (works out-of-the-box)
 * bluetooth (works out-of-the-box)
 * Suspend (works out of the box in 2.6.26)
 * Video (works out of the box in 2.6.26)
 * Wireless (works out of box in 2.6.30)
(See below for more)

== Devices to be confirmed ==
 * suspend (works, unload module sky2 before suspending; tested with kernel 2.6.20) (no longer necessary in kernel 2.6.26)
s2ram -f -p -m works (for some values of "work") with original macbook (sys_product = "MacBook1,1" sys_version = "1.0" bios_version = "MB11.88Z.0061.B03.0610121324") kernel 2.6.21.3 and mactel patches rev 126. Resumes with backlight off but can turn back on with pommed (usually...), also external display resumes with DPMS disabled. Apparently Ubuntu got the backlight turned on when resuming, need to investigate how to solve this issue.

== Backlight + Volume + CD Eject button ==
Backlight keys (Fn+F1 and Fn+F2) work using [[http://www.technologeek.org|Julien Blache's]] [[DebianPkg:pommed|pommed]] (there is a new project homepage at [[http://alioth.debian.org/projects/pommed/|alioth]]); you can even turn off the backlight using the keyboard; pommed also enables the CD Eject button's functionality, Fn behaviour and remote control. Besides, you can also install [[DebianPkg:gpomme|gpomme]]: a GTK+ client suitable for all environments (you should start it when your session starts) and [[DebianPkg:wmpomme|wmpomme]] (a WindowMaker dockapp)

By default on Debian testing, the F1, F2 ... FX keys are disabled and act like Fn+F1, Fn+F2 ... To enable the keys and make use of Fn+FX, modify /etc/pommed.conf by changing fnmode = 1 to fnmode = 2 and restart pommed with /etc/init.d/pommed restart.

Backlight also works using frankie's [[http://hackweb.altervista.org/forum/index.php?act=ST&f=2&t=7&st=0#entry8|backlight]], that can be controlled with [[http://ubuntuforums.org/showthread.php?t=215801|macbook-backlight-control]].

To enable the sound keys (Fn+F3, Fn+F4 and Fn+F5), you have to modify /etc/pommed.conf : change init = -1 to init = 80 and (at least on Macbook 2) change volume = "PCM" to volume = "Front" and after that restart pommed with /etc/init.d/pommed restart. (Are you sure? I've set it to PCM. If so please explain why)
Line 458: Line 1089:
=== Configure highres video playback ===
For highres video playback something like the following is needed in the Device section:

{{{
        Option "LinearAlloc" "6144"
        Option "CacheLines" "1080"
}}}

=== External monitor ===

## DEAD LINK: See also an [[http://sourceforge.net/mailarchive/forum.php?thread_id=20229481&forum_id=47881|xorg.conf file]] which enables use of an external monitor.

Note when using an external display: unless the display resolution is in the small builtin supported list (it won't be if it's widescreen or highres) then you'll need to use 915resolution to set a mode for the external display too.

Note when using multiple displays: the order for MonitorLayout is "pipe a, pipe b" but this corresponds to "screen 1, screen 0", not "screen 0, screen 1" as you might expect (and isn't documented in the man page...)

You need a [[http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore?productLearnMore=M9320G/A|mini-DVI/VGA adaptor]].
Line 478: Line 1091:
==== Configure dual screen (for lenny/sid users) ====
Dual screen configuration for etch does not work for xorg 7.2 and later. Just use the usual single-screen xorg.conf, and configure output later.

You can control X with xrandr.

LVDS is the liquid display, VGA is the external output. (see output of xrandr command)

To enable dual screen

{{{
xrandr --output VGA --mode 1024x768
xrandr --output VGA --right-of LVDS
}}}
or in one big command including handling of disabling unneeded output:

{{{
xrandr --output TMDS-1 --off --output LVDS --mode 1280x800 --crtc 1 --output VGA --mode 800x600 --right-of LVDS --crtc 0
}}}
You also need to set 'Virtual' the get the most out of you hardare, this is the overall space you have to work with in your screens. The intel driver supports a max of 2048x2048 before turning off DRI. I dont thik you can chnage this while X is running so xrandr won't be able to make use the extra space until x is restarted. If you have a wide screen already, I suggest setting up the macbook below the screen as you can then fit a 1920x1200 monitor.

{{{
Section "Screen"
        Identifier "Default Screen"
        SubSection "Display"
                Virtual 2048 2048
        EndSubSection
EndSection
}}}
To disable dual screen, simply specify VGA to off

{{{
xrandr --output VGA --off
}}}
915resolution now works automatically; the below (old) instructions show how to do it manually, but this is no longer necessary:
Line 544: Line 1125:
== Sound ==
=== Sound for lenny ===
{i} This is written under linux-image-2.6.26-1-amd64 @ version=2.6.26-2 as of 2008-080-17.

It works out of box with ALSA after disabling '''mute'''.

In case you have trouble, reconfigure sound system with "{{{dpkg-reconfigure linux-sound-base}}}" to use ALSA. Then udev system picks snd_hda_intel and required modules with proper parameters at boot time.

## Does model=mbp3 needed now?
## Richard Shore: I still needed it. That's with Lenny-Stable (both i386 & amd64) on a late 2007 Macbook.
## Does alsaconf helps setup?
Please note '''Surround''' output is connected to '''speaker''' via '''headphone''' plug. Neither ''Center'' nor ''Front'' are connected. You need to customize mixer default to unmute '''Surround''' to hear sound and optionally maximize its volume for ease of use. (You can do this via alsamixer or gnome volume control. For gnome volume control, you need to customize it to get menu for surround enabled.)

{{{
aptitude install 915resolution
915resolution -c 945 54 1280 800
}}}
then edit ''/etc/default/915resolution''

{{{
#
# 915resolution default
#
# find free modes by /usr/sbin/915resolution -l
# and set it to MODE
# e.g. use MODE=54
MODE=54
#
# and set resolutions for the mode.
# e.g. use XRESO=1024 and YRESO=768
XRESO=1280
YRESO=800
#
# We can also set the pixel mode.
# e.g. use BIT=32
# Please note that this is optional,
# you can also leave this value blank.
BIT=32
}}}
Adjust the ''Monitor'' section of ''/etc/X11/xorg.conf''

{{{
Section "Monitor"
        Identifier "Color LCD"
        Option "DPMS"
        HorizSync 28-64
        VertRefresh 43-60
        Modeline "1280x800@60" 83.91 1280 1312 1624 1656 800 816 824 841
EndSection
}}}
and make sure the ''Screen'' sections uses "1280x800" as default resolution in the ''Modes'' lines and finally

{{{
/etc/init.d/915resolution start
}}}
Line 612: Line 1224:
=== For MacBook Aluminum (late 2008) ===
 * Open Terminal.
 * Run alsamixer (as root).
 * Set all up Master, PCM, Line-Out and switch from 2ch to 6ch.
 * Run '''alsactl store''' and enjoy.

== Wireless ==
 ''See [[MacBook/Wireless]]''

Different MacBooks use different WiFi cards – in some more recent kernels, WiFi will work out-of-the-box; in other cases, it requires more hacking.

== Keyboard ==
After the standard installation of Debian Linux, what you type on the keyboard might not be what you see on the screen, and some characters, such as curly brackets, might not be available at all. This is due to an incorrect keyboard mapping. In particular you might want to add/change/configure the following:

'''Swapped keys:''' Even if you have chosen the correct general keyboard layout, e.g. German for a German keyboard, there may still be keys swapped, e.g. you press the '<' key and get a '^' and vice versa. This can be corrected with a global option.

'''Alt-Gr:''' Alt-Gr stands for 'alternate graphic' and is a modifier key, much like Shift or Ctrl, used to type special characters, typically the 'third symbol' on the lower right of a key. The Mac keyboard does not have such a key, so we want to configure the right Apple key as an Alt-Gr key.

'''Function keys:''' You may also want to configure the function keys.

The keyboard mappings are configured separately for the X11 (X Window) system and for the consoles.

=== X11 (X Window) ===
The recommended place to configure the keyboard mapping for X11 is the configuration file {{{/etc/X11/xorg.conf}}}, which has the advantage of effecting all users. Each user can also configure his/her keyboard individually in the (Gnome) Desktop Preferences.

'''{{{/etc/X11/xorg.conf}}}:'''

To set options for the keyboard you can use the {{{XkbOptions}}} field in the keyboard section of file {{{/etc/X11/xorg.conf}}}. To activate the right Apple key as an Alt-Gr key add {{{"lv3:rwin_switch"}}}. To correct the swapped keys add {{{"apple:badmap"}}}. To do both combine them with a separating comma, as shown below.

{{{
Section "InputDevice"
        Identifier "Generic Keyboard"
        Driver "kbd"
        Option "CoreKeyboard"
        Option "XkbRules" "xorg"
        Option "XkbModel" "pc105"
        Option "XkbLayout" "it"
        Option "XkbOptions" "lv3:rwin_switch,apple:badmap"
EndSection
}}}
To activate the changes restart X11 by pressing Ctrl-Alt-Backspace, but close all sensitive applications first.

'''Desktop Preferences:'''

It is probably best to change the keyboard mappings discussed here centrally in {{{/etc/X11/xorg.conf}}}. However, it is also possible to change them in the Desktop Preferences. For Gnome click 'Desktop' -> 'Preferences' -> 'Keyboard'.

For the basic keyboard definition go to 'Layouts'. As 'keyboard model' choose 'MacBook/MacBook Pro (Intl)' (although 'Generic 105-key (Intl) PC' seems to work fine as well). As 'selected layout' add and make default 'Germany' -> 'Macintosh' or 'Macintosh, eliminate dead keys' (although 'Germany Eliminate dead keys' seems to work fine as well).

For the configurations under discussion here go to 'Layout Options'. To configure the right Apple key as an Alt-Gr key select 'Third level choosers' -> 'Press Right Win-key to choose 3rd level.'. To correct the swapped keys select 'Miscellaneous compatibility options' -> 'Swap keycodes of two keys when Mac keyboards are misdetected by kernel.'.

When I did this I actually got obscure error messages. So this seems to be buggy and I would not recommend it also for this reason.

=== Consoles ===
To configure the right Apple key as an Alt-Gr key for the consoles (the black and white screen you get with Ctrl-Alt-F1 etc.) add the following line to {{{/etc/console-tools/remap}}}.

{{{
s/keycode 126 =/keycode 126 = AltGr/;
}}}
Correcting swapped keys should also be possible, but I have not figured out how to do that yet.

To set up the correct keyboard mappings in the console do:

{{{
dpkg-reconfigure -p low console-data}}}
and select "Select keymap from the full list" and then select "pc / qwerty / British / Apple USB / Standard" (or whatever country you prefer).

=== Fn-key behaviour ===

If you want to change the bahaviour of the Fn-keys look at /etc/pommed.conf after you've installed pommed on lenny. (Or look at the parameters of the hid kernel module.)

Has anyone made the ''fn'' key work? --> Yes, on MacBook2,1(osamu) with current stable (lenny, 2.6.26). The use of [[DebianPkg:pommed|pommed]] program as written above makes it work better.

=== Other issues ===
Screenshots:

 * [[http://www.webalice.it/zinosat/macbook/macbook_kb.jpg|Italian keyboard]]
 * [[http://flickr.com/photos/brianwc/151797592/|U.S keyboard]]

Alternatively you can work around this with xmodmap and xkbset for missing keys and mouse clicks. xkbset is useful for emulating mouse buttons with the keyboard.

{{{
xmodmap -e "keycode 115 = Alt_L" # left-apple
xmodmap -e "keycode 116 = Zenkaku_Hankaku" # right-apple
xmodmap -e "keycode 108 = Pointer_Button3 Pointer_Button2" # KP-ENTER
xkbset m
}}}
DebianBug:379789 has been filed to track down a problem with keymap

<!> See below "Mouse 2nd and 3rd buttons" for mouse click emulation and fixing unresponseve Keypad equal in num lock mode.

To work around issues of missing/unresponsive keys on the MacBook Japanese models with older Linux kernel, see MacBookJp for helpful scripts (Japanese page but scripts are in English). This problem has been fixed in Debian kernel 2.6.24-1-amd64 for sid (as of Feb 4, 2008). If the patch is present the kernel outputs a message: "Fixing up MacBook JIS keyboard report descriptor".

== Synaptics Touchpad ==

=== Basic configuration ===

<!> Addition of "{{{Section "ServerLayout"}}}" to {{{/etc/X11/xorg.conf}}} is important to get "{{{SHMConfig}}}" enabled properly by enabling '''Synaptics Touchpad'''.

The following basic {{{/etc/X11/xorg.conf}}} will enable your touchpad in sane mode under normal lenny. I mean no more accidental clicks by touching it but you can move pointer and scroll browser vertically.

{{{
# xorg.conf (X.Org X Window System server configuration file)

Section "ServerLayout"
    Identifier "Simple Layout"
    InputDevice "Generic Keyboard" "CoreKeyboard"
    InputDevice "Synaptics Touchpad" "CorePointer"
    InputDevice "Configured Mouse" "SendCoreEvents"
    Screen "Default Screen" 0 0
EndSection

Section "InputDevice"
 Identifier "Generic Keyboard"
 Driver "kbd"
 Option "XkbRules" "xorg"
 Option "XkbModel" "jp106"
 Option "XkbLayout" "jp"
EndSection

Section "InputDevice"
 Identifier "Synaptics Touchpad"
 Driver "synaptics"
 Option "SendCoreEvents" "true"
 Option "Device" "/dev/input/mice"
 Option "SHMConfig" "true"
 Option "MaxTapTime" "0"
 Option "HorizScrollDelta" "0"
 Option "VertScrollDelta" "30"
        Option "TapButton1" "0"
        Option "TapButton2" "0"
        Option "TapButton3" "0"
EndSection

# In case you have USB mouse
Section "InputDevice"
 Identifier "Configured Mouse"
 Driver "mouse"
EndSection


Section "Device"
 Identifier "Configured Video Device"
EndSection

Section "Monitor"
 Identifier "Configured Monitor"
EndSection

Section "Screen"
 Identifier "Default Screen"
 Monitor "Configured Monitor"
EndSection
}}}

<!> Section "InputDevice" with "Generic Keyboard" should be adjusted to your original localized configuration of xorg.conf generated by "{{{sudo dpkg-reconfigure -phigh xserver-xorg}}}". This example is for Japanese system.

You can configure your touch pad by installing "{{{gsynaptics}}}" package or similar. Under GNOME, you can access it from "System" -> "Preferences" -> "Touchpad".

As for missing mouse butons, see "Mouse 2nd and 3rd buttons". (I found relying on taps can get quite annoying. See below if you wish.)

=== Mouse 2nd and 3rd buttons ===

==== X level emulation ====

Left Apple key (keycode = 115, sometimes called left command key) may be used as replacements for mouse 2nd and 3rd buttons.
 * "Right click" by "Apple-key"
 * "Midle click" by "Shift-Apple-key"

This can be done by including following code in the {{{~/.xsessionrc}}} start up script of your home directory:
{{{
/usr/local/bin/mousekeys &
}}}

and create startup script {{{/usr/local/bin/mousekeys}}}
{{{
# wait for some program, here gnome-pane
until ps -C gnome-panel >/dev/null; do sleep 1 ; done
# set xmodmap, DEL is Fn-Delete, BS is Delete
xmodmap - << EOF >/dev/null 2>/dev/null
keycode 115 = Pointer_Button3 Pointer_Button2
keycode 157 = KP_Equal
keycode 19 = 0 parenright 0 Scroll_Lock
keycode 215 = Print Sys_Req
keycode 216 = Insert
keycode 217 = Pause Break
EOF
}}}

This binds these keys to mouse keys and some missing keys. (You may execute these from X terminal emulators too.)

<!> Redifinition of "keycode 19" for normal "0" key is for Japanese keyboard. Please adjust these key redifinitions as you like.

For GNOME, enable mouse keys by keyboard from "System" -> "Preferences" -> "Keyboard" -> "Mouse Keys" -> "Allow to control the pointer using keyboard" : "check to enable".

Alternatively, you may use "{{{xkbset m}}}" command by installing the {{{xkbset}}} pacakage.

Alternatively, you can use Fn-F8(keycode = 215), Fn-F9(keycode = 216), and Fn-F10(keycode = 217) keys on system without keyboad light with:
{{{
xmodmap - << EOF
keycode 215 = Pointer_Button1
keycode 216 = Pointer_Button2
keycode 217 = Pointer_Button3
EOF
}}}

If you would like to use other keys, here's how to do it:

 * Start gnome-terminal
 * Run xev, it will display the X11 events it picks up
 * Locate the keycode of the key you want to use:
  * Press the key you want locate and locate the KeyPress event in gnome-terminal
  * Write down the {{{keycode}}} of the keyevent
 * Run {{{xmodmap -e "keycode 115 = Pointer_Button3 Pointer_Button2"}}} to update your keyboard map (for this login session only for test.)

Instead of using generic X startup code via {{{~/.xsessionrc}}}, you may set it up via GNOME specific startup method: "System" -> "Preferences" -> "Sessions" -> "Startup programs" -> "Add" -> ...

<!> It is not wise to use {{{~/.xsession}}} to add small X startup code since this requires you to create the full X startup code.

<!> "{{{sleep}}}" command in the startup script "{{{/usr/local/bin/mousekeys}}}" was needed to avoid running "{{{xmodmap}}}" command too early. Otherwise, I do not see "xmodmap -pke" reflecting changes. Somehow, mouse keys only were working and regular key redifinitions were not working.

==== Kernel level emulation ====

<!> This needs to be verified. (osamu, based on debian-jp ML)

Recent kernel comea with "DeviceDrivers - Macintosh device drivers - Support for mouse button 2+3 emulation" enabled: {{{CONFIG_MAC_EMUMOUSEBTN=y}}}

Following command can enable Kernel level mouse button 2+3 emulation:

{{{
sysctl -w dev.mac_hid.mouse_button_emulation = 1
sysctl -w dev.mac_hid.mouse_button2_keycode = 116
sysctl -w dev.mac_hid.mouse_button3_keycode = 108
}}}

Here, "keycode = 116" is "Super_R" (Right-Apple) and "keycode = 108" is "KP_Enter" on US keyboard.

=== Synaptics touchpad for the new 2008 unibody Macbook and Macbook Pro ===
The new unibody MacBook Pro requires a new touchpad driver to work. This is discussed over at Ubuntu (http://ubuntuforums.org/showthread.php?t=840040). The driver bcm5974.ko is available here http://bitmath.org/code/bcm5974-dkms/. The snag is that there is no deb and installation is via the DKMS system (http://linux.dell.com/dkms/). But I managed it, so you almost certainly can.

First install git.

aptitude install git-core

Then download the latest source for the bcm5974 driver and the usbhid module, which you also need.

git clone http://bitmath.org/git/bcm5974-dkms.git

git clone http://bitmath.org/git/usbhid-dkms.git

You'll need to download the dkms too. I used the ubuntu deb at http://linux.dell.com/dkms/

dpkg -i dkms_2.0.20.4-0ubuntu1_all.deb

Then build a deb of the bcm5974 driver.

cd bcm5974-dkms/

Follow the instructions in the HACKING file, but not until the end.

make bump

You'll need debhelper and dpkg-dev installed to make the deb.

dpkg-buildpackage

cd ..

This makes the deb. Make the deb for the usbhid module.

cd usbhid-dkms/

make bump

dpkg-buildpackage

cd ..

Now you should have two packages which you can install. dpkg uses dkms to make the modules.

dpkg -i bcm5974-dkms_1.1.1_all.deb usbhid-dkms_0.11.1_all.deb

modprobe bcm5974 should load the module. Now all you need is to edit xorg.conf.

xorg.conf:
{{{
Section "Module"
   Load "glx"
   Load "synaptics"
EndSection

Section "InputDevice"
   Identifier "Generic Keyboard"
   Driver "kbd"
   Option "CoreKeyboard"
   Option "XkbRules" "xorg"
   Option "XkbModel" "pc105"
   Option "XkbLayout" "gb"
   Option "XkbOptions" "lv3:rwin_switch,apple:badmap"
EndSection

Section "InputDevice"

   Identifier "Synaptics Touchpad" Driver "synaptics"
   Option "SendCoreEvents" "true"
   Option "Device" "/dev/input/mice"
   Option "Protocol" "auto-dev"
   Option "SHMConfig" "true"
   Option "New AccelFactor" "0.03"
   Option "LeftEdge" "0"
   Option "RightEdge" "1280"
   Option "RightEdge" "1280"
   Option "TopEdge" "0"
   Option "BottomEdge" "800"
   Option "MinSpeed" "0.94"
   Option "MaxSpeed" "1"
   Option "AccelFactor" "0.0015"
#tapping

   Option "RTCornerButton" "2"
   Option "RBCornerButton" "3"
   Option "LTCornerButton" "2"
   Option "LBCornerButton" "3"
   Option "FingerHigh" "30"
   Option "FingerLow" "20"
   Option "MaxTapTime" "150"
   Option "FastTaps" "0"
   Option "TapButton1" "1"
   Option "TapButton2" "2"
   Option "TapButton3" "3"
#edge scroll

   Option "VertEdgeScroll" "0"
   Option "HorizEdgeScroll" "0"
   Option "VertScrollDelta" "5"
   Option "HorizScrollDelta" "0"
#two finger scroll

   Option "VertTwoFingerScroll" "1"
   Option "HorizTwoFingerScroll" "1"
EndSection

Section "Device"
   Identifier "Configured Video Device"
   Driver "nvidia"
EndSection

Section "Monitor"
   Identifier "Configured Monitor"
EndSection

Section "Screen"
   Identifier "Default Screen"
   Monitor "Configured Monitor"
EndSection

Section "ServerLayout"
   Identifier "Main Layout"
   Screen "Default Screen"
   InputDevice "Synaptics Touchpad"
   InputDevice "Generic Keyboard"
EndSection

}}}

This set up gives you tapping 1, 2, or 3 fingers for left, middle, and right clicks and two-finger scrolling.
Line 1159: Line 1406:

== Processor ==

=== CPU frequency scaling ===

==== CPU frequency scaling in kernel (basics) ====

CPU frequency scaling is governed by SPEEDSTEP_CENTRINO kernel module. You should also enable the ''acpi_cpufreq'' module and one of its methods ''cpufreq_ondemand'' or ''cpufreq_conservative''.

{{{
echo speedstep_centrino >> /etc/modules
echo acpi_cpufreq >> /etc/modules
echo cpufreq_ondemand >> /etc/modules
}}}

Here, I chose the ''cpufreq_ondemand'' for responsiveness.

==== CPU frequency scaling in kernel (customization) ====

<!> For lenny, these do not seem to be needed anymore.

To avoid unnecessary overhead you can let kernel scale the CPU frequency automatically. Just load module ''cpufreq_ondemand'' or ''cpufreq_conservative''. The ''ondemand''-module is perhaps better choice if you want the system to be as responsive as possible.

Next add this to ''/etc/rc.local'' or to another startup script:

{{{
# Switch on "ondemand" CPUfreq governor
# This is more reliable and faster than using userspace governor and
# a userspace program to control CPU frequency.
# You have to do this for each CPU.
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# The "ondemand" governor in kernels prior to 2.6.22 something tend to
# have a bit high sampling rate, so we will modify it according to
# http://www.linuxpowertop.org/known.php
# This is not _required_, but reduces the amount of wake-up calls the
# processor makes each second
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
cat /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate
}}}

==== CPU frequency scaling in userspace ====

In case you want more complex CPU frequency scaling schemes, you can just load the module ''cpufreq_userspace'', set it as default (see above) install [[DebianPkg:powernowd|powernowd]] or [[DebianPkg:cpufreqd|cpufreqd]] package for CPU frequency scaling. There are several other daemons available, but those two work quite well.

You can use gkfreq to monitor the CPU frequency in gkrellm (currently it only supports one processor but can be easily modified to support 2 cores - I have send a small patch to the maintainer) : http://www.peakunix.net/gkfreq/

=== CPU throttling ===
CPU throttling means forcing the processor(s) to idle for a certain amount of their time. When processor is not heavily loaded this saves battery but also slows the processor down. With 1st generation Macbook switching both cores to 50% throttling so that they are idle 50% of the time can give maybe 30-40 minutes of extra battery life. The Macbook is perfectly usable even both processors are running at 1Ghz (scaled down) and throttled to 50%. So in most cases, it's a good idea to use CPU throttling when using battery.

There are various ways to enable CPU throttling. It is probably easiest to use laptop-mode, and make sure that throttling is enabled in /etc/laptop-mode/laptop-mode.conf:

{{{
# Should laptop mode tools control the CPU throttling? This is only useful
# on processors that don't have frequency scaling.
# (Only works when you have /proc/acpi/processor/CPU*/throttling.)
CONTROL_CPU_THROTTLING=1
# Legal values are "maximum" for the maximum (slowest) throttling level,
# "minimum" for minimum (fastest) throttling level, "medium" for a value
# somewhere in the middle (this is usually 50% for P4s), or any value listed
# in /proc/acpi/processor/CPU*/throttling. Be careful when using "maximum":
# this may be _very_ slow (in fact, with P4s it slows down the processor
# by a factor 8).
BATT_CPU_THROTTLING=medium
LM_AC_CPU_THROTTLING=minimum
NOLM_AC_CPU_THROTTLING=minimum
}}}
=== Powertop ===
If you are serious about saving power, take a look at [[http://www.linuxpowertop.org/powertop.php|Powertop]] program. It is a very good interactive program that gives suggestions on how to minimize CPU wakeups. I was able to drop wakeups from around 1500 to roughly 400 with the aid of this program.

With up-to-date lenny/sid, it's possible to drop to around 100 wakeups (with wifi and compiz).

== infrared receiver ==
== Infrared Receiver before lenny ==
Line 1343: Line 1519:
== iSight ==
On the Macbook (Pro) iSight might work with the linux-uvc driver. It is now part of linux-image-2.6.26, the default kernel for Lenny. In the initial black MacBook, it doesn't work.

Locate the firmware from MacOS X, and note the location, you will need this later:

{{{
# mount -t hfsplus /dev/sda2 /mnt/mac/
# ls /mnt/mac/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport
}}}
Now we install the needed packages:

{{{
# aptitude install module-assistant linux-uvc-source isight-firmware-tools
}}}
When installing isight-firmware-tools, debconf asks about the path to the firmware. Specify the location you have found above.

Once the source and tools are installed, you should have /lib/firmware/isight.fw . If not, something went wrong installing isight-firmware-tools.

To try to extract the firmware again (only do this if you don't have /lib/firmware/isight.fw ) :

{{{
# dpkg-reconfigure -plow isight-firmware-tools
}}}
Keep repeating this until you get the /lib/firmware/isight.fw .

{{{
# modprobe uvcvideo
# /etc/init.d/hal restart
}}}
Test it with Cheese.

{{{
# aptitude install cheese
$ cheese
}}}
If you see your face, iSight is probably working :).

 * References
  * http://linux-uvc.berlios.de
  * http://bersace03.free.fr/ift/
  * http://blogs.gnome.org/view/rbultje/2006/07/18/0
  * http://zaheer.merali.org/articles/2006/07/21/isight-linux-thank-you-ronald (with screencast!)
  * http://johannes.sipsolutions.net/MacBook/iSight
  * http://sourceforge.net/mailarchive/forum.php?forum_name=mactel-linux-users
  * http://i-nz.net/projects/linux-kernel/ (Bundle SVN (rev.100 + isight.patch) + Howto)
== Kernel patch and hardware tool resource ==
[[http://www.mactel-linux.org/|Mactel-Linux]] has mactel specific kernel patch and hardware tool resource. Its subversion archive can be seen at http://svn.sourceforge.net/viewvc/mactel-linux by the browser or retrieved by:

{{{
 $ svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux mactel-linux
}}}
== Kernel ==
CONFIG_FB_IMAC support is for booting from ELILO (EFI). You are most probably using lilo/rEFIt to boot, using IMAC driver will make your screen appear scrambled. Use CONFIG_FB_I810 driver instead.

Helpful guide on compiling a mactel kernel: http://gentoo-wiki.com/HARDWARE_Apple_MacBook

The gentoo wiki suggests loading the "applesmc" module, which works fine for me (albertl7). Among other things, t allows me to control the medium fan speed, which I increase because my Macbook gets so hot. I put this is rc.local:

{{{
echo "4000" > /sys/devices/platform/applesmc.768/fan1_min
}}}
The gentoo wiki has a different path, so it might be different on all the various Macbook computers. The higher fan speed makes more noise, but I'm comfortable with that.

== Hardware Sensors ==
== CPU Core Temperature Sensor (manual methods) ==
Line 1489: Line 1603:
= Old hardware issues =
== USB ==
usual EHCI, UHCI stuff

== Gigabit Ethernet ==
Your kernel must have support for the ''Yukon Gigabit Ethernet'' driver known as '''sky2'''; this is available in Debian 4.0 Etch (or kernel 2.6.16 and above).

See DebianBug:378521

== Video ==
915resolution now works automatically; the below (old) instructions show how to do it manually, but this is no longer necessary:

{{{
aptitude install 915resolution
915resolution -c 945 54 1280 800
}}}
then edit ''/etc/default/915resolution''

{{{
#
# 915resolution default
#
# find free modes by /usr/sbin/915resolution -l
# and set it to MODE
# e.g. use MODE=54
MODE=54
#
# and set resolutions for the mode.
# e.g. use XRESO=1024 and YRESO=768
XRESO=1280
YRESO=800
#
# We can also set the pixel mode.
# e.g. use BIT=32
# Please note that this is optional,
# you can also leave this value blank.
BIT=32
}}}
Adjust the ''Monitor'' section of ''/etc/X11/xorg.conf''

{{{
Section "Monitor"
        Identifier "Color LCD"
        Option "DPMS"
        HorizSync 28-64
        VertRefresh 43-60
        Modeline "1280x800@60" 83.91 1280 1312 1624 1656 800 816 824 841
EndSection
}}}
and make sure the ''Screen'' sections uses "1280x800" as default resolution in the ''Modes'' lines and finally

{{{
/etc/init.d/915resolution start
}}}
= Resources =
 * http://desrt.mcmaster.ca/macbook.xhtml
 * http://sharealike.org/index.php/2006/05/26/macbook-triple-boot-howto-with-debian-etch-and-xp-upgrade-version/
 * http://modular.math.washington.edu/macbook/
 * http://gentoo-wiki.com/HARDWARE_Apple_MacBook
 * http://ubuntuforums.org/showthread.php?t=198453
 * Server irc.oftc.net, channel #mactel-linux
 * http://www.netfort.gr.jp/~dancer/diary/junk2006/debianmeetingresume200607-presentation-english.pdf for English-version presentation
  . see http://tokyodebian.alioth.debian.org/2006-07.html for Japanese instructions
 * http://stuff.der-marv.de/macbook/
 * http://dentifrice.poivron.org/laptops/macbook/
 * https://help.ubuntu.com/community/MacBook
 * https://wiki.ubuntu.com/MacBookPro
 * http://www.debianhelp.co.uk/lilo.htm
 * http://www.tgunkel.de/it/hardware/doc/ibook_g4_linux.en
 * http://www.ppcnux.de/?q=node/6767
 * [[http://lists.debian.org/debian-devel/2006/07/msg00008.html|Original thread in debian-devel ML]]
 * http://www.michaelvkim.net/?p=5
Line 1562: Line 1605:
 . See also: [[InstallingDebianOn/Apple]]

Translation(s): English - ?Español - Français


Basic situation of MacBook with Debian

Pure Debian system is still a challenge since a direct EFI boot will leave you without a video BIOS, which means no 3D acceleration. And I'm sure you want 3D acceleration.

Many issues reported on EFI compatible bootloaders and related packages are being resolved and these packages are in Debian. See their BTS and PTS for the latest bug and source package situation:

  • Package grub-efi: GRand Unified Bootloader, version 2 (EFI version)
  • Package elilo: Bootloader for systems using EFI-based firmware
  • Package refit: graphical boot menu for ia32 and x64 EFI systems

Chain loading BIOS compatible classic bootloader via rEFIt installed to MacOS X works well:

  • Package grub-pc: GRand Unified Bootloader, version 2 (PC/BIOS version)
  • Package lilo: LInux LOader - The Classic OS loader can load Linux and others
  • Package gptsync: GPT and MBR partition tables synchronisation tool
  • Debian Etch on a MacBook HOWTO (triple-boot with XP) at:

  • http://sharealike.org/index.php?m=200605

  • Boot process described is rEFIt to LILO to Linux.
  • Triple boot (Debian Etch and XP) at:
  • http://wiki.onmac.net/index.php/Triple_Boot_via_BootCamp

  • Boot process described is rEFIt to LILO to Linux (using Bootcamp).
  • Debian lenny multiple boot (lenny beta2) beyond 3 systems at:
  • MacBook/DebianInstallTutorial

  • Boot process described is rEFIt to GRUB 2 (grub-pc) to many Linux systems using lenny beta2 CD.

<!> You should use the latest lenny installer CD by now. The kernel for lenny is 2.6.26 series. It is good idea to upgrade your kernel to the backported one (2.6.30 series) for better hardware supports.

<!> Make sure you’ve received the latest Apple updates in OS X. This is needed because the latest updates include a BIOS compatibility layer we are going to use to boot Debian.

Relevant information elsewhere on this wiki: MacMiniIntel and MacBookPro.

Following contain many detailed information.

What is a MacBook

MacBook is a series of Notebook PCs sold by Apple Inc. since around 2006. There are several different models with different internal hardwares, and you will usually get the latest version available. You can check which version by looking at Mac OS X "about this Mac" menu, or dmidecode output from Linux.

  • ?MacBook1,1: 2006 MacBook, white, coreduo, wlan is atheros, graphics is intel

  • ?MacBook2,1: 2006 MacBook, white, core2duo, wlan is atheros, graphics is intel

  • ?MacBook3,1:

  • ?MacBook4,1: 2008 MacBook, white, core2duo, wlan is BCM4328, graphics is intel

  • ?MacBook5,1: 2008 MacBook, aluminium, core2duo, wlan is BCM4322, graphics is nVidia

  • ?MacBook5,2: 2009 MacBook, white, core2duo, wlan is Broadcom BCM43xx 1.0 (5.10.38.27), graphics is nVidia (Debian 5 installs, but ONLY boots and "sort of works" with kernel 2.6.26-1-486 kernel or by specifying maxcpus=1. Interesting information found here: http://bugzilla.kernel.org/show_bug.cgi?id=13170 .)

(Please fill in as appropriate)

Pros and cons of a MacBook for Linux users

Pros:

  • nice design
  • price is ok
  • comes with the Mac OS X operating system, which is almost as compatible as Windows for many commercial applications but much like Linux on the command line level, thus it is probably the preferable alternative to Windows for Linux users

Cons:

  • touchpad (mouse) has only one button (not necessarily a problem, but can be annoying for some users)
  • keyboard is missing a few common keys (e.g. Alt-Gr, Del) (they can be remapped to other keys)
  • (not true for US keyboards) keyboard is missing a few common symbols printed on the keys (e.g. @, {, })
  • installation of Debian Linux is not straightforward and requires quite some extra configuration work

Debian installation

See also: InstallingDebianOn/Apple

Single boot – Debian only

This requires you to set up system with EFI bootloader. We should see this happen real soon for squeeze.

If you want to use rEFIt, follow the advice under Double boot. Note that you will need to boot into mac os X one last time to set up rEFIt. Also note that you should not use the use whole disk option in the debian installer, as this is going to destroy the EFI partition which is used by rEFIt. So you should first shrink your mac os x partition by 1G, then partition that 1G into /boot and /, make /boot bootable, and install a minimal system in your 1G /. tell rEFIt to boot from /boot, check the system boots ok. Then repartition (wiping the mac partition, preserving the EFI partition and /boot), reinstall debian onto your whole drive, re-using the same /boot. Hopefully, you should have a working single-boot debian macbook. Note that this procedure is untested, as the author wrote it as a result of wiping his own EFI partition by using use whole disk in the installer. Please report results if you attempt it.

Double boot - Mac OS X & Debian

Partitioning (via OS X)

Before you can install Debian, you have to physically make space for it on the hard drive. You can either (re)partition the whole disk or shrink the existing Mac OS X partition, there is more than one way to do it.

Hint: It is not really necessary to create linux partitions at this point (this can be done during the installation of Debian), but it might be advantageous for two reasons. Firstly, The Mac OS X Disk Utility behaves strangely if you just request free space and do not define a file system, see below. Secondly. It is important that the Linux system partition is a primary partition (number 1 to 4), see Section "Install Debian". This can be secured by creating and verifying it early in the process. If you define Linux partitions at this stage, consider also to create a partition for exchanging data between Linux and Mac OS X, see Section "Cross-mount file systems" below.

Partition disk with Disk Utility: In the initial phase of the installation procedure for Mac OS X you can use the 'Disk Utility' partition tool that you can find in the 'Installer' by clicking on 'Utilities' -> 'Disk Utility'. This tool is a bit erratic. It likes to move partitions around and change their sizes when you perform the final step of partitioning. We finally succeeded with the following method:

  1. Within the Disk Utility click on the hard drive entry (not any of its subentries).
  2. Click on 'Partition' (between 'Erase' and 'RAID').
  3. Under 'Volume Scheme:' choose the number of partitions. Don't use 'Split' and 'Delete', this seems to confuse the program.
  4. Then work your way from the top partion to the bottom one. Always select a Format (for later Linux partitions use 'UNIX File System', avoid 'Free Space') and mark 'Locked for editing'.
  5. Click on 'Partition' in the bottom right and cross your fingers. It has been observed that 'Disk Utility" hangs in an 'infinite' loop forever.
  6. To verify that the program did the partitioning as you intended, leave 'Partition' (e.g. by clicking on 'First Aid') and reenter it (by clicking on 'Partition' again). Check whether the actual partitioning is what you want.

Hint: The partitions made by the 'Disk Utility' will be numbered beginning with 2, probably to have number 1 left for rEFIt. Thus, to make sure the Linux system partition is a primary one it must be one of the first three partitions.

Shrink Mac OS X partition with diskutil: If you have Mac OS X installed already and don't want to reinstall it (and thereby erase all data), you can use the diskutil program to shrink the Mac OS X partition. This can be done on the current system partition, there is no need to book from CD. Supposing you want to reserve 20GB for your Mac OS X partition, run the following command from a terminal (Applications -> Utility -> Terminal):

Mac OS X $ sudo diskutil resizevolume disk0s2 20G
Started resizing on disk disk0s2 Macintosh HD
Verifying
Resizing Volume
Adjusting Partitions
Finished resizing on disk disk0s2 Macintosh HD
WARNING: You must now reboot!

Support for the resizevolume verb was added in Mac OS X 10.4.6. If you have an earlier version, you'll need to upgrade.

The program diskutil can also add partitions, see its man page. But note that it doesn't provide a way to remove partitions.

Preparing to dual boot (via OS X): rEFIt

First install the latest rEFIt from rEFIt homepage. For optional manual installation, please read rEFIt install documentation. If you don't have your MacBook connected to the internet, you can download the rEFIt Mac disk image onto a USB memory stick and install rEFIt from there by double clicking on rEFIt-0.10.dmg (or whatever version you have) and then on rEFIt.mpkg.

NOTE: The combination of pre-0.9 rEFIt and GNU parted is known to cause problems: see http://refit.sourceforge.net/doc/c4s5_parted.html. If you install an old version of rEFIt and then install Debian + Lilo, you might not be able to install Grub afterwards. Reinstalling rEFIt 0.9 or greater will fix this problem.

It's now possible to proceed with installing Debian.

Note refit doesn't support making linux the default boot choice in triple-boot environments, so you might want to look into other options. rEFIt does support making GNU/Linux the default choice when dual-booting. From OS X, edit the /efi/refit/refit.conf file and uncomment/add the line legacyfirst:

sed -e 's/#\(legacyfirst\)/\1/' -i~ /efi/refit/refit.conf

Install Debian

Get an installation CD: Burn yourself a lenny Debian installation CD (i386 or amd64 version, 1st CD/DVD of full CD/DVD set). CD-images are available from http://www.us.debian.org/distrib/.

Using amd64 version is now OK. The main issues are with 32bit packages such as Java and flash, but it think that's unrelated. If there are still issues please capture them here)

  • I was able to install AMD64 on MacBookPro June 2007 with these steps (7 oct 2007, Eugen Dedu) (I chose the expert mode, but this wouldn't change anything I think):

    • install refit 0.10 in OS X
    • shrink OS X with diskutil (see above the command sudo diskutil ...)
    • reboot and, in refit, choose Disk Partitioning and synchronise
    • reboot on debian CD
    • install all the system, up to lilo
    At this point, the only thing remaining to install is lilo, but this cannot be done yet, since MBR and GPT are not sync, so:
    • instead of lilo/grub, choose without boot loader
    • finish the installation, reboot computer
    • during boot, in refit, do again: Disk Partitioning, and synchronise
    Now, it remains to install lilo:
    • reboot on debian CD
    • go to all stages up to partitioning
    • as partitions are not yet known, enter partitioning, then go back; if it does not go back (d-i bug?), choose partitioning, then manual, then go back
    • execute commands to install lilo, as shown below: mkdir /mnt/sda3 etc.
    • reboot computer and it's ok

Installing Grub2 has also been fine for Lenny. This is the grub-pc version which boot through rEFIt (not grub-efi). This is tested on amd64 and i386.

Boot from installation CD: Insert the Debian installation CD and hold down the c-key while booting. This should bring up the Installation CD welcome screen. Simply press return there and proceed with the installation.

  • TROUBLESHOOTING (double keypresses): If you have strange keyboard problems (double keypresses) or other problems while booting from the install CD, use the following command line on the boot prompt:

    install noapic irqpoll acpi=force

    TROUBLESHOOTING (dead keyboard): If you cannot type anything in the CD/DVD boot prompt (a problem that has occured on a MacBook Core 2 Duo), you can fix it by using USB-attached keyboard. If you do not have a USB keyboard, you can try to reboot from CD repeatedly and see whether finally the keyboard responds. This might work, because the error is not always reproducable.

    TROUBLESHOOTING (how to boot from CD) There are three different ways of booting from CD, of which the third one seems to be the best. (Laurenz Wiskott: Since I have started collecting statistics, the three methods worked (i) 3/8, (ii) 1/9, and (iii) 3/6 times). All three methods require the Linux CD to be in the drive.

    1. Keep the c-key pressed after starting the computer.
    2. If rEFIt is installed let the computer boot into the rEFIt menu and choose the Linux CD there.
    3. If Mac OS X is installed, boot into Mac OS X, insert the Linux installation disc, within Mac OS X go to 'System Preferences' -> 'Startup Disk', click on the Linux CD icon (this tells the computer to start from CD without the need to press the C key at boot time), click on the 'Restart' button, confirm 'Restart', wait. To get back to Mac OS X you might have to restart the computer and keep the eject button pressed to eject the CD, otherwise you keep booting from CD (possibly with the same keyboard problem as before, the behavior is a bit erratic). This last version has been reported to solve the problem 2007-08-27, Apple Discussions, but it does not seem to be reliable either.

    This problem seems to be related to refit, since disabling it and booting while holding the C button pressed (boots directly from CD) fixes this (sometimes). (It seems that booting after the real power-off seems to have less problem than reboot with "shutdown -r now". Also it seems to help situation a bit better by not pressing keyboard except when needed.)

[!!] Choose language ...

[!] Select a keyboard layout ... (unfortunately, as there is no mac keymap on netinstall CDs, the external USB keyboard is appreciated.)

[!!] Configure the network: (Useful for netinstalls. The easiest is to do it via DHCP.)

[!!] Partition disks: While only the "/" system partition is necessary, you should consider to add a swap partition.

When creating new partitions for Linux, take care that the Linux boot/system partition is among the first four partitions, i.e. is a primary partition. There are reports that rEFIt does not notice partition five and higher Linux auf einem MacBook Pro. Also consider creating a partition for exchanging data between Linux and Mac OS X, see Section Cross-mount file systems below.

Mark the "/" (or "/boot" if you created it) as bootable.

Also make sure all partitions are formatted and have a known file system type. Otherwise you get in trouble further below, see TROUBLESHOOTING (GPT partition of type 'Unknown' found, will not touch this disk.). Partitions with free space are ok.

[!!] Set up users and passwords ...

[!] Configure the package manager: (refit is included in version 4.0_r3, but you should still configure a mirror)

[!] Configuring popularity-contest ...

[!] Software selection: Select the Laptop here (in addition to the defaults Desktop environment and Standard system).

[!!] Configuring uswsusp:

  • TROUBLESHOOTING (Configuring uswsusp: Continue without a valid swap partition?): During the standard installation of packages you might get the following error message:

                      [!!] Configure uswsusp
    The swap partition that was found in uswsusp's configuration file is not active. In most cases this means userspace software suspend will not work for you and you will  need to choose (or let uswsusp choose) another partition. In some corner cases however, this can be what you want.
    Continue without a valid swap partition?
        <Go Back>                              <Yes>    <No>
    You can answer "Yes" and reconfigure later with

    dpkg-reconfigure uswsusp

[!] Install the GRUB boot loader on a hard disk: Do not install the GRUB boot loader. So, leave this menu item and go to the main menu by selcting <Go back>.

Synchronize MBR and GPT: Switch to the second virtual console by pressing ctrl-alt-F2 [or possibly fn-ctrl-alt-F2], press return to start the shell, and then enter

 chroot /target
 aptitude install refit
 /target/sbin/gptsync /dev/sda

or, if refit fails, install gptsync instead. It's gptsync that you need. Gptsync comes with refit but can be installed separately.

 chroot /target
 aptitude install gptsync
 /target/sbin/gptsync /dev/sda

and enter 'y' at the prompt. This synchronizes the MBR from the GPT, which were made out of sync by parted.

(The directory /target is the directory in which the Debian installer installs the new system and it later becomes the root directory /.)

  • TROUBLESHOOTING (no refit available): If aptitude tells you that refit is not available, the reason might be that you have no internet connection and there is no refit package on the Debian installation CD. One solution is to connect the MacBook to the internet during installation. It might also be that you have used the amd64 version, which does not have refit available, see comment above at Get an installation CD.

    • TROUBLESHOOTING (GPT partition of type 'Unknown' found, will not touch this disk.): If there is a partition of type 'Unknown', gptsync will not synchronize MBR. Go back to first console and there to the partitioning. If there is no important data on the partition with the unknown filesystem type, reformat it (but only this one and possibly the swap partition). After that synchronization should work. (However, LILO installation did not work (stalled at 50%, see below) and I had to start from scratch.)

    • TROUBLESHOOTING (gptsync reads linux partition as FAT32): If gptsync reads the partition type incorrectly from the GPT and applies it incorrectly to the MBR, installation of the boot loader will fail. Run sfdisk to set the correct partition type in the MBR: Example:

     sfdisk -c /dev/sda 3 83

Then switch back to the first virtual console by pressing ctrl-alt-F1 [or possibly fn-ctrl-alt-F1].

[!!] Install the LILO boot loader on a hard disk: In the main menu choose select "Install the LILO boot loader on a hard disk". Choose /dev/sda3 (or whatever your new Debian partition is) for the LILO installation target. Do not install LILO to the MBR! When the installer asks whether you want to make this partition active, choose "No."

  • TROUBLESHOOTING (LILO installation stalls forever at 50%): I have no solution for that one and simply started from scratch. The solution recommended in the next troubleshooting point (LILO installation fails) did not work for me, since the command lilo was not known to the system.

    • TROUBELSHOOTING (LILO installation fails): If you get an error while trying to install LILO :

    • reboot, start the refit shell and type gptsync /dev/sda, and answer y
    • boot from the debian CD and follow the steps until the partitioning step, type ctrl-option-F2, press return to start the shell and then enter
    • mount /dev/sda3 to /mnt/sda3, mount /proc to /mnt/sda3/proc, chroot into /mnt/sda3 and run lilo:
      mkdir /mnt/sda3
      mount /dev/sda3 /mnt/sda3
      mount /proc/ /mnt/sda3/proc
      chroot /mnt/sda3
      lilo -b /dev/sda3

    Grub2 is also an option if you don't like LILO. It seems to work perfectly since Lenny beta2, even on amd64.

     chroot /target
     aptitude install grub #this will remove grub-pc
     grub-install /dev/sda3 #sda3 is the system partition
     update-grub
     shutdown -r now

[!!] Finish the installation: Remove the ejected installation CD and select <Continue>. During reboot select Linux from the Mac rEFIt menu.

  • TROUBLESHOOTING (UTC): Lenny Beta 2 asked me whether the system clock where using UTC; Select yes. Please confirm this.

  • TROUBLESHOOTING (Missing operating system): Once Debian is installed it asks you to remove the installation CD and reboot without it. You might then get the error message "Missing operating system". I guess, this means that the MacBook still tries to boot from CD (even though there is none) because following method (iii) in "TROUBLESHOOTING (dead keyboard)" above you have told Mac OS X to boot from CD. To solve this, you can do either of the following two things.

    1. Reboot and keep the alt/option-key pressed during boot. Then select rEFIt to boot.
    2. Insert the Mac OS X installation DVD and boot from it (keep the c-key pressed). Choose your language. Click on 'Utilities' -> 'Startup Disk...'. Select Mac OS X as the system to start. Click on 'Restart...' and confirm 'Restart...'. This should bring you into the rEFIt menu.

GRUB as bootloader

Lenny install CD can install GRUB as bootloader. Its dialogue can be misleading if you wish to install bootloader to MBR. You must create proper MBR/GPT hybrid. It can be done by:

  • gptsync command on Linux

  • menu from rEFIt boot loader

If you wish to switch from lilo to GRUB, please read and understand some basics at: http://www.debian.org/doc/manuals/debian-reference/ch03.en.html#_stage_2_the_boot_loader. The choice of GRUB bootloader is the grub-pc package. Having bootable GRUB CD is good idea.

Installing os-prober package eases GRUB configuration. So please consider to do this before reboot via console.

Cross-mount file systems

To make a double boot system really useful it is desirable to cross-mount file systems, i.e. to make Mac OS X-filesystems readable (and writable) under Linux and vice versa. Mac OS X uses a file system called HFS+ while Linux uses ext3.

Even though cross-mounting is possible in either direction, there seems to be some scepticism (and possibly bad experience?) concerning the reliability, so that the common advice seems to be to only use small partitions mounted under both operating systems and use them for data exchange. Mounting and using large partitions for regular usage under both operating systems seems to be not advisable. (Please let us know if you have experience with that.)

Mount Mac OS X filesystems (HFS+) under Linux

If you want to mount a Mac OS X-filesystem under Linux in read-write mode (not read-only) then you have to turn off journaling first under Mac OS X. If you leave journaling on, you can only mount in read-only mode and will not be able to write or modify files in the Mac OS X-filesystem. This is a trade-off, of course, because journaling gives you security that your Mac system lacks if you turn it off. It might thus be advisable to have one partition for the Mac operating system with journaling (which is the default) mounted from Linux read-only (if at all) and one partition with user data without journaling mounted from Linux read-write. See HOWTO hfsplus for more information about HFS+ under Linux.

Step 1 (if mounting read-write) - turn off journaling under Mac OS X: If you want to mount the Mac OS X-filesystem in read-write mode (not read-only) then you have to turn off journaling.

(i) Boot into Mac OS X.

(ii) Start a terminal.

(iii) As root (e.g. with sudo) use diskutil to turn off journaling (Disabling journaling via diskutil):

mac:user> sudo /usr/sbin/diskutil disableJournal /data

This assumes your partition is mounted to the directory /data. If you want to turn off journaling for your Mac operating system partition, use / instead.

(iv) Reboot into Linux.

Step 2 - mount the Mac OS X-filesystem under Linux: If /dev/sda2 contains the HFS+-filesystem of the Mac OS X you want to mount, then run under Linux the following as root Dave Taylor, 2005-05-14.

root# mkdir /media/macdata
root# mount -t hfsplus /dev/sda2 /media/macdata

This mounts /dev/sda2 on the directory /media/macdata (only read-only if the HFS+ partition is using journaling, which is the default when Mac OS X creates a HFS+ partition). Of course, you can also create and mount on a different directory.

  • Verify: To check whether your mount was successfull, as root go into the directory /media/macdata and list the files, create a file, and remove it again. To check whether users have access, as root create a directory for that user in /media/macdata, change ownership to that user, change into that directory, su to that user and perform the same test actions as before (list, create and delete a file).

Step 3 (optional) - edit fstab to auto-mount at boot time: If you want to mount the partition automatically at boot time, you have to add an entry like the following in the file /etc/fstab.

/dev/sda2   /media/macdata   hfsplus   defaults   0   2
  • Verify: To check whether automount should work, unmount the partition (if it is still mounted from Step 2), and remount it with the -a option.

    root# umount /media/macdata
    root# mount -a
    Then perform the same checks as in Step 2.

TROUBLESHOOTING (cannot write on HFS+ filesystem anymore): If you cannot write on the HFS+ filesystem anymore, boot into Mac OS X and perform a filesystem check, maybe that helps Linux on an Apple iBook G4.

Mount Linux filesystems (ext3) under Mac OS X

To mount Linux filesystems (ext3) under Mac OS X the only open source option seems to be to use ext2fsx Mac OS X Ext2 Filesystem at SourceForge. You have to use the newest version (1.4d4 as of 2007-09-02), which is not stable yet. Version 1.3 does not work for recent Mac OS X versions.

Hardware configuration

Devices that work

The following features work for lenny (kernel 2.6.26):

  • Ethernet (as of kernel 2.6.16) (works out-of-the-box) (sky2)
  • Video (as of 2.6.26 wors out of the box)
  • Sound (as of kernel 2.6.18) (works out-of-the-box) (snd_hda_intel)
  • CD-R (works out-of-the-box)
  • backlight (works out-of-the-box)
  • bluetooth (works out-of-the-box)
  • Suspend (works out of the box in 2.6.26)
  • Video (works out of the box in 2.6.26)
  • Wireless (works out of box in 2.6.30)
  • USB usual EHCI, UHCI stuff

(See below for more)

Backlight + Volume + CD Eject button

Backlight keys (Fn+F1 and Fn+F2) work using Julien Blache's pommed (there is a new project homepage at alioth); you can even turn off the backlight using the keyboard; pommed also enables the CD Eject button's functionality, Fn behaviour and remote control. Besides, you can also install gpomme: a GTK+ client suitable for all environments (you should start it when your session starts) and wmpomme (a ?WindowMaker dockapp)

By default on Debian testing, the F1, F2 ... FX keys are disabled and act like Fn+F1, Fn+F2 ... To enable the keys and make use of Fn+FX, modify /etc/pommed.conf by changing fnmode = 1 to fnmode = 2 and restart pommed with /etc/init.d/pommed restart.

Backlight also works using frankie's backlight, that can be controlled with macbook-backlight-control.

To enable the sound keys (Fn+F3, Fn+F4 and Fn+F5), you have to modify /etc/pommed.conf : change init = -1 to init = 80 and (at least on Macbook 2) change volume = "PCM" to volume = "Front" and after that restart pommed with /etc/init.d/pommed restart. (Are you sure? I've set it to PCM. If so please explain why)

Video

Video now works automatically withour manually installing 915resolution.

Configure highres video playback

For highres video playback something like the following is needed in the Device section:

        Option          "LinearAlloc" "6144"
        Option          "CacheLines" "1080"

External monitor

Note when using an external display: unless the display resolution is in the small builtin supported list (it won't be if it's widescreen or highres) then you may need to use 915resolution to set a mode for the external display.

Note when using multiple displays: the order for ?MonitorLayout is "pipe a, pipe b" but this corresponds to "screen 1, screen 0", not "screen 0, screen 1" as you might expect (and isn't documented in the man page...)

You need a mini-DVI/VGA adaptor.

Configure dual screen

Dual screen configuration for etch does not work for xorg 7.2 and later on lenny. Just use the usual single-screen xorg.conf, and configure output later.

You can control X with xrandr.

LVDS is the liquid display, VGA is the external output. (see output of xrandr command)

To enable dual screen

xrandr --output VGA --mode 1024x768
xrandr --output VGA --right-of LVDS

or in one big command including handling of disabling unneeded output:

xrandr --output TMDS-1 --off  --output LVDS --mode 1280x800 --crtc 1 --output VGA --mode 800x600  --right-of LVDS --crtc 0

You also need to set 'Virtual' the get the most out of you hardare, this is the overall space you have to work with in your screens. The intel driver supports a max of 2048x2048 before turning off DRI. I dont thik you can chnage this while X is running so xrandr won't be able to make use the extra space until x is restarted. If you have a wide screen already, I suggest setting up the macbook below the screen as you can then fit a 1920x1200 monitor.

Section "Screen"
        Identifier      "Default Screen"
        SubSection      "Display"
                Virtual 2048 2048
        EndSubSection
EndSection

To disable dual screen, simply specify VGA to off

xrandr --output VGA --off

Sound

{i} This is written under linux-image-2.6.26-1-amd64 @ version=2.6.26-2 as of 2008-080-17 for lenny.

It works out of box with ALSA after disabling mute.

In case you have trouble, reconfigure sound system with "dpkg-reconfigure linux-sound-base" to use ALSA. Then udev system picks snd_hda_intel and required modules with proper parameters at boot time.

Please note Surround output is connected to speaker via headphone plug. Neither Center nor Front are connected. You need to customize mixer default to unmute Surround to hear sound and optionally maximize its volume for ease of use. (You can do this via alsamixer or gnome volume control. For gnome volume control, you need to customize it to get menu for surround enabled.)

For MacBook Aluminum (late 2008)

  • Open Terminal.
  • Run alsamixer (as root).
  • Set all up Master, PCM, Line-Out and switch from 2ch to 6ch.
  • Run alsactl store and enjoy.

Wireless

Different ?MacBooks use different WiFi cards – in some more recent kernels, WiFi will work out-of-the-box; in other cases, it requires more hacking.

Keyboard

After the standard installation of Debian Linux, what you type on the keyboard might not be what you see on the screen, and some characters, such as curly brackets, might not be available at all. This is due to an incorrect keyboard mapping. In particular you might want to add/change/configure the following:

Swapped keys: Even if you have chosen the correct general keyboard layout, e.g. German for a German keyboard, there may still be keys swapped, e.g. you press the '<' key and get a '^' and vice versa. This can be corrected with a global option.

Alt-Gr: Alt-Gr stands for 'alternate graphic' and is a modifier key, much like Shift or Ctrl, used to type special characters, typically the 'third symbol' on the lower right of a key. The Mac keyboard does not have such a key, so we want to configure the right Apple key as an Alt-Gr key.

Function keys: You may also want to configure the function keys.

The keyboard mappings are configured separately for the X11 (X Window) system and for the consoles.

X11 (X Window)

The recommended place to configure the keyboard mapping for X11 is the configuration file /etc/X11/xorg.conf, which has the advantage of effecting all users. Each user can also configure his/her keyboard individually in the (Gnome) Desktop Preferences.

/etc/X11/xorg.conf:

To set options for the keyboard you can use the XkbOptions field in the keyboard section of file /etc/X11/xorg.conf. To activate the right Apple key as an Alt-Gr key add "lv3:rwin_switch". To correct the swapped keys add "apple:badmap". To do both combine them with a separating comma, as shown below.

Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
        Option          "CoreKeyboard"
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "pc105"
        Option          "XkbLayout"     "it"
        Option          "XkbOptions"    "lv3:rwin_switch,apple:badmap"
EndSection

To activate the changes restart X11 by pressing Ctrl-Alt-Backspace, but close all sensitive applications first.

Desktop Preferences:

It is probably best to change the keyboard mappings discussed here centrally in /etc/X11/xorg.conf. However, it is also possible to change them in the Desktop Preferences. For Gnome click 'Desktop' -> 'Preferences' -> 'Keyboard'.

For the basic keyboard definition go to 'Layouts'. As 'keyboard model' choose '?MacBook/MacBook Pro (Intl)' (although 'Generic 105-key (Intl) PC' seems to work fine as well). As 'selected layout' add and make default 'Germany' -> 'Macintosh' or 'Macintosh, eliminate dead keys' (although 'Germany Eliminate dead keys' seems to work fine as well).

For the configurations under discussion here go to 'Layout Options'. To configure the right Apple key as an Alt-Gr key select 'Third level choosers' -> 'Press Right Win-key to choose 3rd level.'. To correct the swapped keys select 'Miscellaneous compatibility options' -> 'Swap keycodes of two keys when Mac keyboards are misdetected by kernel.'.

When I did this I actually got obscure error messages. So this seems to be buggy and I would not recommend it also for this reason.

Consoles

To configure the right Apple key as an Alt-Gr key for the consoles (the black and white screen you get with Ctrl-Alt-F1 etc.) add the following line to /etc/console-tools/remap.

s/keycode 126 =/keycode 126 = AltGr/;

Correcting swapped keys should also be possible, but I have not figured out how to do that yet.

To set up the correct keyboard mappings in the console do:

dpkg-reconfigure -p low console-data

and select "Select keymap from the full list" and then select "pc / qwerty / British / Apple USB / Standard" (or whatever country you prefer).

Fn-key behaviour

If you want to change the bahaviour of the Fn-keys look at /etc/pommed.conf after you've installed pommed on lenny. (Or look at the parameters of the hid kernel module.)

Has anyone made the fn key work? --> Yes, on ?MacBook2,1(osamu) with current stable (lenny, 2.6.26). The use of pommed program as written above makes it work better.

Other issues

Screenshots:

Alternatively you can work around this with xmodmap and xkbset for missing keys and mouse clicks. xkbset is useful for emulating mouse buttons with the keyboard.

xmodmap -e "keycode 115 = Alt_L"           # left-apple
xmodmap -e "keycode 116 = Zenkaku_Hankaku" # right-apple
xmodmap -e "keycode 108 = Pointer_Button3 Pointer_Button2" # KP-ENTER
xkbset m

379789 has been filed to track down a problem with keymap

<!> See below "Mouse 2nd and 3rd buttons" for mouse click emulation and fixing unresponseve Keypad equal in num lock mode.

To work around issues of missing/unresponsive keys on the MacBook Japanese models with older Linux kernel, see MacBookJp for helpful scripts (Japanese page but scripts are in English). This problem has been fixed in Debian kernel 2.6.24-1-amd64 for sid (as of Feb 4, 2008). If the patch is present the kernel outputs a message: "Fixing up MacBook JIS keyboard report descriptor".

Synaptics Touchpad

Basic configuration

<!> Addition of "Section "ServerLayout"" to /etc/X11/xorg.conf is important to get "SHMConfig" enabled properly by enabling Synaptics Touchpad.

The following basic /etc/X11/xorg.conf will enable your touchpad in sane mode under normal lenny. I mean no more accidental clicks by touching it but you can move pointer and scroll browser vertically.

# xorg.conf (X.Org X Window System server configuration file)

Section "ServerLayout"
    Identifier     "Simple Layout"
    InputDevice    "Generic Keyboard" "CoreKeyboard"
    InputDevice    "Synaptics Touchpad" "CorePointer"
    InputDevice    "Configured Mouse" "SendCoreEvents"
    Screen         "Default Screen" 0 0
EndSection

Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "jp106"
        Option          "XkbLayout"     "jp"
EndSection

Section "InputDevice"
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/input/mice"
        Option          "SHMConfig"             "true"
        Option          "MaxTapTime"            "0"
        Option          "HorizScrollDelta"      "0"
        Option          "VertScrollDelta"       "30"
        Option          "TapButton1"            "0"
        Option          "TapButton2"            "0"
        Option          "TapButton3"            "0"
EndSection

# In case you have USB mouse
Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
EndSection


Section "Device"
        Identifier      "Configured Video Device"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
EndSection

<!> Section "?InputDevice" with "Generic Keyboard" should be adjusted to your original localized configuration of xorg.conf generated by "sudo dpkg-reconfigure -phigh xserver-xorg". This example is for Japanese system.

You can configure your touch pad by installing "gsynaptics" package or similar. Under GNOME, you can access it from "System" -> "Preferences" -> "Touchpad".

As for missing mouse butons, see "Mouse 2nd and 3rd buttons". (I found relying on taps can get quite annoying. See below if you wish.)

Mouse 2nd and 3rd buttons

X level emulation

Left Apple key (keycode = 115, sometimes called left command key) may be used as replacements for mouse 2nd and 3rd buttons.

  • "Right click" by "Apple-key"
  • "Midle click" by "Shift-Apple-key"

This can be done by including following code in the ~/.xsessionrc start up script of your home directory:

/usr/local/bin/mousekeys &

and create startup script /usr/local/bin/mousekeys

# wait for some program, here gnome-pane
until ps -C gnome-panel >/dev/null; do sleep 1 ; done
# set xmodmap, DEL is Fn-Delete, BS is Delete
xmodmap - << EOF >/dev/null 2>/dev/null
keycode 115 = Pointer_Button3 Pointer_Button2
keycode 157 = KP_Equal
keycode  19 = 0 parenright 0 Scroll_Lock
keycode 215 = Print Sys_Req
keycode 216 = Insert
keycode 217 = Pause Break
EOF

This binds these keys to mouse keys and some missing keys. (You may execute these from X terminal emulators too.)

<!> Redifinition of "keycode 19" for normal "0" key is for Japanese keyboard. Please adjust these key redifinitions as you like.

For GNOME, enable mouse keys by keyboard from "System" -> "Preferences" -> "Keyboard" -> "Mouse Keys" -> "Allow to control the pointer using keyboard" : "check to enable".

Alternatively, you may use "xkbset m" command by installing the xkbset pacakage.

Alternatively, you can use Fn-F8(keycode = 215), Fn-F9(keycode = 216), and Fn-F10(keycode = 217) keys on system without keyboad light with:

xmodmap - << EOF
keycode 215 = Pointer_Button1
keycode 216 = Pointer_Button2
keycode 217 = Pointer_Button3
EOF

If you would like to use other keys, here's how to do it:

  • Start gnome-terminal
  • Run xev, it will display the X11 events it picks up
  • Locate the keycode of the key you want to use:
    • Press the key you want locate and locate the ?KeyPress event in gnome-terminal

    • Write down the keycode of the keyevent

  • Run xmodmap -e "keycode 115 = Pointer_Button3 Pointer_Button2" to update your keyboard map (for this login session only for test.)

Instead of using generic X startup code via ~/.xsessionrc, you may set it up via GNOME specific startup method: "System" -> "Preferences" -> "Sessions" -> "Startup programs" -> "Add" -> ...

<!> It is not wise to use ~/.xsession to add small X startup code since this requires you to create the full X startup code.

<!> "sleep" command in the startup script "/usr/local/bin/mousekeys" was needed to avoid running "xmodmap" command too early. Otherwise, I do not see "xmodmap -pke" reflecting changes. Somehow, mouse keys only were working and regular key redifinitions were not working.

Kernel level emulation

<!> This needs to be verified. (osamu, based on debian-jp ML)

Recent kernel comea with "?DeviceDrivers - Macintosh device drivers - Support for mouse button 2+3 emulation" enabled: CONFIG_MAC_EMUMOUSEBTN=y

Following command can enable Kernel level mouse button 2+3 emulation:

sysctl -w dev.mac_hid.mouse_button_emulation = 1
sysctl -w dev.mac_hid.mouse_button2_keycode = 116
sysctl -w dev.mac_hid.mouse_button3_keycode = 108

Here, "keycode = 116" is "Super_R" (Right-Apple) and "keycode = 108" is "KP_Enter" on US keyboard.

Synaptics touchpad for the new 2008 unibody Macbook and Macbook Pro

The new unibody MacBook Pro requires a new touchpad driver to work. This is discussed over at Ubuntu (http://ubuntuforums.org/showthread.php?t=840040). The driver bcm5974.ko is available here http://bitmath.org/code/bcm5974-dkms/. The snag is that there is no deb and installation is via the DKMS system (http://linux.dell.com/dkms/). But I managed it, so you almost certainly can.

First install git.

aptitude install git-core

Then download the latest source for the bcm5974 driver and the usbhid module, which you also need.

git clone http://bitmath.org/git/bcm5974-dkms.git

git clone http://bitmath.org/git/usbhid-dkms.git

You'll need to download the dkms too. I used the ubuntu deb at http://linux.dell.com/dkms/

dpkg -i dkms_2.0.20.4-0ubuntu1_all.deb

Then build a deb of the bcm5974 driver.

cd bcm5974-dkms/

Follow the instructions in the HACKING file, but not until the end.

make bump

You'll need debhelper and dpkg-dev installed to make the deb.

dpkg-buildpackage

cd ..

This makes the deb. Make the deb for the usbhid module.

cd usbhid-dkms/

make bump

dpkg-buildpackage

cd ..

Now you should have two packages which you can install. dpkg uses dkms to make the modules.

dpkg -i bcm5974-dkms_1.1.1_all.deb usbhid-dkms_0.11.1_all.deb

modprobe bcm5974 should load the module. Now all you need is to edit xorg.conf.

xorg.conf:

Section "Module"
   Load    "glx"
   Load    "synaptics"
EndSection

Section "InputDevice"
   Identifier      "Generic Keyboard"
   Driver          "kbd"
   Option          "CoreKeyboard"
   Option          "XkbRules"      "xorg"
   Option          "XkbModel"      "pc105"
   Option          "XkbLayout"     "gb"
   Option          "XkbOptions"    "lv3:rwin_switch,apple:badmap"
EndSection

Section "InputDevice"

   Identifier      "Synaptics Touchpad" Driver  "synaptics"
   Option  "SendCoreEvents"        "true"
   Option  "Device"                "/dev/input/mice"
   Option  "Protocol"              "auto-dev"
   Option  "SHMConfig"             "true"
   Option  "New AccelFactor"       "0.03"
   Option  "LeftEdge"              "0"
   Option  "RightEdge"             "1280"
   Option  "RightEdge"             "1280"
   Option  "TopEdge"               "0"
   Option  "BottomEdge"            "800"
   Option  "MinSpeed"              "0.94"
   Option  "MaxSpeed"              "1"
   Option  "AccelFactor"           "0.0015"
#tapping

   Option  "RTCornerButton"        "2"
   Option  "RBCornerButton"        "3"
   Option  "LTCornerButton"        "2"
   Option  "LBCornerButton"        "3"
   Option  "FingerHigh"            "30"
   Option  "FingerLow"             "20"
   Option  "MaxTapTime"            "150"
   Option  "FastTaps"              "0"
   Option  "TapButton1"            "1"
   Option  "TapButton2"            "2"
   Option  "TapButton3"            "3"
#edge scroll

   Option  "VertEdgeScroll"        "0"
   Option  "HorizEdgeScroll"       "0"
   Option  "VertScrollDelta"       "5"
   Option  "HorizScrollDelta"      "0"
#two finger scroll

   Option  "VertTwoFingerScroll"   "1"
   Option  "HorizTwoFingerScroll"  "1"
EndSection

Section "Device"
   Identifier      "Configured Video Device"
   Driver "nvidia"
EndSection

Section "Monitor"
   Identifier      "Configured Monitor"
EndSection

Section "Screen"
   Identifier      "Default Screen"
   Monitor "Configured Monitor"
EndSection

Section "ServerLayout"
   Identifier "Main Layout"
   Screen "Default Screen"
   InputDevice "Synaptics Touchpad"
   InputDevice "Generic Keyboard"
EndSection

This set up gives you tapping 1, 2, or 3 fingers for left, middle, and right clicks and two-finger scrolling.

Processor

CPU frequency scaling

CPU frequency scaling in kernel (basics)

CPU frequency scaling is governed by SPEEDSTEP_CENTRINO kernel module. You should also enable the acpi_cpufreq module and one of its methods cpufreq_ondemand or cpufreq_conservative.

echo speedstep_centrino >> /etc/modules
echo acpi_cpufreq >> /etc/modules
echo cpufreq_ondemand >> /etc/modules

Here, I chose the cpufreq_ondemand for responsiveness.

CPU frequency scaling in kernel (customization)

<!> For lenny, these do not seem to be needed anymore.

To avoid unnecessary overhead you can let kernel scale the CPU frequency automatically. Just load module cpufreq_ondemand or cpufreq_conservative. The ondemand-module is perhaps better choice if you want the system to be as responsive as possible.

Next add this to /etc/rc.local or to another startup script:

# Switch on "ondemand" CPUfreq governor
# This is more reliable and faster than using userspace governor and
# a userspace program to control CPU frequency.
# You have to do this for each CPU.
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# The "ondemand" governor in kernels prior to 2.6.22 something tend to
# have a bit high sampling rate, so we will modify it according to
# http://www.linuxpowertop.org/known.php
# This is not _required_, but reduces the amount of wake-up calls the
# processor makes each second
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
cat /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate

CPU frequency scaling in userspace

In case you want more complex CPU frequency scaling schemes, you can just load the module cpufreq_userspace, set it as default (see above) install powernowd or cpufreqd package for CPU frequency scaling. There are several other daemons available, but those two work quite well.

You can use gkfreq to monitor the CPU frequency in gkrellm (currently it only supports one processor but can be easily modified to support 2 cores - I have send a small patch to the maintainer) : http://www.peakunix.net/gkfreq/

CPU throttling

CPU throttling means forcing the processor(s) to idle for a certain amount of their time. When processor is not heavily loaded this saves battery but also slows the processor down. With 1st generation Macbook switching both cores to 50% throttling so that they are idle 50% of the time can give maybe 30-40 minutes of extra battery life. The Macbook is perfectly usable even both processors are running at 1Ghz (scaled down) and throttled to 50%. So in most cases, it's a good idea to use CPU throttling when using battery.

There are various ways to enable CPU throttling. It is probably easiest to use laptop-mode, and make sure that throttling is enabled in /etc/laptop-mode/laptop-mode.conf:

# Should laptop mode tools control the CPU throttling? This is only useful
# on processors that don't have frequency scaling.
# (Only works when you have /proc/acpi/processor/CPU*/throttling.)
CONTROL_CPU_THROTTLING=1
# Legal values are "maximum" for the maximum (slowest) throttling level,
# "minimum" for minimum (fastest) throttling level, "medium" for a value
# somewhere in the middle (this is usually 50% for P4s), or any value listed
# in /proc/acpi/processor/CPU*/throttling. Be careful when using "maximum":
# this may be _very_ slow (in fact, with P4s it slows down the processor
# by a factor 8).
BATT_CPU_THROTTLING=medium
LM_AC_CPU_THROTTLING=minimum
NOLM_AC_CPU_THROTTLING=minimum

Powertop

If you are serious about saving power, take a look at Powertop program. It is a very good interactive program that gives suggestions on how to minimize CPU wakeups. I was able to drop wakeups from around 1500 to roughly 400 with the aid of this program.

With up-to-date lenny/sid, it's possible to drop to around 100 wakeups (with wifi and compiz).

Infrared Receiver

Infrared receiver on MacBook is an HID device. For lenny,

  • lirc lirc_0.8.3-3_amd64.deb
  • lirc-modules-source lirc-modules-source_0.8.3-3_all.deb

Install them and follow their instruction.

iSight

On the Macbook (Pro) iSight might work with the linux-uvc driver. It is now part of linux-image-2.6.26, the default kernel for Lenny. In the initial black MacBook, it doesn't work.

Locate the firmware from MacOS X, and note the location, you will need this later:

# mount -t hfsplus /dev/sda2 /mnt/mac/
# ls /mnt/mac/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport

Now we install the needed packages:

# aptitude install module-assistant linux-uvc-source isight-firmware-tools

When installing isight-firmware-tools, debconf asks about the path to the firmware. Specify the location you have found above.

Once the source and tools are installed, you should have /lib/firmware/isight.fw . If not, something went wrong installing isight-firmware-tools.

To try to extract the firmware again (only do this if you don't have /lib/firmware/isight.fw ) :

# dpkg-reconfigure -plow isight-firmware-tools

Keep repeating this until you get the /lib/firmware/isight.fw .

# modprobe uvcvideo
# /etc/init.d/hal restart

Test it with Cheese.

# aptitude install cheese
$ cheese

If you see your face, iSight is probably working :).

Support of SMC

SMC means System Management Controller.

The gentoo wiki suggests loading the "applesmc" module, which works fine for me (albertl7). Among other things, t allows me to control the medium fan speed, which I increase because my Macbook gets so hot. I put this is rc.local:

echo "4000" > /sys/devices/platform/applesmc.768/fan1_min

The gentoo wiki has a different path, so it might be different on all the various Macbook computers. The higher fan speed makes more noise, but I'm comfortable with that.

Direct EFI Boot support

CONFIG_FB_IMAC support is for booting from ELILO (EFI). You are most probably using lilo/rEFIt to boot, using IMAC driver will make your screen appear scrambled. Use CONFIG_FB_I810 driver instead.

CPU Core Temperature Sensor

Model-specific register (MSR) can be used access CPU temperature sensor. You can use many standard applets to display temperature on lenny.

Resources

Primary resources

Mactel-Linux has mactel specific kernel patch and hardware tool resource. Its subversion archive can be seen at http://svn.sourceforge.net/viewvc/mactel-linux by the browser or retrieved by:

 $ svn co https://mactel-linux.svn.sourceforge.net/svnroot/mactel-linux mactel-linux

Helpful guide on compiling a mactel kernel: http://gentoo-wiki.com/HARDWARE_Apple_MacBook

Secondary resources

Smewhat outdated contents

Installation

How to change the kernel to amd64 if i386 Debian installed (MacBook Core 2 Duo)

<!> If you wish to have true 64 bit system, I recommend you to use amd64 installer to install a fresh system. The method described in the following only switches kernel to 64bit. The user land tool remains as i386 binaries. The title is correct but this is nothing more than that. If others agree, this section may be removed. (osamu)

Even if you installed debian i386, it is possible to install the amd64 kernel afterwards.

Install the amd64 kernel: Simply run

aptitude install linux-image-amd64

This should install the amd64 kernel and also update the LILO boot loader to automatically boot into amd64.

Reboot: Reboot to start the amd64 kernel.

VALIDATION: To validate that the amd64 kernel is running, run

uname -r

The output should be something like

2.6.18-5-amd64
  • [!!]This section below is not a problem anymore in Lenny Beta 2. Full resolution is supported in the default x.org

. TROUBLESHOOTING (1280x800 resolution is gone): Installing the amd64 kernel might disrupt the 1280x800 resolution. See the section Upgrade to resolution of 1280x800 for how to fix this. You will probably have to this manually. TROUBLESHOOTING (automatic update back to i686): After you have installed the amd64 kernel the old kernel i686 is still present and if you perform an automatic update under aptitude, the i686 might be updated and the LILO changed back to boot into the i686 kernel. It might therefore be advisable to remove the i686 kernel, see below. If you want to keep the i686 kernel but still boot into amd64, you can edit file /etc/lilo.conf and change the default variable to the amd64 image. You find valid values in the label entries and have to guess, which one is the amd64 image, because the names are not very instructive (it could be LinuxOLD, for example). After having changed the value, run lilo in a terminal to make the change active. Then reboot. It might also be an option to add

  •          prompt
             timeout=100

    to the configuration file (do not forget to run lilo afterwards). prompt tells LILO to start a menu that allows you to select either of the two kernels. timeout=100 tells LILO to automatically boot into the default kernel after 10 seconds. See man lilo.conf for details. However, also this suffers from the nasty dead-keyboard problem mentioned above, see TROUBLESHOOTING (dead keyboard), so that in most of the cases you get the menu, but you don't get the chance to use it, because the keyboard does not work.

Remove the i686 kernel: To avoid the problem that an automatic update brings you back to the i686 kernel (see TROUBLESHOOTING (automatic update back to i686) above) you can remove the i686 kernel from within aptitude. Run aptitude, search forward (press '/') for linux-image, mark for purge (press '_' and not '-') all installed packages that start with linux-image and end on 686, perform the purge (press 'g' twice). Finally, run lilo in a shell (if required).

. TROUBLESHOOTING (Couldn't find valid RAM disk): With recent amd64 kernel images (at least 2.6.26 and probably also 2.6.25), the initial ramdisk is too large to be properly supported by LILO (even when the option large-memory is set). A solution is to set

  • MODULES=dep

(instead of MODULES=most) in /etc/initramfs-tools/initramfs.conf, so that the initrd.img file gets smaller at (re-)installation of the linux-image-amd64 package (see 479607 for a discussion).

Gigabit Ethernet

Your kernel must have support for the Yukon Gigabit Ethernet driver known as sky2; this is available in Debian 4.0 Etch (or kernel 2.6.16 and above).

See 378521

Suspend and sky2

  • suspend (works, unload module sky2 before suspending; tested with kernel 2.6.20) (no longer necessary in kernel 2.6.26)

s2ram -f -p -m works (for some values of "work") with original macbook (sys_product = "?MacBook1,1" sys_version = "1.0" bios_version = "MB11.88Z.0061.B03.0610121324") kernel 2.6.21.3 and mactel patches rev 126. Resumes with backlight off but can turn back on with pommed (usually...), also external display resumes with DPMS disabled. Apparently Ubuntu got the backlight turned on when resuming, need to investigate how to solve this issue.

Configuring GRUB

(Laurenz Wiskott: I guess, this and the following section Switching to Grub should be integrated somehow by somebody who knows what (s)he is talking about.)

The GRUB included with Debian 4.0 Etch (GRUB 0.97-10 or greater) is compatible with MacBook if you configure proper MBR/GPT hybrid. Although it was possible to install GRUB during the initial d-i install with many manual fiddling processes of MBR/GPT synching, I recommend you to install LILO initially as above and install GRUB to /dev/sda3 and/or /dev/sda4 later for the ease of process and ease of updating kernel. "rEFIt " on OS X does not like anything other than MSDOS or HFS+ for file system description in GPT table when executing gptsync to create matching MBR record. So I marked Linux partitions as MSDOS before executing gptsync. I used both disked for GPT and fdisk for MBR. Once you marked the MBR with the proper file system type (eg. 83), GRUB is happy to boot Debian by looking into FS and finding files.) Here is an example of /boot/grub/menu.lst for dual booting 486 and amd64 systems:

  • timeout 10
    default 0
    fallback 1
    # For booting GNU/Linux (For frozen keyboard)
    title  GNU/Linux64-safe
    root (hd0,2)
    kernel /boot/vmlinuz-2.6.18-4-amd64 root=/dev/sda3
    initrd /boot/initrd.img-2.6.18-4-amd64
    # For booting GNU/Linux
    title  GNU/Linux64
    root (hd0,2)
    kernel /vmlinuz root=/dev/sda3
    initrd /initrd.img
    # For booting GNU/Linux
    title  GNU/Linux64.old
    root (hd0,2)
    kernel /vmlinuz.old root=/dev/sda3
    initrd /initrd.img.old
    # For booting GNU/Linux
    title  GNU/Linux32
    root (hd0,3)
    kernel /vmlinuz root=/dev/sda4
    initrd /initrd.img
    # Change the colors.
    title Change the colors
    color light-green/brown blink-red/blue

(Linux kernel is GPT-aware thus the swap partition maybe located in places such as /dev/sda7)

You can use grub to set this up for you. After installing grub (see below), simply run grub-install and update-grub to generate /boot/grub/menu.lst:

grub-install "(hd0)"
update-grub

Switching to Grub

To switch to grub you first need to change the partition type to linux. You can do this by using sfdisk to dump the partition information to a text file. Editing it to change the partition type, and then using sfdisk to save that to the partition table.

sfdisk -d /dev/sda > sda.out

edit sda.out and change the id to 83 (linux) as in the below

# partition table of /dev/sda
unit: sectors
/dev/sda1 : start=        1, size=   409639, Id=ee
/dev/sda2 : start=   409640, size= 83886080, Id=af
/dev/sda3 : start= 84295720, size= 68953126, Id=83, bootable
/dev/sda4 : start=153248846, size=  3052609, Id=82

Now mount a usb drive if possible in case you made a mistake somewhere so that you can save recovery data.

Warning!!: this next line can wipe out your partition table if you made a mistake. It might be a good time to look at the sfdisk manual if you aren't sure what this does. It may be possible to undue unspeakable damage with the hdd-partition-sectors.save file so long as you can access it, which you might not be able to do if you saved it to the disk you are editing rather than the recommended usb disk.

sfdisk /dev/sda -O /media/usbdisk/hdd-partition-sectors.save < sda.out

In case sfdisk does not work for you (complains about not being able to make the kernel reread the partition table because a partition is mounted, or mismatching start/end partition boundaries) you can alternatively use fdisk to change the partition type. Use "p" to list partitions, "t" to change partition type, and "w" to write the table back to disk.

Then you can install grub 'aptitude install grub', and run 'grub-install "(hd0)"' and 'update-grub'.

Once grub is installed you need to edit /etc/kernel-img.conf so that when you install a kernel image it doesn't also replace grub with lilo.

As per (zless /usr/share/doc/grub/README.Debian.gz) set to the following.

postinst_hook = /usr/sbin/update-grub
postrm_hook = /usr/sbin/update-grub
do_bootloader = no

Video

Note that kernel 2.6.23.1 somehow breaks the external display with stable i810 X.org - but works fine in 2.6.26.

915resolution now works automatically; the below (old) instructions show how to do it manually, but this is no longer necessary:

Upgrade to resolution of 1280x800 (for sarge)

<!> Not required in Lenny, x.org now supports the card properly

After installation of Debian, there will be only very few screen resolutions available, e.g. only 1024x768, 800x600, and 640x480 (1024x768 is the biggest normal size that fits the screen). The resolution of the screen of a MacBook (Intel 915, video chipset 945GM) is 1280x800 and rescaling the 1024x768 display to 1280x800 results in a fuzzy and distorted picture.

To get support for the 1280x800 resolution you have to install the 915resolution package.

Install 915resolution: As root run

aptitude install 915resolution

915resolution should automatically set the correct video mode for 1280x800 and configure X properly.

Restart X: Press Ctrl-Alt-Backspace to restart X, but close any sensitive application first.

If it works and you get high resolution, you should see it right away from the more focussed image. You can also check it under Main menu -> Desktop -> Preferences -> Screen resolution.

  • TROUBLESHOOTING (automatic setup did not work): If the automatic setup of 915resolution did not work for some reason (happened once after upgrading to amd64), you can set it up manually. Edit file /etc/defaults/915resolution and set the following variables.

    MODE=5c
    XRESO=1280
    YRESO=800
    BIT=32
    To check whether it works, run
    /etc/init.d/915resolution start
    • as root and then restart X by pressing Ctrl-Alt-Backspace (but first close all sensitive applications). If you get the high resolution, reboot to test whether it also works automatically during boot.

aptitude install 915resolution
915resolution -c 945 54 1280 800

then edit /etc/default/915resolution

#
# 915resolution default
#
# find free modes by  /usr/sbin/915resolution -l
# and set it to MODE
# e.g. use MODE=54
MODE=54
#
# and set resolutions for the mode.
# e.g. use XRESO=1024 and YRESO=768
XRESO=1280
YRESO=800
#
# We can also set the pixel mode.
# e.g. use BIT=32
# Please note that this is optional,
# you can also leave this value blank.
BIT=32

Adjust the Monitor section of /etc/X11/xorg.conf

Section "Monitor"
        Identifier      "Color LCD"
        Option          "DPMS"
        HorizSync       28-64
        VertRefresh     43-60
        Modeline "1280x800@60" 83.91 1280 1312 1624 1656 800 816 824 841
EndSection

and make sure the Screen sections uses "1280x800" as default resolution in the Modes lines and finally

/etc/init.d/915resolution start

Sound for etch and early testing of lenny

ALSA driver snd_hda_intel works for playback as of 2.6.18-rc1.

MacBook with Debian 4.0 Etch has no problem with sound. Although, you may need to run alsaconf as root.

If you hear any distortions even when all of the mixer settings are at least 20% below their maximum, it might help to load snd-hda-intel with the 'position_fix=1' option. In the file /etc/modprobe.d/alsa-base, change the line

install snd-hda-intel /sbin/modprobe --ignore-install snd-hda-intel $CMDLINE_OPTS && /lib/alsa/modprobe-post-install snd-hda-intel

to

install snd-hda-intel position_fix=1 /sbin/modprobe --ignore-install snd-hda-intel $CMDLINE_OPTS && /lib/alsa/modprobe-post-install snd-hda-intel

The microphone requires mactel patches and the following to activate (with original macbook, kernel 2.6.21.3 and mactel patches rev 126):

amixer sset 'Input Source' Line; amixer sset 'Input Source' Mic; amixer sset Mux 20.00dB

The microphone did not worked on debian testing with kernel 2.6.21. However I made it work by compiling alsa from subversion (as of 12/08/07) on kernel 2.6.21 without mactel patches.

Mixer channels are as follows (with original macbook, kernel 2.6.21.3, and mactel patches rev 126):

Master: Builtin tweeter level.  No effect on heaphones.
PCM: Master volume for speakers and headphones.  This is the channel controlled by pommed.
Front: Builtin woofer level.   Headphone level.
Surro..:  ?
Line In as Output: ?
IEC958: ?
Capture: ?
Input Source: ?  See above for builtin mic.
Mux: ?  See above for builtin mic.

Optical drive analog CD audio output doesn't appear to work (with original macbook, kernel 2.6.21.3, mactel patches rev 126, xmcd 2.6-19.1).

Important note for the headphones sound : the Surround volume controls the headphones sound; thus, in order to have sound in your headphones after plugging them into the laptop, you have to unmute the Surround volume and set it higher (you can set it at maximum) (you can use alsamixer for example : type alsamixer in a console, go to the 'Surround' volume with the 'right' and 'left' arrow keys, push the 'm' key until you see 'OO' instead of 'MM' and after that push the 'up' arrow key to set the volume higher)

Important note for new Macbook Users : since late 2007, macbooks have used the santa rosa platform as their chipset, consequently sound doesn't work out of the box with Etch, or Testing. Support is included in 2.6.24 kernel, however, it fails to auto-detect the chipset. You must edit /etc/modprobe.d/sound and add the following line:

 options snd-hda-intel model=mbp3 

Sound on ?MacBook2,1 distorted (sudo dmidecode -s system-product-name): Either a lack of sound, or distorted sound through one or both channels has been experienced on these macbooks. The fix seems to depend on the kernel version. In /etc/modprobe.d/sound try the following configs, removing and reloading the module after each change (rmmod snd_hda_intel && modprobe snd_hda_intel). Note, gnome-mixer and pulse audio will commonly prevent the unloading of these modules. To test run speaker-test -c2 -twav:

#<=2.6.26
options snd_hda_intel model=intel-mac-v3 position_fix=1

or

#==2.6.28
options snd_hda_intel model=intel-mac-auto position_fix=2

Synaptics Touchpad information for pre-lenny systems

<!> Although contents in this section are quite rich and interesting, these are old information which may not be exactly applicable to new lenny and later systems.

With 7.3 version of x.org and linux 2.6.22, it should work out of the box: the tapping of touchpad with two fingers should generate a middle-button click and tapping it with three fingers will generate a right-button click. Please see below more information if you wish to re-configure it.

For older versions, you need to have a kernel with at least:

  • CONFIG_INPUT_MOUSEDEV_PSAUX=y
  • CONFIG_INPUT_EVDEV=y
  • CONFIG_USB_HID=m
  • CONFIG_USB_APPLETOUCH=m

Afterwards, edit /etc/X11/xorg.conf and in the Module section, add the following line:

        Load "synaptics"

If you want to use the Synaptics touchpad you may also need to add these lines to /etc/modprobe.d/

install usbhid /sbin/modprobe appletouch; /sbin/modprobe --ignore-install usbhid $CMDLINE_OPTS

Then add  appletouch  to /etc/initramfs-tools/modules and then run  update-initramfs 

This is just a tip for configuring the synaptics touchpad. You have to install the synaptics driver for Xorg for enabling the touchpad.

---

If you just want to reconfigure it with synaptics:

1. Add "synaptics" module in the module section. 2. If not present, add the correct identifier of the touchpad in the ?ServerLayout section. 3. Proceed with the guide.

One possible setup:

Replace the contents of the ?InputDevice section with the "Configured Mouse" identifier with the following: (from the ?AppleTouch driver site http://www.popies.net/atp/)

    Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "synaptics"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "auto-dev"
        Option          "LeftEdge"              "0"
        Option          "RightEdge"             "850"
        Option          "TopEdge"               "0"
        Option          "BottomEdge"            "645"
        Option          "MinSpeed"              "0.4"
        Option          "MaxSpeed"              "1"
        Option          "AccelFactor"           "0.02"
        Option          "FingerLow"             "55"
        Option          "FingerHigh"            "60"
        Option          "MaxTapMove"            "20"
        Option          "MaxTapTime"            "100"
        Option          "HorizScrollDelta"      "0"
        Option          "VertScrollDelta"       "30"
        Option          "SHMConfig"             "on"
    EndSection

Another possible setup:

On my configuration, I set one finger tap on the pad = right mouse click and two finger tap = middle mouse click, I have disabled the two finger scrolling and let the vertical right edge scrolling. Here is the mouse section of my xorg.conf :

Section "InputDevice"
  Identifier      "Synaptics Touchpad"
  Driver          "synaptics"
  Option          "SendCoreEvents"        "true"
  Option          "Device"                "/dev/psaux"
  Option          "Protocol"              "auto-dev"
  Option          "SHMConfig"             "true"
  Option          "New AccelFactor"       "0.03"
  Option          "LeftEdge"              "100"
  Option          "RightEdge"             "1120"
  Option          "TopEdge"               "50"
  Option          "BottomEdge"            "310"
  Option          "FingerHigh"            "30"
  Option          "MinSpeed"              "0.94"
  Option          "MaxSpeed"              "1"
  Option          "AccelFactor"           "0.0015"
  Option          "FingerLow"             "20"
  Option          "HorizScrollDelta"      "0"
  Option          "MaxTapTime"            "150"
  Option          "TapButton1"            "3"
  Option          "TapButton3"            "0"
  Option          "VertEdgeScroll"        "1"
  Option          "HorizEdgeScroll"       "1"
  Option          "VertScrollDelta"       "5"
  Option          "VertTwoFingerScroll"   "0"
  Option          "HorizTwoFingerScroll"  "0"
EndSection

Yet another possible setup here...

  • Left click with only the button, no tapping (as in OS X). Reduces accidental cursor jumping + clicking which can drive one nuts.
  • Tapping upper left corner = Middle click
  • Tapping upper right corner = Right click
  • Sliding across right edge of the touchpad = Scroll up and down

Section "InputDevice"
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "AlwaysCore"
       #Option          "Device"                "/dev/input/by-id/usb-Apple_Computer_Apple_Internal_Keyboard_._Trackpad-mouse"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "auto-dev"
        Option          "HorizScrollDelta"      "0"
        Option          "SHMConfig"             "true"
        Option          "TouchpaddOff"          "0"
        # How fast the two-finger scrolling scrolls. The lower, the faster.
        Option          "VertScrollDelta"       "25"
        Option          "HorizScrollDelta"      "25"
        # Location of the touchpad edges, somewhat sane values
        # that I found by testing. Xmin=0, Xmax=1216, Ymin=0,Ymax=387
        Option          "LeftEdge"              "100"
        Option          "RightEdge"             "1116"
        Option          "TopEdge"               "50"
        Option          "BottomEdge"            "337"
        # Touch and "untouch" thresholds
        Option          "FingerLow"             "25"
        Option          "FingerHigh"            "50"
        # We DO NOT want palm triggering middle/right mouse
        # button events, so a tap has to be quite fast
        Option          "MaxTapTime"            "100"
        Option          "MaxTapMove"            "100"
        Option          "MaxDoubleTapTime"      "200"
        # Enable vertical (right) edge scrolling with one finger
        Option          "VertEdgeScroll"        "1"
        # Enable horizontal (bottom) edge scrolling with one finger
        Option          "HorizEdgeScroll"       "0"
        # Disable two finger scrolling, as we have the edge scrolling enabled already
        Option          "VertTwoFingerScroll"   "0"
        Option          "HorizTwoFingerScroll"  "0"
        # Left top corner of the touchpad shall be the middle mouse button
        # Bottom buttons tend to get triggered accidentally.
        Option          "LTCornerButton"        "2"
        # Right top corner of the touchpad shall be the right mouse button
        Option          "RTCornerButton"        "3"
        # Disable bottom corners
        Option          "LBCornerButton"        "0"
        Option          "RBCornerButton"        "0"
        # Fast taps
        Option          "FastTaps"              "0"
        # Disable tapping of the touchpad (excluding the corners, of course)
        Option          "TapButton1"            "0"
        Option          "TapButton2"            "0"
        Option          "TapButton3"            "0"
        # Movement speed settings
        Option          "MinSpeed"              "0.2"
        Option          "MaxSpeed"              "0.6"
        Option          "AccelFactor"           "0.35"
        # Palm detection. Does not seem to work on Macbook
        Option          "PalmDetect"            "1"
        Option          "PalmMinWidth"          "10"    #1-15
        Option          "PalmMinZ"              "200"   #1-255
        # Various other variables
        Option          "UpDownScrolling"       "0"
        Option          "LeftRightScrolling"    "0"
EndSection

To find out about the synaptics options, see synaptics(5).

It's advisable to run syndaemon after starting X, to prevent accidental taps while you're typing.

  • example: syndaemon -i 2 -t -d

If you have problems with the old etch kernel (2.6.18), you can work around this by editing appletouch.c and rebuild the kernel:

1. Open /usr/src/your-linux-source/drivers/usb/input/appletouch.c and replace probably unused PRODUCT ID of older Japanese MacBook model:

#define GEYSER3_JIS_PRODUCT_ID  0x0219

with your MacBook ?Core2Duo one (For English model, in newer source as GEYSER4_ANSI_PRODUCT_ID 0x021A)

#define GEYSER3_JIS_PRODUCT_ID  0x021A

2. Now rebuild the kernel and reboot.

Now synaptics should work fine with all options for English ?Core2Duo model. (without this work around, it should work without tapping and scrolling). New 2.6.25 kernel in lenny should be fine without this kind of workaround for all ?Core2Duo models.

Infrared Receiver before lenny

Use the usual HID device; kernel patch available as of 2006-07-17.

If the appleir driver is also compiled as a module, change the line described in the keyboard section of this page to the following, so appletouch and appleir get loaded before usbhid:

install usbhid /sbin/modprobe appletouch; /sbin/modprobe appleir; /sbin/modprobe --ignore-install usbhid $CMDLINE_OPTS

Also add appleir to /etc/initramfs-tools/modules and re-run update-initramfs.

How to get the remote working in 10 steps :

1)I have downloaded this patch http://www.madingley.org/macmini/kernel/ir.patch and copied each piece of it into my kernel sources (most of it goes into appleir.c)

2)After that I have added "CONFIG_USB_APPLEIR=m" at the section "USB HID Boot Protocol drivers" in the .config file from the kernel source.

3)I have recompiled and installed the modules.

4)I have added "appleir" to /etc/modules to have it loaded at boot.

5)Reboot. If after reboot, the command

lsinput 2>&1 | grep "Mac mini"

does not give you any output, add the following line in /etc/modprobe.d/appleir :

install usbhid /sbin/modprobe appletouch; /sbin/modprobe appleir; /sbin/modprobe --ignore-install usbhid $CMDLINE_OPTS

and reboot.

6)I have installed lirc and lirc-x with apt-get

7)I have created /etc/lirc/lircd.conf with some infos found on the web :

# this config file was automatically generated
# using lirc-0.8.0(userspace) on Fri Oct 20 01:12:42 2006
#
# contributed by Michael Olson
#
# brand:                       APPLE_REMOTE
# model no. of remote control:
# devices being controlled by this remote: 1
#
  begin remote
    name  APPLE_REMOTE
    bits            8
    eps            30
    aeps          100
    one             0     0
    zero            0     0
    gap          135863
    pre_data_bits   24
    pre_data       0x800100
    toggle_bit      0
    begin codes
     KEY_MENU 0x8B
     KEY_PP 0xA4
     KEY_N 0xA3
     KEY_P 0xA5
     KEY_VU 0x73
     KEY_VD 0x72
    end codes
 end remote

8)I have changed the following lines in /etc/lirc/hardware.conf :

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="dev/input"
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will
# be
# automatically used instead
DEVICE="/dev/input/event1"
MODULES=""
# Default configuration files for your hardware if any
LIRCD_CONF="/etc/lirc/lircd.conf"

The tricky part is that /dev/input/event1 is not correct, so we have to generate the correct input event at each reboot. I have installed "lsinput" and modified the startup script /etc/init.d/lirc, by adding the following lines just before ". /etc/lirc/hardware.conf" :

mac_input=$(lsinput 2>&1 | grep -B 5 "Mac mini" | head -n 1)
sed -i "s;DEVICE=\".*\";DEVICE=\"$mac_input\";" /etc/lirc/hardware.conf

Now everything should be fine.

9)To test if it works, write into ~/.lircrc :

  begin
    flags = startup_mode
    mode = irexec
  end
  begin irexec
    begin
     prog = irexec
     remote = APPLE_REMOTE
     button = KEY_N
     config = xmms
     repeat = 0
    end
  end irexec

and start irexec with "irexec -d".

Now if you press the "next" key on the remote it should open xmms (if you have it installed).

10) I have attached to this page my .lircrc file (see the attachments); Don't forget to start the irxevent and irexec with 'irxevent -d & irexec -d'. Feel free to copy and modify it as you wish. The config file uses 2 other scripts (also attached to this page), named show.sh and show_volume.sh; The scripts are displaying information on the screen as you play with your remote; you will also need to install xosd.

CPU Core Temperature Sensor (manual methods)

  • - cpu temperature found through CPU MSR feature

tool available from: http://mactel-linux.svn.sourceforge.net/viewvc/mactel-linux/trunk/tools/temperature/

You need to load the msr module before using the coretemp tool : modprobe msr, or put msr in /etc/modules to make the module load on every boot.

Download Makefile and coretemp.c.

$ make
$ sudo ./coretemp
CPU 0: 69 C
CPU 1: 69 C
  • - hddtemp package provides support for hdd temperature monitoring

$ sudo hddtemp /dev/sda
/dev/sda: ST98823AS: 38°C
  • - I2C sensor is detected but not sure if it's functional

Note: no sensors are detected below, just EEPROMs.

MacBook contains the 82801G (ICH7 Family) and ICH7 is supported by lm_sensors since sensors 2.9.0 by the i2c-i801 kernel driver which has been in the kernel since 2.6.11.

# sensors-detect revision 1.413 (2006/01/19 20:28:00)
...
Probing for PCI bus adapters...
Use driver `i2c-i801' for device 00:1f.3: Intel ICH7
Probe succesfully concluded.
We will now try to load each adapter module in turn.
Module `i2c-i801' already loaded.
If you have undetectable or unsupported adapters, you can have them
scanned by manually loading the modules before running this script.
 To continue, we need module `i2c-dev' to be loaded.
 If it is built-in into your kernel, you can safely skip this.
 i2c-dev is not loaded. Do you want to load it now? (YES/no): yes
 Module loaded succesfully.
 We are now going to do the adapter probings. Some adapters may hang halfway
 through; we can't really help that. Also, some chips will be double detected;
 we choose the one with the highest confidence value in that case.
 If you found that the adapter hung after probing a certain address, you can
 specify that address to remain unprobed. That often
 includes address 0x69 (clock chip).
Next adapter: SMBus I801 adapter at efa0
Do you want to scan it? (YES/no/selectively):
Client found at address 0x08
Client found at address 0x38
Probing for `Philips Semiconductors SAA1064'... Failed!
Client found at address 0x3a
Probing for `Philips Semiconductors SAA1064'... Failed!
Client found at address 0x44
Probing for `Maxim MAX6633/MAX6634/MAX6635'... Failed!
Client found at address 0x50
Probing for `SPD EEPROM'... Success!
    (confidence 8, driver `eeprom')
Probing for `DDC monitor'... Failed!
Probing for `Maxim MAX6900'... Failed!
Client found at address 0x52
Probing for `SPD EEPROM'... Success!
    (confidence 8, driver `eeprom')
Client found at address 0x69
....
Driver `eeprom' (should be inserted):
  Detects correctly:
  * Bus `SMBus I801 adapter at efa0'
    Busdriver `i2c-i801', I2C address 0x50
    Chip `SPD EEPROM' (confidence: 8)
  * Bus `SMBus I801 adapter at efa0'
    Busdriver `i2c-i801', I2C address 0x52
    Chip `SPD EEPROM' (confidence: 8)
I will now generate the commands needed to load the I2C modules.
To make the sensors modules behave correctly, add these lines to
/etc/modules:
#----cut here----
# I2C adapter drivers
i2c-i801
# I2C chip drivers
eeprom
#----cut here----
# uname -a
Linux coreduo 2.6.18-rc1dancer #2 SMP Sun Jul 9 09:57:01 JST 2006 i686 GNU/Linux