Difference between revisions of "MacBookPro7,1"

From ArchWiki
Jump to: navigation, search
(Can't find root device)
(One intermediate revision by the same user not shown)
Line 16: Line 16:
  
 
See notes on '''video support''' before attempting installation!
 
See notes on '''video support''' before attempting installation!
 +
 +
''The following assumes that you have somehow managed to install archlinux to a single partition on your drive, and that you still have your osx installation on a different partition.''
 
=== Dual Boot ===
 
=== Dual Boot ===
 
If you want to dualboot osx and linux, the easiest way to do so is to use [http://www.rodsbooks.com/refind/ rEFInd].
 
If you want to dualboot osx and linux, the easiest way to do so is to use [http://www.rodsbooks.com/refind/ rEFInd].
Line 21: Line 23:
  
 
I've found it easiest to install rEFInd from osx. Depending on your setup, you'll either install it to your osx partition, or to the ESP partition (install.sh --esp). See [http://www.rodsbooks.com/refind/installing.html#installsh here] for instructions.
 
I've found it easiest to install rEFInd from osx. Depending on your setup, you'll either install it to your osx partition, or to the ESP partition (install.sh --esp). See [http://www.rodsbooks.com/refind/installing.html#installsh here] for instructions.
Installing to the ESP partition can cause a delay at startup, which can be overcome by simply renaming rEFInd's installation folder to "BOOT" and the executable to "bootx64.efi"[http://www.rodsbooks.com/refind/installing.html#sluggish]
+
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"[http://www.rodsbooks.com/refind/installing.html#sluggish]
  
Once rEFInd is installed, you'll need to create a directory on the ESP to hold the kernel & initramfs image. I've found it convenient to later mount the ESP as my "/boot" directory.
+
Assuming that rEFInd was installed to the ESP, I've 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 partion 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
 +
syslinux/ *** My bootloader of choice, see below ***
 +
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 ====
 
==== EFI-Mode ====
You can boot your mac in efi mode via the kernel's efistub feature.
+
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 [http://www.rodsbooks.com/refind/linux.html here] for more general information on the topic.
 
See [http://www.rodsbooks.com/refind/linux.html here] for more general information on the topic.
 +
This however has some drawbacks, as mentioned in the '''Video''' section below.
 
==== CSM-Mode ====
 
==== CSM-Mode ====
See [http://www.rodsbooks.com/gdisk/hybrid.html here] for more general information on how to setup a '''hybrid mbr'''.
+
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 [http://www.rodsbooks.com/gdisk/hybrid.html 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'll 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'll 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 don't want to use the ESP to store your kernels, this could also be the linux partition, so '3'. You decide :) 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're 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
 +
You can compare start and end sectors between the two tables if you wish.
 +
 
 +
Press 'w' to write the table to disk and reboot.
 +
===== Bootloader =====
 +
Lastly you'll now need a bootloader. I use syslinux because I find it the simplest to setup, but others should also work. Install it via pacman, and then just execute
 +
syslinux-install_update -i -a -m
 +
It should detect your hybrid mbr and install itself automatically. Refer to [[Syslinux]] for more details.
 +
 
 +
Make sure to configure the bootloader's menu entries correctly: (syslinux)
 +
LABEL arch
 +
MENU LABEL Arch Linux
 +
LINUX ../vmlinuz-linux
 +
APPEND root=/dev/sda3 ro vga=865
 +
INITRD ../initramfs-linux.img
 +
Note that 'sda3' refers to the '''gpt mapping''', 'vga=865' means 1280x800 framebuffer resolution, nicer when using the nvidia driver.
 +
===== Can't find root device =====
 +
I also needed to include two modules in the initramfs file. In /etc/mkinitcpio.conf:
 +
MODULES="libata xfs"
 +
Rebuild it with
 +
mkinitcpio -p linux
 +
Note, that you'll only need xfs if your root partition is actually formatted with it.
 +
 
 +
 
 +
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 ==
 
== Network ==
Line 47: Line 124:
 
See [https://bbs.archlinux.org/viewtopic.php?id=162289 here] for some discussion on the topic.
 
See [https://bbs.archlinux.org/viewtopic.php?id=162289 here] for some discussion on the topic.
  
In short, booting in '''efi-mode''', will crash the nvidia module, resulting in a black screen, so in order to use nvidia's driver, you'll need to boot your machine in '''csm-mode'''.
+
In short, booting in '''efi-mode''', will crash the nvidia module when X starts, resulting in a black screen, so in order to use nvidia's driver, you'll need to boot your machine in '''csm-mode'''.
  
 
This can't be achieved directly, but depends on apple's firmware agreeing that your partition layout warrants this as presumably they implemented the feature to allow booting of windows xp/7, neither which can ordinarily boot off a gpt partitioned disk.
 
This can't be achieved directly, but depends on apple's firmware agreeing that your partition layout warrants this as presumably they implemented the feature to allow booting of windows xp/7, neither which can ordinarily boot off a gpt partitioned disk.

Revision as of 14:27, 11 May 2013

Summary help replacing me
Details the installation and configuration of Arch Linux on Apple's MacBook Pro 7,1
Related
MacBook
MacBookPro
MacBook_Pro_7,1
MacBook_Pro_8,1_/_8,2_/_8,3_(2011_Macbook_Pro)
MacBook_Pro_9,2_(Mid-2012)

Installation

To install an x86_64 system, follow the MacBook EFI installation instructions. It is recommended to read the UEFI, GPT and UEFI Bootloaders 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 archlinux 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've found it easiest to install rEFInd from osx. Depending on your setup, you'll 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've 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 partion 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
syslinux/ *** My bootloader of choice, see below ***
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

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'll 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'll 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 don't want to use the ESP to store your kernels, this could also be the linux partition, so '3'. You decide :) 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're 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

You can compare start and end sectors between the two tables if you wish.

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

Bootloader

Lastly you'll now need a bootloader. I use syslinux because I find it the simplest to setup, but others should also work. Install it via pacman, and then just execute

syslinux-install_update -i -a -m

It should detect your hybrid mbr and install itself automatically. Refer to Syslinux for more details.

Make sure to configure the bootloader's menu entries correctly: (syslinux)

LABEL arch
MENU LABEL Arch Linux
LINUX ../vmlinuz-linux
APPEND root=/dev/sda3 ro vga=865
INITRD ../initramfs-linux.img

Note that 'sda3' refers to the gpt mapping, 'vga=865' means 1280x800 framebuffer resolution, nicer when using the nvidia driver.

Can't find root device

I also needed to include two modules in the initramfs file. In /etc/mkinitcpio.conf:

MODULES="libata xfs"

Rebuild it with

mkinitcpio -p linux

Note, that you'll only need xfs if your root partition is actually formatted with it.


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'll 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: Don't waste time on the b43 driver. I've 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.

Video

According to the Debian Wiki the MacBook Pro 7,1 has an NVIDIA GeForce GT 320M in it.

Nouveau

Works out of the box, performance however is not that great and your system will get quite hot when running nouveau.

Nvidia

The drivers work, but so far only when booting the mac in csm- or legacy-mode. See here for some discussion on the topic.

In short, booting in efi-mode, will crash the nvidia module when X starts, resulting in a black screen, so in order to use nvidia's driver, you'll need to boot your machine in csm-mode.

This can't be achieved directly, but depends on apple's firmware agreeing that your partition layout warrants this as presumably they implemented the feature to allow booting of windows xp/7, neither which can ordinarily boot off a gpt partitioned disk.


To be continued..