MacBookPro7,1

From ArchWiki

This article or section is a candidate for merging with Laptop/Apple#Model list.

Notes: There's already a blurb with Laptop/Apple#MacBookPro7,1 Mid 2010, adding the working status in the table should be enough. (Discuss in Talk:MacBookPro7,1)

This article or section does not follow the Laptop page guidelines.

Reason: Multiple Help:Style violations, the article is written in first person, wall of text duplicating other articles (Discuss in Talk:MacBookPro7,1)

This page contains tips on installing Arch Linux on a Mid 2010 13" MacBook Pro alongside a pre-existing OSX operating system.

Preparation

Install Boot Manager

Optional. The easiest way to begin is by installing rEFInd on Mac OSX before moving on to Arch. This will place a boot menu on startup. The config will be in your OSX partition - if this is not desirable it is possible to install it later in Arch. Keep in mind that since Apple's OS X 10.11 (El Capitan), the feature System Integrity Protection (SIP) does not allow for rEFInd installation in the way described on the Installing rEFInd page. See this site for more information and installation instructions.

Shrinking Macintosh HD

Using Mac OSX's disk utility, create a new partition, calculate the amount of free space required for all new partitions and shrink Macintosh HD to accommodate for this amount. Leave the new partition as free space for now.

EFI vs CSM mode

It is probably good to consider on forehand what the differences are and which will work best for you, especially considering the drawback EFI mode has on the NVIDIA driver.

Installation

To install an x86_64 system, follow the Mac EFI installation instructions. It is recommended to read the UEFI, GPT and Arch boot process#Boot loader pages before trying any of this on your machine. Also of note, GIST.

See notes on video support before attempting installation!

The following assumes that you have somehow managed to install Arch Linux to a single partition on your drive, and that you still have your osx installation on a different partition.

Dual Boot

If you want to dualboot osx and linux, the easiest way to do so is to use rEFInd. rEFInd is a updated and maintained fork of rEFIt and should be used in its place.

I have found it easiest to install rEFInd from osx. Depending on your setup, you will either install it to your osx partition, or to the ESP partition (install.sh --esp). See here for instructions. Installing to the ESP partition can cause some startup delay, which can be overcome by simply renaming rEFInd's installation folder to "BOOT" and the executable to "bootx64.efi"[1]

Assuming that rEFInd was installed to the ESP, I have found it convenient to later mount the ESP as my "/boot" directory. That way, by setting

scan_all_linux_kernels

in your refind.conf, rEFInd will automatically pickup the kernel. All you need to add is a "refind_linux.conf" file to the root of the ESP, containing your boot args. I use:

"Boot with defaults"    "root=/dev/sda3 rootfstype=xfs ro add_efi_memmap"

Note that my root partition is sda3 and that I use the xfs filesystem on it, yours may differ! So my ESP partition looks like this when mounted under "/boot":

EFI/
 APPLE/
 BOOT/
  bootx64.efi
  drivers/
  icons/
  keys/
  refind.conf
initramfs-linux-fallback.img
initramfs-linux.img
refind_linux.conf
vmlinuz-linux

Note that the EFI/BOOT directory is normally named EFI/REFIND and that the bootx64.efi is normally named refind_x64.efi.

EFI-Mode

Consult UEFI

Warning: efibootmgr may brick your Mac firmware.

You should now be able to boot your mac in efi-mode via the kernel's efistub feature. rEFInd should present you with an option to do so. See here for more general information on the topic. This however has some drawbacks, as mentioned in the Video section below.

CSM-Mode

Booting your mac in csm- or legacy-mode provides a solution. To do so, we need a hybrid mbr, with at least one 'active/bootable' partition. See here for more general information on how to setup a hybrid mbr. Simply boot in efi-mode, then assuming you have three partitions, the ESP partition, an osx and a linux partition you will need to use gdisk to set things up.

# gdisk /dev/sda

Press 'p' to print your partition table, which should look somewhat like mine:

Number  Start (sector)    End (sector)  Size       Code  Name
  1              40          409639   200.0 MiB   0700  EFI System Partition
  2          409640       393186215   187.3 GiB   AF00  OSX
  3       393186216       625142414   110.6 GiB   8300  Linux filesystem

Press 'r' to enter recovery and transformation mode.

Now press 'o' to print your mbr. It should only list a single partition covering the entire disk. Or depending on with which tools you used to partition your disk maybe some other entries.

Press 'h' to create a new hybrid mbr. You will be prompted for some input:

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence:

I chose to mirror my gpt, so I entered '1 2 3', but it should be enough to just use one partition here. In my example, this would need to be the ESP partition, so '1', but in case you do not want to use the ESP to store your kernels, this could also be the linux partition, so '3'. You decideĀ :)

Another and maybe more secure way to mirror the gpt is only to enter '1' for the first and only partition, the EFI or boot partition. This prevents the strange behaviour of MacOS. It can happen that MacOS or its bootsystem cannot find its partition and will end up in a rather long loop. Then proceed as written below.

Make sure to say 'Yes' to the next promt:

Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y

Then set at least one partition as active/bootable:

Creating entry for GPT partition #1 (MBR partition #2)
Enter an MBR hex code (default 07): 
Set the bootable flag? (Y/N): y

Note the MBR hex code depends on the partition type, press 'l' in gdisk's main menu to list them.

Press 'o' (make sure you are still in the recovery menu!!!) again to see your new hybrid mbr, in my case:

Number  Boot  Start Sector   End Sector   Status      Code
  1                     1           39   primary     0xEE
  2      *             40       409639   primary     0x07
  3                409640    393186215   primary     0xAF
  4             393186216    625142414   primary     0x83

