Archlinux on a MacbookPro

December 12, 2009 Tags: archlinux, apple

I just bought a MacbookPro5,5. When it comes to installing Linux on a macbook, all the distributions have a lot of documentation. I'm used to Archlinux and although Ubuntu has some great documentation on the Mactel support, I wanted to keep my distribution.

I didn't expect much because a friend of mine bought the same machine a few months ago and the total support wasn't here. Rebooting didn't work and the backlit keyboard was not supported.

Surprisingly enough, all of this works very well on Archlinux. Details below.

At first, if you want reboot support, add reboot=pci to the kernel command-line in /boot/grub/menu.lst.

Video

I don't need anything fancy here since I'm not used to those 3D environments like Compiz. The video card is a GeForce 9400M and several drivers are available:

  • nvidia, the official proprietary drivers. They work very well and if you need 3D acceleration, you'd better to choose these.
  • nv, the GPL drivers from X.org nVidia cards.
  • nouveau, an open source project for GPL'd nVidia drivers. They are still experimental but they provide KMS and I've heard they work pretty well.

So, go for nouveau. I was used to KMS with my old Intel video card and I don't need advanced 3D support.

pacman -S xf86-video-nouveau

The configuration is straightforward. You will need a very basic xorg.conf:

#/etc/X11/xorg.conf

Section "Device"
        Identifier "nvidia"
        Driver "nouveau"
EndSection

At this point we have a working Xorg. If you want to enable KMS, add the line options nouveau modeset=1 to /etc/modprobe.d/modprobe.conf and add /etc/modprobe.d/modprobe.conf to the FILES variable in /etc/mkinitcpio.conf. Then run as root:

mkinitcpio -p kernel26

You have to know that there is currently no DisplayPort support with the open source driver. If you want to setup an external screen, you will have to use the proprietary nvidia drivers and use Nvidia's configuration tools. On the other hand you won't have backlight support with the Nvidia drivers.

DisplayPort support for nouveau is awaited with Fedora 13.

Backlight

This is a really simple part. Just install pommed from AUR. Then:

/etc/rc.d/pommed start

You should have both screen and keyboard backlight adjustment available with the F1/F2 and F5/F6 keys.

Also, add @pommed to the DAEMONS array in /etc/rc.conf.

If you need some further configuration — like the brightness you want when starting up or the step values for increasing or decreasing the brightness —, copy /etc/pommed/pommed.conf.mactel to /etc/pommed/pommed.conf and adjust it to fit your needs.

Touchpad

First, install the xf86-input-synaptics package:

pacman -S xf86-input-synaptics

Update 2010-06-23: the first version of this article explained how to configure the touchpad with Hal but this is now deprecated with Xorg 1.8 that hit [extra] on the 21st of June. I'm now documenting the two ways of doing it.

With Xorg >= 1.8

All you need is to add a few sections to your xorg.conf:

Section "ServerLayout"
    Identifier     "layout"
    InputDevice    "SynapticsTouchpad"  "SendCoreEvents"
    Option      "Xinerama" "on"
EndSection

Section "Module"
    Load "synaptics"
EndSection

Section "InputDevice"
    Identifier "SynapticsTouchpad"
    Driver     "synaptics"
    Option     "AlwaysCore" "true"
    Option     "Device" "/dev/input/mice"
    Option     "Protocol" "auto-dev"
    Option     "SHMConfig" "true"
    Option     "VertTwoFingerScroll" "true"
    Option     "HorizTwoFingerScroll" "true"
    Option     "TapButton1" "1"
    Option     "TapButton2" "3"
    Option     "TapButton3" "2"
    Option     "ClickFinger1" "1"
    Option     "ClickFinger2" "3"
    Option     "ClickFinger3" "2"
EndSection

Just add your own synaptics incantations if you need to.

With Xorg < 1.8

The configuration is done with Hal. Copy /usr/share/hal/fdi/policy/10osvendor/11-x11-synaptics.fdi to /etc/hal/fdi/policy/11-x11-synaptics.fdi. Adjust it if you want two-finger scrolling, tapping, etc. Here is mine:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
 <device>
  <match key="info.product" contains="ETPS/2 Elantech Touchpad">
   <append key="info.capabilities" type="strlist">input.touchpad</append>
  </match>
  <match key="info.capabilities" contains="input.touchpad">
   <merge key="input.x11_driver" type="string">synaptics</merge>
   <merge key="input.x11_options.SHMConfig" type="string">true</merge>

   <!-- horizontal and vertical two-finger scrolling -->
   <merge key="input.x11_options.VertTwoFingerScroll" type="string">1</merge>
   <merge key="input.x11_options.HorizTwoFingerScroll" type="string">1</merge>

   <!-- Tap buttons:
         - one finger: left click
         - two fingers: right click
         - three fingers: middle click -->
   <merge key="input.x11_options.TapButton1" type="string">1</merge>
   <merge key="input.x11_options.TapButton2" type="string">3</merge>
   <merge key="input.x11_options.TapButton3" type="string">2</merge>

   <!-- Finger+click acts the same way as tapping -->
   <merge key="input.x11_options.ClickFinger1" type="string">1</merge>
   <merge key="input.x11_options.ClickFinger2" type="string">3</merge>
   <merge key="input.x11_options.ClickFinger3" type="string">2</merge>
  </match>
 </device>
</deviceinfo>

Update 2010-04-30: Allan McRae has a patched version of the bcm5947 module that adds support for clicking with a finger and draggging / selecting text with another, which would be interpreted as a multitouch event by the vanilla module. Grab the PKGBUILD, it's awesome.

