Debian su MacBook Pro unibody
With this second How-To I would like to show how to install a working (64bit) Debian Linux on a MacBook Pro unibody (version 5,2 - late 2009). I will use Debian testing.
Just for reference, to see the version of your laptop use this linux command as a superuser:
$ dmidecode -s system-product-name MacBookPro5,3
What we need
- a Macbook Pro (www.apple.com) :)
- a net install amd64 Debian cd
- internet connection
- something to eat, since now I'm living in Germany a Kaiserschmarrn would be a good idea :D
- X with 3D acceleration (with Nvidia driver)
- Audio internal and external speaker
- LCD Brightness and keyboard backlight
- Temperature sensors
- Cd/DVD driver
- iSight, integrated webcam
- Suspend to RAM (but not hibernate)
- Fireware port
- ligth and tilt sensors
- Cd/DVD burner
- Hibernate seems to have some problems with Nvidia driver
Step 1. Resize macos partition to something smaller, like 70Gb. From the MacOS Terminal run:
diskutil list sudo diskutil resizevolume disk0s2 70G
Step 2. Reboot.
Step 3. Download and install rEFIt for MacOS. In my case rEFIt doesn't show up after rebooting, so in MacOS open the Terminal and run:
cd /efi/refit ./enable.sh
Step 4. Reboot holding the alt key with the Debian CD into the drive.
Step 5. Start Debian installer and go through first steps.
Step 6. Choose manual partitioning and add a first ext3 partition (to be mounted as /) and a swap partition. I also added a separated partition for /home. Make sure the primary Linux partition is the first you have created and is bootable.
Step 7. Install base system until the bootloader.
Step 8. When prompted to install GRUB select 'Go Back'. Hit Fn+control+alt+F2 to get to the terminal. Hit return. The partitions need to be synchronized with:
chroot /target aptitude install refit /sbin/gptsync /dev/sda
Step 9. Install GRUB2 where /dev/sda3 is the linux system partition:
aptitude install grub2 grub-install /dev/sda3 update-grub
Step 10. Hit Fn+control+alt+F1 and complete the installation.
Step 11. Boot your brand new Debian, edit your /etc/apt/source.list and upgrade everything to testing.
Boot Linux by default
If you want linux to be booted as the default os with rEFIt go to MacOS and open /efi/refit/refit.conf. Then look for the line:
and uncomment it.
This is my .config for kernel 126.96.36.199: http://www.mpa-garching.mpg.de/~fdg/macbookpro/rev-config
Here instead you have the dmesg for debugging purpose: http://www.mpa-garching.mpg.de/~fdg/macbookpro/rev-dmesg
Then recompile the kernel (make-kpkg kernel_image headers). I tried to make the kernel really minimal, but probably I'm far from a good job :)
X and 3D acceleration
This step is quite easy, just do:
apt-get install nvidia-xconfig nvidia-kernel-source nvidia-kernel-common nvidia-glx cd /usr/src/ m-a a-i -l [kernelversion] nvidia
to generate a good xorg.conf use nvidia-xconfig, just remember to add:
Option "NoLogo" "True"
in the 'Device' section.
To work with the external monitor the easier way is to use the nvidia server setting program and TwinView.
First of all in my kernel .config there are the reverse engineered driver called b43 and ssb, these driver do not work (yet), so disable them:
echo "blacklist b43" >> /etc/modprobe.d/blacklist.conf echo "blacklist ssb" >> /etc/modprobe.d/blacklist.conf
Download and compile the proprietary driver with
apt-get install broadcom-sta-common broadcom-sta-source cd /usr/src m-a a-i -l [kernelversion] broadcom-sta
Test the wireless network with "iwlist s", but everything now should work.
The InputDevice section of /etc/X11/xorg.conf can be set as:
Section "InputDevice" # generated from default Identifier "Mouse0" Driver "synaptics" # required Option "MinSpeed" "0.5" Option "MaxSpeed" "2.5" Option "AccelFactor" "0.15" Option "FingerLow" "40" Option "FingerHigh" "70" Option "ClickFinger1" "1" Option "ClickFinger2" "0" Option "ClickFinger3" "0" Option "TapButton1" "1" Option "TapButton2" "3" # multitouch Option "TapButton3" "2" # multitouch Option "VertTwoFingerScroll" "1" # multitouch Option "HorizTwoFingerScroll" "1" # multitouch Option "VertEdgeScroll" "0" Option "HorizEdgeScroll" "0" Option "CircularScrolling" "1" Option "PalmDetect" "1" Option "PalmMinWidth" "25" Option "PalmMinZ" "250" EndSection
these values are OK for my personal feeling (super fast touchpad:) ).
It works almost out of the box.
Install pommed in order to use the function keys. I must report that the keyboard backlight has still problems when you try to turn it off. Whenever I'll find a solution I'll post it immediately :D
To change the couple of erroneous buttons we have, just run every time you start X the program xmodmap (put a script in .kde/Autostart) with the conf file:
!! ±§`~ keycode 49 = section plusminus keycode 94 = grave asciitilde !! euro and german letters keysym e = e E EuroSign keysym b = b B ssharp keysym u = u U udiaeresis Udiaeresis keysym o = o O odiaeresis Odiaeresis keysym a = a A adiaeresis Adiaeresis !! apple keycode 133 = Mode_switch keycode 134 = Mode_switch clear mod1 add mod1 = Alt_L add mod1 = Super_L clear mod2 add mod2 = Num_Lock clear mod3 clear mod4 clear mod5
It works almost out of the box.
As usual with the macbook we have to play a little with the mixer. So open the mixer (or alsamixer), unmute the "Surround speaker" switch and increase the volume of Master, Headphone (external speaker), Front Speaker (internal speaker) and Sourround Speaker Playback. This last channel allows us to control the subwoofer speaker that increase enormously the sound quality.
If the microphone is not working properly, try installing pulseaudio.
It works out of the box, just load the forcedeth kernel module (built in in my kernel .config).
It works out of the box. We do not need anymore to load the firmware from the MacOS partition. Just load the uvcvideo kernel module.
Bootstrap and grub
Edit the file /etc/default/grub and modify the line:
to have the correct resolution for the boot prompt. You can also change the default image in /etc/grub.d/05_debian_theme by editing these variables: WALLPAPER, COLOR_NORMAL and COLOR_HIGHLIGHT.
- (for the wifi part) http://wiki.debian.org/wl
- (for the touchpad) https://help.ubuntu.com/community/MacBookPro5-5/Jaunty#Touchpad
- (for the kernel part) http://en.gentoo-wiki.com/wiki/Apple_Macbook_Pro/Configuration_Files/Kernel
Note on Skype
Skype has some problems to run in a 64bit environment, in order to run it properly download the last version from http://www.skype.com/intl/it/download/skype/linux/choose/ and
dpkg -i --force-architecture skype[...]_i386.deb
if you miss some libraries (as expected) a quick search on google will help you to find the correct solution. Usually is to download a 32bit version of some package and copy the library in /usr/lib32/