Or if you choose to only mirror the first one, it can also look like this:

Number  Boot  Start Sector   End Sector   Status      Code
  1                     1           39   primary     0xEE
  2      *             40       409639   primary     0xEF

Even if the mbr table looks like this (note that in the second table only the last two lines are missing), the bootloader will know what to boot. You can compare start and end sectors between the two tables if you wish.

Press 'w' to write the table to disk and reboot.

Cannot find root device

If booting fails, first try to use the initramfs-linux-fallback.img, as it includes more modules than your "auto-detected" initramfs, and should allow the kernel to actually find your root partition. You will then need to regenerate the initramfs. The whole booting process with the regular initramfs-linux should end up successfully, if not, then add the following configuration and rebuild the initramfs again:

/etc/mkinitcpio.conf
MODULES="ata_generic libata xfs"
Note: You will only need xfs if your root partition is actually formatted with it, exchange it with the appropriate module for the file-system you use.

Once you reboot, rEFInd should now present you with three options, two linux entries and one for osx. One linux entry will boot the kernel via efistub in efi-mode, the other will call syslinux(or your chosen bootloader) which then should boot the system in csm-mode. Do the latter from now on!

The easiest way to see if you were successful, is to install the NVIDIA driver and start X.

Network

Wireless Setup provides instructions on how to identify your card, but if your MacBook Pro 7,1 is like mine then you will head to Broadcom Wireless and use this command.

$ lspci -vnn -d 14e4:

If from this you discover that your full PCI-ID is [14e4:432b], then the following advice applies to you: Do not waste time on the b43 driver. I have been fiddling with it for weeks, and switching to broadcom-wl made all the problems go away. broadcom-wl might make your device names funky, but that's easily fixed with the udev rule documented on Broadcom Wireless.

I also recommend netctl.

Note: Alternative solution for using b43:

As of kernel version 3.17.1-2, Broadcom Wireless driver most likely will not work (ERROR @wl_cfg80211_scan :WLC_SCAN error (-22)). The only option seems to be loading the b43 driver in PIO mode. To enable PIO mode, install driver by following the guide at wireless.wiki.kernel.org, then load the b43 kernel module with pio=1 and qos=0 parameters. To make this happen at boot, create b43-firmware.conf file in /etc/modprobe.d/ and add the following lines:

b43-firmware.conf
options b43 pio=1 qos=0

blacklist wl
blacklist brcmsmac
blacklist brcmfmac
blacklist b43legacy
blacklist bcm43xx
blacklist brcm80211

Although using PIO should be much slower than using DMA, I have not noticed any performance drop. Further testing showed repetitive occurrences of noticable performance drops. Mostly expressed as rapid decrease of transfer speed, sometimes even dropped connections. It also seems that b43 driver has issues operating at 5Ghz.

Some later kernels are giving me more success (without PIO), but still some wifi drops have occurred.

Video

According to the Apple Product Technical Specifications the MacBook Pro 7,1 has an NVIDIA GeForce GT 320M in it.

Nouveau

Consult Nouveau for general info on the driver. Works out of the box, performance however is not that great and your system will get quite hot when running nouveau. Will cause issues in electron based applications! Fix by adding --disable-gpu to the .shortcut!

Nvidia

Consult NVIDIA for general info on the driver. The drivers work out of the box when booting the mac in csm- or legacy-mode. See here for some discussion on the topic.

Running the drivers in efi-mode requires setting some PCI registers before the kernel modules get loaded, preferably using a udev hook or GRUB script. You can also use a efi shell script in REFind as stated here. Otherwise, the screen just remains black when X starts. Follow these instructions in order to find the appropriate PCI device IDs for which to set the registers. This approach has been confirmed to work and is still being actively discussed inside the above mentioned thread. Updated EFI Shell boot method here. The latest NVIDIA drivers are no longer supported for this MacBook's GPU you will instead need to use these ones nvidia-340xx-dkmsAUR! Once installed create a config by running the command:

# nvidia-xconfig

That will automatically generate a config for xorg (/etc/X11/xorg.conf). After that's done you will need to fix the fonts in your current DE/Window manager settings or by editing the xorg config!

The NVIDIA binary driver does not support either simple display configuration switching or automatic monitor/display configuration on hotplug events, but this can be achieved by using autorandr and autorandr_launcher. Install autorandr first, and manually save each configuration as a profile. autorandr_launcher can then be compiled and configured as a systemctl service. autorandr autorandr_launcher

Backlight Control

When using Nvidia drivers, you can use nvidia-bl-dkmsAUR to get controls in /sys/class/backlight/nvidia_backlight.

Note: nvidia-bl-dkmsAUR does not build with kernel 5.x as of 14/3/2020, though this comment has a solution that fixes it on modern kernels (confirmed on 5.14.16-arch1-1)

You can also use xorg-xbacklight which sets the xrandr Backlight property usually only available on intel hardware.

Fan control

For controlling the fans install mbpfan-gitAUR, by default the fans always run really loud without this package, then enable mbpfan.service.

Additional Notes

For XFCE use cases:

If you have issues with rebooting/power off function with XFCE power manager, add acpi=force to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub.

Older versions of XFCE power manager will break backlight key handling if you select "handle display brightness keys" after installing nvidia driver (even after re-adding "RegistryDwords" "EnableBrightnessControl=1" to /usr/share/X11/xorg.conf.d/10-nvidia-brightness.conf)

The PCI bridge values (prior to installing nvidia drivers) should be manually set in /etc/grub.d/01_enable_vga.conf

Configuring PCI for installing NVIDIA drivers

Enabling brightness function keys