Wireless

First, you will need the broadcom-wl package from AUR. Then update the MODULES section of /etc/rc.conf to load wl and blacklist b43 and ssb:

MODULES=(lib80211_crypt_tkip wl !b43 !ssb ...)

Sound

It works out of the box with kernel 2.6.32 or greater.

Remote control

Install the lirc-utils package and configure it to support the Apple Remote. You need to edit /etc/conf.d/lircd.conf:

# Parameters for lirc daemon
LIRC_DEVICE="/dev/usb/hiddev0"
LIRC_DRIVER="macmini"
LIRC_EXTRAOPTS=""
LIRC_CONFIGFILE="/etc/lircd.conf"

And here is your /etc/lircd.conf:

begin remote
  name            AppleRemote
  bits            8
  eps             30
  aeps            100
  one             0     0
  zero            0     0
  pre_data_bits   24
  pre_data        0x87EEA8
  gap             211986
  min_repeat      4
  toggle_bit_mask 0x87EED402
      begin codes
          menu    0x03
          play    0x05
          up      0x0A
          down    0x0C
          prev    0x09
          next    0x06
      end codes
end remote

After editing these two files, you can launch the lirc daemon by typing:

/etc/rc.d/lircd start

Then run ircat and watch the events when you press your remote's buttons! You can then map your buttons to real actions on your laptop in ~/.lircrc. For example, if you want to control MPD using the remote:

begin
prog = irexec
button = next
config = sonata next
repeat = 0
end

begin
prog = irexec
button = prev
config = sonata prev
repeat = 0
end

begin
prog = irexec
button = play
config = sonata pp
repeat = 0
end

You can also set the previous and next buttons to act as your keyboard's left and right arrows:

begin
prog = irxevent
button = prev
config = Key Prior CurrentWindow
repeat = 1
end

begin
prog = irxevent
button = next
config = Key Next CurrentWindow
repeat = 1
end

Once you've edited your ~/.lircrc, add irexec to the list of programs launched at session start.

Temperature sensors

Install lm_sensors. By default you already have access to some temperature information. But if you want to get the temperature of your cores, add coretemp to the MODULES array in /etc/rc.conf.

Typing sensors on the command line should give you a lot of output now.

iSight

The camera works out of the box, there's no need to use the isight-firmware-tools with this version. The kernel module uvcvideo should already be loaded, so just install cheese and try it!

Fan control

The fan speed isn't adjusted by default. You have to install cmp-daemon from AUR and add @cmp-daemon to your DAEMONS array in /etc/rc.conf.

Things that doesn't work yet

The ambient light sensor is working but the screen backlight is not automatically adjusted.

The video output (DisplayPort) is not well supported yet. You will be able to have a dual head setup only with the proprietary nvidia drivers. The nouveau driver doesn't support the DisplayPort. It's planned for Fedora 13, and remember the project is being actively developed.

Overall the hardware support is good enough to have a fully working Linux machine. I still have to turn on OSX when I do presentations and when I need to sync/backup/upgrade my phone but that doesn't happen often.

Comments

December 18, 2009Nicolas Lara

I like this! I've been meaning to get a mac just to use keynote. This might push me over the edge.
Now, what I'd really like to see is running OS X in my HP pavilion or, better yet, virtualizing iwork and other mac software on linux.

December 18, 2009bruno

@Nicolas: Have you seen accentuate[0] and pdfcube[1]? Fancy animations for Linux!

As for running iWork on Linux... I'd be interested but it's probably quite challenging ;-)

[0] http://repo.or.cz/w/accentuate.git
[1] http://code.100allora.it/pdfcube/

January 29, 2010cyphaw

Hi, you finally bought it? Great computer, isn't it?

I suppose that I'm the friend who bought it, so here is a little more feedback. I installed ubuntu because of the doc, and I'm currently too lazy to go back to debian, but I'll eventually do it.

So the reboot and backlit keyboard work since the karmic version, but there is something strange: the keyboard leds switch off after some time, and light when I press a key, but then the light level always go back to a default level of 100 (cat /sys/class/hwmon/hwmon0/device/leds/smc::kbd_backlight/brightness).

I use the proprietary nvidia drivers, and it works fine (yes I use compiz, kikoo!), but I didn't try to use the diplayport.

The touchpad works the same, but since I tried to configure it with different tools (gui, synclient, Xorg, fdi), there are some conflicts, I think, and I must reset the conf regularly (I made a script that lunch all my synclient commands and enable/disable the tap for clicking).

When I reinstall debian, I'll try to make it work correctly.

You have the same sound problem as me. It is supposed to be fix in the 2.6.32 kernel.

Cencerning the temperatures, the sensors 6, 8, 9, 10, 11, 12, 13, 16, 17, 18 don't work here, is it the same on arch?
You can also add hddtemp which monitor the hard drive temp.
And by the way, I think that temp14 is the temp of the graphic card (the sensor from the nvidia settings and the 14 give always the same temp).
And something fun, the position sensor works too. You can see it by
cat /sys/class/hwmon/hwmon0/device/position
And you can play neverball by directly moving your comp :þ

Last, concerning your phone, there are some ways to sync it on Linux, or at least access it easily (the ubuntu doc is great for this).
I still sync it with OSX, but I'm using ipod-convenience to mount /var/mobile/media of my ipod-touch as an external disk over wifi (ssh is great, but sometimes copy/paste is faster).

Add a comment

Comments are closed for this entry.

Short URL

http://bruno.im/e3