- What is a MacBook
- Installation Overview
- Debian installation
- Boot Loader
- Cross-mount file systems
- Devices that work
- Backlight + Volume + CD Eject button
- Synaptics Touchpad
- Infrared Receiver
- Support of SMC
- Direct EFI Boot support
- CPU Core Temperature Sensor
- See also
What is a MacBook
MacBook is a series of laptop PCs sold by Apple Inc. There are several different models with different internal hardwares.
You can find the version of a MacBook in the "About this Mac" menu in OSX, or dmidecode output from Linux.
See the list of MacBooks.
- Update OS X. It's always good to start from a clean, backed-up and up-to-date install of OS X.
- Partitioning Disks.
- Installing Debian.
- Configuring a boot manager.
Post-install Debian configuration specific for ?MacBooks.
See also: InstallingDebianOn/Apple
Single boot (Debian only)
It is advisable to leave OS X installed, as the computer's firmware can only be updated from OS X.
This requires you to set up system with EFI bootloader. We should see this happen real soon for squeeze.
Double boot - Mac OS X & Debian
A clean install of Mac OS X will create three drive partitions:
- EFI: a 200 MB partition at the beginning of the disk.
- OS X: an HFS+ partition that includes OS X and user space.
- Recovery HD: A 600 MB recovery partition that includes the OS X installer and basic utilities.
To run Debian, you will want two partitions: one for the Debian OS, and one for swap space for Debian. You will shrink the OS X partition, so decide how much space you want to give your OS X and Debian partitions. See this table on deciding swap space size.
If you would like a shared partition between OS X and Debian, consider creating a partition now. Also see the Cross-mount file systems below.
Reboot your computer, holding down Command+R to enter Recovery Mode. In the File Menu, select Utilities > Disk Utility. Select the hard drive entry, and enter the Partition tab. Shrink the OS X partition (by default named "Macintosh HD") and create the Debian OS and Debian swap partitions.
If you experience errors like "you can't perform this resize unless it has a booter" when attempting to resize the OS X partition, change the volume from CoreStorage to HFS+
Get an installer image: To install Debian, you will need an installer image to boot from, either on a CD, DVD, or USB stick.
Debian offers various installer images. The network install is a minimal image containing few packages. Other other packages are downloaded as needed from the internet. This works well if you have a wired ethernet connection. As new Macs don't have an on-board ethernet port, an ethernet-to-thunderbolt adaptor will be required and will work during the Debian install process.
Get the amd64 image which works with Macbook 2007+ architecture. Mount the image onto a mountable physical volume (CD, DVD or USB stick). Here are instructions for mounting an ISO image onto a USB stick.
Insert the Debian install volume into your computer and hold down the Option key while booting. This will bring up the OS X Startup Manager. Select the Debian installation drive.
When asked, install Debian via the Graphical Install. The Expert Install provides more options, but are unnecessary for most users.
Follow along through the installation screens.
When asked to Partition Disks, configure Debian to use the partitions created previously. The Debian OS partition should mount as the system partition in the / location on the filesystem, and the swap space partition should be configured as well. ext4 is a good default for filesystem.
Also consider creating a partition for exchanging data between Linux and Mac OS X, see Section Cross-mount file systems below.
In Software Selection screen, you should select a desktop environment, which will be the windowing, graphical user interface for interacting with the operating system.
Continue through the install until complete.
Debian installs GRUB, a boot manager and loader, on the hard drive's EFI partition. Debian also configures the computer's firmware to open the GRUB boot manager instead of entering directly into the Mac OS X boot loader.
A boot manager, on computer start-up, lets the user decide which operating system to load. If you are planning on dual booting OS X and Debian, this is the easiest way to manage this process.
On installation, Debian sets GRUB as the default boot manager and boot loader. Turning on the computer will start GRUB, and start Debian. OS X can be booted by holding down the Option key at power on and entering OS X from Apple's Startup Manager. Some find this a usable way to control booting between OSes.
If you want a more user-friendly boot manager, rEFInd is a boot manager which presents a screen to select which operating system to boot at power on. rEFInd works out-of-the-box after installation with OS X and Linux installs on the machine.
If you will use rEFInd as rEFInd for boot management, disable the GRUB boot manager which Debian configured by resetting the computer's NVRAM (hold Command, Option, P and R when turning on the computer). The Linux kernel doesn't require a separate boot loader since version 3.3, so you can also remove the GRUB boot loader from the EFI partition.
To install rEFInd, download the latest stable version on the SourceForge project page onto your Macintosh HD. Restart your computer in Recovery Mode (hold Command and R when booting), and open a Terminal. Navigate to the rEFInd folder, and run the bundled install script (Also see Installing rEFInd). When you restart your computer, the rEFInd screen will come up, allowing you to boot into OS X or Debian.
[!!] Finish the installation: Remove the ejected installation CD and select <Continue>. During reboot select Linux from the Mac rEFIt menu.
GRUB as bootloader
Installing lenny using GRUB
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
Switching from LILO to GRUB
If you wish to switch from lilo to GRUB:
First, please read and understand some basics at: Debian Reference: 3.3. Stage 2: the boot loader.
Second, make rescue media (a rescue CD) using grub-rescue-pc.
Consider installing os-prober package to ease GRUB configuration.
The package to use is the grub-pc package, which uses GRUB 2. (GRUB Legacy is no longer supported.)
The most delicate part of installing operating systems, other than drive partitioning (which can destroy data), is configuring the boot loader, which can render your system unbootable. Best practice has been changing with improved development of GRUB and supporting software.
Currently the best stable (lenny and squeeze) configuration is:
This allows multi-booting to Linux, Mac OS X, and Windows, yields accelerated hardware, and does not require LILO to be run every time a kernel or init ramdisk change occurs. For squeeze installer, this is the default.
Example: If you install Debian on /dev/sda3, install grub on /dev/sda3 (instead of /dev/sda) and run gptsync in rEFIt on next reboot. You will find a Linux boot option in rEFIt menu and selecting Linux will load GRUB.
In future, but not in squeeze, it may be able to use:
This is supposed to be simpler to rEFIt + GRUB 2 (BIOS version), but it may lack 3D acceleration.
In the past, (etch?), pratice was:
- chain loading by first loading rEFIt (in EFI), then using LILO.
This worked, but had the usual limitations of LILO (system wouldn’t boot if forgot to run lilo after kernel changes, etc.), and was necessary because GRUB Legacy does not support Macbooks.
Any OS can be selected as default if you use GRUB 2 in EFI, or rEFIt then the BIOS version of GRUB 2 (so long as Linux is the first non-Mac partition).
See IntelMac/BootLoader for further details.
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 -aThen 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
$ cd /Volumes $ mkdir Linux_Home $ sudo fuse-ext2 /dev/disk0s5 Linux_Home/
You should now see your partition in the finder.
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 works 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)
- USB usual EHCI, UHCI stuff
In addition to these, the following features work for lenny with kernel from backports.org (kernel 2.6.30):
- Free wireless driver for atheros (works out of box in 2.6.30)
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.
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 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"
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
You can use the Color Profile from Mac OS X. Copy *.icc from /Library/ColorSync/Profiles/Displays/.
Install xcalib and enable the Color Profile:
Alternatively, install argyll and enable the Color Profile:
Xcalib has more flexible options to e.g. inverse screen or setup night vision, whereas dispwin supports xrandr so can calibrate secondary screen.
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.
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.
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.
Remark by some other author: Instead of "it" (Italian layout), you might want to choose your layout). Also, more important, I had to insert:
Section "InputDevice" ... ... ... Option "XkbVariant" "mac" ... ... ... EndSection
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.
For squeeze users, xorg has changed the way they handle the keyboard settings. There is a unified config file for xorg and console keyboard settings (xorg.conf keyboard entry will be ignored in most cases). Therefore, you should try to edit the file /etc/default/keyboard. For example, when using a french mac layout, the file should look like this:
XKBMODEL="pc105" XKBLAYOUT="fr" XKBVARIANT="mac" XKBOPTIONS="lv3:rwin_switch"
More Over, level 3 switch might not work currently, due to bug 531771. You can circumvent it by replacing /usr/share/X11/xkb/symbols/pc with this file (be aware that an update of the xkb-data package might erase your changes, so having a backup might help).
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).
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.)
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".
The touchpad is made by Synaptics, and should work out of the box. However, you may wish to configure it in various ways, notably:
- turning off “Tapping” (tap keypad to click)
- allow right/middle button clicking via certain tapping or key combinations
- other changes – deactivate when typing, allow scrolling, multi-finger tapping, etc.
Configuration can be found (once the package is installed) in the menu at:
System > Preferences > Touchpad
Using gsynaptics requires adding one line to /etc/X11/xorg.conf as follows. Add the line:
Option "SHMConfig" "true"
to the Synaptics Touchpad section. For example, the following section works:
Section "InputDevice" Identifier "Synaptics Touchpad" Driver "synaptics" Option "SendCoreEvents" "true" Option "Device" "/dev/input/mice" Option "SHMConfig" "true" EndSection
You should now be able to use the configuration dialog.
Remark by some other author: For me, this did not work. I had to insert one extra line, see below:
Section "InputDevice" ... ... ... Driver "synaptics" Option "CorePointer" "true" Option "SendCoreEvents" "true" ... ... ... EndSection
SHMConfig is turned off because it is a security hole (a malicious user can track and control your pointer); see mjg59: Why SHMConfig is off by default. Alternatives to using SHMConfig now exist (using xinput), but are not (to my knowledge) supported by a GNOME GUI.
Alternatively, you can manually configure the touchpad by editing /etc/X11/xorg.conf as described below. This is documented in the synaptics(5) man page, which is accessible by typing:
man 5 synaptics
For reference, see also:
SynapticsTouchpad at Ubuntu wiki
Synaptics TouchPad driver for XOrg/XFree86 – driver homepage
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 a 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".
If you insist to have "tap to click" feature enabled but wish to prevent accidental taps while you're typing, it is advisable to run syndaemon after starting X with something like following command:
$ syndaemon -i 2 -t -d
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 for lenny
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 as:
and create startup script /usr/local/bin/mousekeys as:
# wait for some program, here gnome-panel 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) Under new X system of recent Ubuntu jaunty and Debian squeeze, this may be your only option.
Recent kernel comea with "?DeviceDrivers - Macintosh device drivers - Support for mouse button 2+3 emulation" enabled: CONFIG_MAC_EMUMOUSEBTN=y
Following entries in /etc/sysctl.conf can enable Kernel level mouse button 2+3 emulation:
dev.mac_hid.mouse_button_emulation = 1 dev.mac_hid.mouse_button2_keycode = 116 dev.mac_hid.mouse_button3_keycode = 108
You may run each of these lines as an argument to "sysctl -w", but without the spaces. Example sysctl -w dev.mac_hid.mouse_button_emulation=1
Here, "keycode = 116" is "Super_R" (Right-Apple) and "keycode = 108" is "KP_Enter" on US keyboard.
Alternatively, you may pick "keycode = 115" for "Super_L" (Left-Apple) and "keycode = 209" for "Hiragana_Katakana" on JPN keyboard.
Touchpad for the new 2008 unibody Macbook and Macbook Pro
Note: this infomation is too old. bcm5974 is already in to Linux kernel from 2.6.27.
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_126.96.36.199-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
This should install and load the module. Now all you need is to edit 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.
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 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
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 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.
Although linux kernel supports the iSight device with linux-uvc driver, sometimes the iSight device on (older Tiger ?) ?MacBooks requires firmware binary blob to be loaded while it is intialized.
MacBook 1,1 (originally Tiger)
MacBook 2,1 (originally Tiger)
Here is the method to extract required firmware blob from MacOS Tiger partition. Please note MacOS Finder will not see these files.
Locate the firmware from MacOS X terminal console shell or Linux, and note the location, you will need this later:
# mkdir -p /MacOSX # mount -t hfsplus /dev/sda2 /MacOSX # ls /MacOSX/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport
Note firmware driver from MacOS X 10.6 (Snow Leopard) may not work with isight-firmware-tools.
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. For squeeze, neither module-assistant nor linux-uvc-source are needed since it uses linux-image-2.6.32-5.
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 :).
If it could not detect the iSight, shutdown and start Mac again (not by rebooting). Also check V4L related information.
http://zaheer.merali.org/articles/2006/07/21/isight-linux-thank-you-ronald (with screencast!)
http://i-nz.net/projects/linux-kernel/ (Bundle SVN (rev.100 + isight.patch) + Howto)
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.
There are a few packages available over the Internet to control the fan(s) speed depending on the temperature reported by the various hardware sensors, for instance macfanctld. Binaries (which may or may not work on Debian) can be downloaded from https://launchpad.net/~mactel-support/+archive/ppa.
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.
* MacBook/Legacy – dated but still at times informative tips for older Debian and kernel versions
$ 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
- 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