Gentoo Linux + MacBook Pro 5.2 v1.1

posted in category Computer, English, tagged , ,

11th

Apr 10

After my tries back in December where I installed an Ubuntu Linux 9.10 on my MBP 5.2, which then crashs to hell when I tried to upgrade it to 10.04 beta, I decided to switch back to Gentoo. I have not used it since like 5 years, but when I gave it a try on my server, I decided to give it a try on my laptop as well because it performed so smoothly. Long story short, Linux on a MBP ain’t that easy because a lot distributions have got some compatibility issues.


Installation

I used Gentoo Daily LiveCD amd64 Build to boot into installation since I’ve got 4GB RAM, if you’ve got less, you might consider using x86. Normal Gentoo Installation, nothing special mac-ish, if you have no experience in installing Gentoo, take a look at the Gentoo Handbook. The handbook advises use of fdisk to partition your harddrive. I’d recommend you to make partitions pre-install under OSX with diskutil or at least use parted to not to screw your partition table (many fdisk versions are not compatible with the Apple Partition Tables (GPT) and may corrupt them, I don’t know if Gentoo’s does, but don’t risk it).

I used following settings in /etc/make.conf:

CFLAGS="-O2 -march=core2 -pipe -msse4.1 -fomit-frame-pointer"
CXXFLAGS="-O2 -march=core2 -pipe -msse4.1 -fomit-frame-pointer"          
 
CHOST="x86_64-pc-linux-gnu"
MAKEOPTS="-j3"
 
INPUT_DEVICES="keyboard mouse synaptics evdev"
ALSA_CARDS="hda-intel"
VIDEO_CARDS="nvidia nv vesa fbdev"

With INPUT_DEVICES, ALSA_CARDS and VIDEO_CARDS, most of the hardware stuff will be installed per default and you don’t need to think of them later on when you’re configuring X11 and stuff.

Software: Kernel

I used gentoo-sources 2.6.31-r10 without other patches (no mactel or something). Here’s my .config file: click. It’s not perfectly configured, but hey it works perfectly. If you have no experience in your own kernel configurations, I recommend you to make a genkernel kernel AND a self configured kernel, just in case your self configured one doesn’t boot, you can boot with your genkernel one to make a new selfconfigured.

The most important MacBook Pro specific stuff is listed in the Gentoo Wiki
http://en.gentoo-wiki.com/wiki/Apple_Macbook_Pro/Configuration_Files/Kernel

You should build SATA Stuff as well as the Intel SATA Drivers (PIIX) directly into the kernel, if not, your system might not start correctly.

Software: Bootloader

I use GRUB with normal configuration described in Gentoo Handbook. No problems in combination with rEFIt (if you don’t have rEFIt, install it. Now. It makes a look of things easier when it comes to boot different operating systems on Macs).

I installed my grub directly to my root partition instead of MBR (so /dev/sda3 instead of /dev/sda).

Edit: Software: Xorg / KDM

To get your Xorg server self-detect your hardware, you might want to set the ‘hal’-USE flag.

I had a problem with my input devices in combination with the KDE login manager called kdm. It did not work properly until I’ve set the ‘consolekit’-USE flag and added it to boot up scripts

euse -E consolekit hal
emerge -DuvaN world
rc-update add consolekit default && /etc/init.d/consolekit start

Both not MBP specific, but I had problems as well as a reader of my blog emailing me.

Hardware: Nvidia Graphics

When you set the nvidia flag in VIDEO_CARDS in your make.conf, portage should normaly install nvidia-drivers when you’re going to emerge xorg-server. If not, you should install it in the end (emerge nvidia-drivers). On my system, Xorg could mostly configure itself on first launch. If not, here’s my xorg.conf.

Hardware: Broadcom Wireless

Wireless is a little bit harder, but not impossible. Firstly, you need to install the broadcom-sta drivers. Since they are flagged as testing and also flagged as incompatible license, you need to do 2 changes in config before you can emerge them:

echo ">=net-wireless/broadcom-sta-5.10.91.9.3-r3" > /etc/portage/package.keywords
echo "ACCEPT_LICENSE='*'" > /etc/make.conf
emerge broadcom-sta

Hopefully it installs without errors. Maybe it claims you did some false options in your kernel config. You should recompile your kernel without them and install broadcom-sta again if that happens.

modprobe wl

If that works without problems, good for you, first step to wireless networking is done. Next, you’ll need the package wpa_supplicant, to login to your WPA2 W-LAN. If you don’t have an encrypted wlan, wireless-tools should be enough to connect, but I guess most people use WPA encryption.

emerge wpa_supplicant

Now, you need to add two lines to your /etc/conf.d/net file:

modules=( "wpa_supplicant" )
wpa_supplicant_eth1="-Dwext"

You should make a symbolic link in your /etc/init.d/ folder to start your net interface correctly at boot. If you don’t know which interface is your wlan card, check ifconfig. It might be eth0, eth1 or wlan0.

ln -s /etc/init.d/net.lo /etc/init.d/net.eth1       or .wlan0      or .eth0
rc-update add net.eth1 default      or .wlan0      or .eth0

Last thing you need to do is put your login details to /etc/wpa_supplicant.conf. If file doesn’t exist, create it. Following content:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
 
network={
  ssid="NAMEOFYOURWLAN"
  psk="YOURWPA2PASSWORD"
  priority=5
}

Be sure to replace the SSID and PSK with the name of your wpa2 network and passphrase.

/etc/init.d/net.eth1 start

Now your wlan should hopefully work.

Hardware: Bluetooth

Basic bluetooth stuff should work out of the box (at least it did for me). Be sure to add the btusb module to your kernel. If it does not work, emerge bluez manually.

To get everything working correctly I needed to configure /etc/conf.d/bluetooth and set hci2hdi to TRUE.

To configure bluetooth hardware, i’d recommend either emerging bluez-gnome and then bluetooth-applet / bluetooth-wizard or emerging the blueman tool, which is unfortunately masked as testing (so put it to your /etc/portage/packages.keywords), but worked good for me.

My bluetooth apple keyboard and mighty mouse worked without mousewheel / special keys without configuration and stuff. To get mousewheel as well as special keys running, I needed to pair it correctly with blueman.

Hardware: Touchpad

Touchpad worked completly out of the box. No configuration on my side (ok, well, the line in my make.conf, but nothing besides that).

Hardware: Keyboard Backlight / Screen Display Backlight

To get these things, I needed to do following commands:

emerge pommed
rc-update add pommed default
/etc/init.d/pommed start

Overall

So, thats all for now. I hope my guide helped you a little bit. Hopefully I didn’t forget something, if so, write a comment and I try to edit my post.

v1.0 – Initial version

v1.1 – Added hal / consolekit Section

Be Sociable, Share!
  • http://www.tommyblue.it Tommaso

    Hi, i’m installing gentoo too, can i ask the values in your USE variable?
    Thanks!

    • http://mkasu.org mkasu

      Thats my USE variable:

      USE=”-gnome -gtk -gtk2 mmx sse sse2 X kde qt cdr alsa dvd unicode png consolekit dvbt dvb v4l v4l2 java mono truetype hal dbus xcomposite -gstreamer lastfm zeroconf avahi mdnsresponder-compat glitz xcb svg emerald lm_sensors”

      There’s nothing mbp specific to set.

  • Pingback: My Homepage