Difference between revisions of "MacBookPro10,x"

From ArchWiki
Jump to: navigation, search
(updated with some new status information)
(Added note on SD card reader)
 
(52 intermediate revisions by 13 users not shown)
Line 1: Line 1:
 
[[Category:Apple]]
 
[[Category:Apple]]
{{Article summary start}}
+
{{Related articles start}}
{{Article summary text|This wiki page should help you in getting your [[Wikipedia:MacBook_Pro#Third_generation_.28Retina.29|MacBook Pro with Retina Display]] to work with Arch Linux.}}
+
{{Related|Installation guide}}
{{Article summary heading|Related}}
+
{{Related|General recommendations}}
{{Article summary wiki|Official Arch Linux Install Guide}}
+
{{Related|MacBook}}
{{Article summary wiki|Beginners Guide}}
+
{{Related articles end}}
{{Article summary wiki|General Recommendations}}
+
 
{{Article summary wiki|MacBook}}
+
This page should help you setting up ArchLinux on a [[Wikipedia:MacBook_Pro#Third_generation_.28Retina.29|MacBook Pro 10,1 with Retina display]]. Most of the steps are the same or very similar to the regular ArchLinux installation. However, because this is very new hardware, the setup requires a few different steps.  
{{Article summary end}}
+
This page should help you setting up ArchLinux on a MacBook Pro 10,1 with Retina display. Most of the steps are the same or very similar to the regular ArchLinux installation. However, because this is very new hardware, the setup requires a few different steps.  
+
 
The general installation guidelines are descibed in [[MacBook]].
 
The general installation guidelines are descibed in [[MacBook]].
  
{{Note| To have all hardware supported, you should run this Notebook with Kernel 3.7 or newer. }}
+
{{Note|To have all hardware supported, you should run this Notebook with Kernel 3.7 or newer.}}
  
 
== Preparing for the Installation ==
 
== Preparing for the Installation ==
 +
 
=== Preparing the Hard drive ===
 
=== Preparing the Hard drive ===
 +
 
Assuming you want to dual boot with OS X, you have to shrink its partition with the Disk Utility. You can either create your Linux partition directly here, or do that later in Linux during the installation (using {{ic|parted}} and {{ic|mkfs}}).
 
Assuming you want to dual boot with OS X, you have to shrink its partition with the Disk Utility. You can either create your Linux partition directly here, or do that later in Linux during the installation (using {{ic|parted}} and {{ic|mkfs}}).
  
 
=== Using the Thunderbolt to Ethernet adapter ===
 
=== Using the Thunderbolt to Ethernet adapter ===
The adapter should work out of the box if connected before booting. Thunderbolt hotplugging is not supported (there's a good description of why on a RedHat developer's blog, http://mjg59.dreamwidth.org/15948.html, circa August 2012); if you want hotplug wired Ethernet, the USB adapter is your best bet.
 
  
{{Note|Thunderbolt is seen as a PCIe device to the kernel, all of it being handled by the boot loader. In the case of the MacBook however, they handle Thunderbolt as part of their OS. This means that hotplug support isn't what's missing, a reimplementation of Thunderbolt->pcie interface in Linux is missing. GKH was working on some thunderbolt support last year, but if anyone has more recent information, please add it here.}}
+
As of late 2014, thunderbolt hotplugging has been included in the mainline Linux kernel. Ethernet cables can now be used as usual through the thunderbolt adapter.
 +
[https://plus.google.com/+gregkroahhartman/posts/bzx6EJnwMMf]
 +
 
 +
=== Using a USB-to-Ethernet adapter ===
 +
 
 +
No special configuration is necessary to get this to work.
  
 
=== Getting wireless firmware ===
 
=== Getting wireless firmware ===
In order for the WiFi chip to work, you need to get the firmware for it. You can just copy it from another b43 enabled Arch, extract it from Broadcom's driver using {{Pkg|b43-fwcutter}} or get them through the {{AUR|b43-firmware}} available in the [[AUR]]. In the end you should have a folder called {{ic|b43}} with lots of {{ic|.fw}} files in it.
+
 
 +
In order for the Wi-Fi chipset to work, you need to get the firmware for it. You can just copy it from another b43-enabled Arch, extract it from Broadcom's driver using {{Pkg|b43-fwcutter}}, or get the firmware through the {{AUR|b43-firmware}} package available in the [[AUR]]. In the end, you should have a folder named {{ic|b43}} with a lot of {{ic|.fw}} files in it.
 +
 
 +
=== USB Tethering ===
 +
 
 +
If you have a smartphone, you can also try tethering your device to get connected to the internet. This should work out of the box.
  
 
== Installation ==
 
== Installation ==
  
 
=== Booting the live image ===
 
=== Booting the live image ===
Now, download the latest [[Archboot]] iso, write it to USB and boot from it by selecting it in the Apple boot loader. When it comes to the syslinux boot loader, press {{ic|Tab}} to edit the entry and append {{ic|noapic}} or {{ic|nointremap}} to the end to prevent a kernel panic during bootup. Currently (Aug 4, 2012), you also have to add {{ic|nomodeset}}.
 
  
=== Connecting WiFi ===
+
Download the latest ISO from the download page and prepare a live USB as outlined in [[USB flash installation media]].
{{Note| You can skip this if you use the Thunderbolt or USB to ethernet adapter for the installation.}}
+
 
After it has finished booting, enter a command line. Copy the entire folder with the firmware for your wireless card to {{ic|(/usr)/lib/firmware/}}. Now you should be able to use {{Pkg|wpa_supplicant}} to connect to your WiFi network.
+
Shut down the Macbook. Plug in the USB drive. Hold the option key, then press the power button. After a few seconds, you should see Apple's boot loader display the choice of either starting up the built-in drive with OS X or the USB drive you plugged in.
 +
 
 +
Select the live USB with the arrow keys, and press Enter to boot into the live Arch Linux environment.
 +
 
 +
{{Note|You should not need to pass in any kernel parameters to boot successfully into the live environment.}}
 +
 
 +
=== Connecting Wi-Fi ===
 +
 
 +
{{Note|You can skip this if you use the Thunderbolt or USB-to-Ethernet adapter for the installation.}}
 +
 
 +
After it has finished booting, enter a command line. Copy the entire folder with the firmware for your wireless card to {{ic|/usr/lib/firmware/}}.  
 +
 
 +
Now you should be able to use wifi-menu to connect to your Wi-Fi network.
  
 
=== The installation ===
 
=== The installation ===
{{Note|Refer to the [[MacBook]] page if you don't want to have a separate partition for GRUB but rather prefer to use [http://www.rodsbooks.com/refind/ rEFInd] (or [[MacBook#rEFIt|rEFIt]]).}}
+
 
 +
{{Note|Refer to the [[MacBook]] page if you do not want to have a separate partition for GRUB but rather prefer to use [http://www.rodsbooks.com/refind/ rEFInd] (or [[MacBook#rEFIt|rEFIt]]).}}
 +
 
 
Run the installation wizard. When asked to partition your hard drive, create a small HFS partition. This is where you put the standalone GRUB package after the installation.
 
Run the installation wizard. When asked to partition your hard drive, create a small HFS partition. This is where you put the standalone GRUB package after the installation.
The rest of the installation is pretty much the same as usual. When choosing the bootloader, select GRUB and install it. Don't worry about any errors, we will create the bootable efi image on our own afterwards.
+
The rest of the installation is pretty much the same as usual. When choosing the bootloader, select GRUB, and install it. Do not worry about any errors; we will create the bootable EFI image on our own afterwards.
  
After the installation has completed, directly copy the WiFi firmware to the installed system to {{ic|/tmp/install/usr/lib/firmware/}}.
+
After the installation has completed, directly copy the Wi-Fi firmware to the installed system to {{ic|/tmp/install/usr/lib/firmware/}}.
  
Alternatively, install broadcom-wl-dkms from AUR to improve WiFi.
+
Alternatively, install {{AUR|broadcom-wl-dkms}} from the [[AUR]] to improve Wi-Fi.
  
 
=== Bootloader ===
 
=== Bootloader ===
  
 
==== Direct EFI booting ====
 
==== Direct EFI booting ====
''See: [[UEFI_Bootloaders]]''
+
 
 +
See [[UEFI Bootloaders]].
  
 
As of August 2013, refind can autodetect the Arch kernel, removing the need for copying the kernel into the EFI partition. Simply install refind and enable the "scan_all_linux_kernels" and "also_scan_dirs" options in refind.conf (see link above for instructions.)
 
As of August 2013, refind can autodetect the Arch kernel, removing the need for copying the kernel into the EFI partition. Simply install refind and enable the "scan_all_linux_kernels" and "also_scan_dirs" options in refind.conf (see link above for instructions.)
Line 52: Line 75:
 
==== GRUB ====
 
==== GRUB ====
  
Another solution is to install [[GRUB]]. Edit {{ic|/tmp/install/boot/grub/grub.cfg}} and edit the boot entry to load linux-mainline instead of the normal one. Also append {{ic|noapic}} to the kernel line again.
+
Another solution is to install [[GRUB]]. Edit {{ic|/tmp/install/boot/grub/grub.cfg}} and edit the boot entry to load Linux mainline instead of the normal one. Also append {{ic|noapic}} to the kernel line again.
  
 
Now cd into {{ic|/tmp/install/}} and create the GRUB image by calling:
 
Now cd into {{ic|/tmp/install/}} and create the GRUB image by calling:
Line 60: Line 83:
  
 
Reboot the machine and boot into OS X. The HFS partition should be mounted and the GRUB standalone image in there. Follow the steps on this page to create the files needed to make the Apple boot loader pick up GRUB: http://mjg59.dreamwidth.org/7468.html.
 
Reboot the machine and boot into OS X. The HFS partition should be mounted and the GRUB standalone image in there. Follow the steps on this page to create the files needed to make the Apple boot loader pick up GRUB: http://mjg59.dreamwidth.org/7468.html.
After creating the files, use {{ic|bless}} on the GRUB image on the partition, if you want to boot automatically to Arch, append {{ic|--setBoot}}.
+
After creating the files, use {{ic|bless}} on the GRUB image on the partition. If you want to boot automatically to Arch, append {{ic|--setBoot}}.
  
After another reboot, you should be able to select your installed Arch Linux by keeping the alt button pressed while booting in case you haven't used{{ic| --setBoot}} while blessing.
+
After another reboot, you should be able to select your installed Arch Linux by keeping the alt button pressed while booting in case you have not used {{ic| --setBoot}} while blessing.
  
 
== Post installation ==
 
== Post installation ==
 +
 +
=== Wi-Fi ===
 +
 +
The Macbook Pro 10,x comes with the Broadcom BCM4331 Wireless Chipset.
 +
 +
There are two major options to get this chipset working in Arch Linux:
 +
 +
The {{aur|b43-firmware}} package contains the open-source, reverse-engineered firmware for the chipset.
 +
 +
The {{aur|broadcom-wl}} and {{aur|broadcom-wl-dkms}} packages ship with the propriety, restricted-license drivers for the chipset.
 +
 +
See [[Broadcom wireless]] for more information.
 +
 
=== Graphics ===
 
=== Graphics ===
The Laptop comes with an nVidia and an Intel chip. The Nouveau, the i915 (from 3.6-rc5) and proprietary nvidia (from 302.17) drivers work.
+
 
 +
{{Note|In order to plug in an external display, you will need to have the NVIDIA card powered on as the HDMI and thunderbolt outputs are hardwired to use the NVIDIA card.}}
 +
 
 +
==== General Notes ====
 +
 
 +
The Laptop comes with an nVidia and an Intel chip. The Nouveau {{pkg|xf86-video-nouveau}}, the intel {{pkg|xf86-video-intel}} (from 3.6-rc5) and proprietary nvidia (from 302.17) drivers work.
 
You can install the nvidia driver through {{Pkg|nvidia}} or the AUR package {{AUR|nvidia-beta-all}}.
 
You can install the nvidia driver through {{Pkg|nvidia}} or the AUR package {{AUR|nvidia-beta-all}}.
  
**Note** that as of September, 2013 the current nvidia driver (325.15-5) does not work with the current 3.10 series kernels; X will die with an error about "Failed to allocate EVO core DMA push buffer" and leave you with a black screen (but able to SSH in to the machine). Your best current bet is to use a 3.9-series kernel and the older 319.32-series nvidia driver.
+
{{Note|As of September, 2013 the current nvidia driver (325.15-5) does not work with the current 3.10 series kernels; X will die with an error about "Failed to allocate EVO core DMA push buffer" and leave you with a black screen (but able to SSH in to the machine). Your best current bet is to use a 3.9-series kernel and the older 319.32-series nvidia driver.}}
  
Since this device comes with a Retina (HiDPI) display, things are really small with native resolution. There are different ways to work around this "issue":
+
Since this device comes with a Retina (HiDPI) display, things may be really small with native resolution for some desktop environments. There are different ways to work around this "issue":
 
# Increase the DPI value to get larger fonts (other things like icons may not look great that way)
 
# Increase the DPI value to get larger fonts (other things like icons may not look great that way)
 
# Some desktop managers like [[KDM]] offer fine grained control over the size of icons, fonts, window controls, panels, etc...  
 
# Some desktop managers like [[KDM]] offer fine grained control over the size of icons, fonts, window controls, panels, etc...  
#* KDM is a great choice because the stock UI elements are vectors (not rasters which look terrible on Retina and don't scale infinitely). In addition the [[Wayland|KWin compositor]] does a remarkable job on the Retina display.
+
#* KDM is a great choice because the stock UI elements are vectors (not rasters which look terrible on Retina and do not scale infinitely). In addition the [[Wayland|KWin compositor]] does a remarkable job on the Retina display.
 
# Lower the screen resolution to 1680x1050 (works fine at least with nouveau drivers), but things look a little bit blurry, of course
 
# Lower the screen resolution to 1680x1050 (works fine at least with nouveau drivers), but things look a little bit blurry, of course
 
# Use xrandr scale option with nvidia driver to scale the resolution down to what you want. Take a look at:  http://linuxmacbookproretina.blogspot.no/
 
# Use xrandr scale option with nvidia driver to scale the resolution down to what you want. Take a look at:  http://linuxmacbookproretina.blogspot.no/
 +
# See [[HiDPI]] for more tweaks.
 +
 +
==== Nouveau backlight ====
 +
 +
If you are using the open-source Nouveau drivers and the active GPU is the Nvidia card, backlight levels can be adjusted by echoing a value to a file (as root):
 +
 +
echo 500 > /sys/class/backlight/gmux_backlight/brightness
 +
 +
To bring the backlight to its maximum level:
 +
 +
echo $(cat /sys/class/backlight/gmux_backlight/max_brightness) > /sys/class/backlight/gmux_backlight/brightness
 +
 +
==== NVIDIA backlight ====
 +
 +
If you are using the propriety nvidia drivers, note that the backlight adjustment will not work out of the box.
 +
 +
To enable backlight control (run as root):
 +
 +
setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0
 +
 +
==== Switching to/from GPUs with gpu-switch ====
 +
 +
You can switch the display output to and from the discrete or integrated intel GPU from ''within'' Arch Linux with {{AUR|gpu-switch}} if you are using the open-source {{ic|xf86-video-nouveau}} and {{ic|xf86-video-intel}} drivers.
 +
 +
'''Installation'''
 +
 +
You can install {{AUR|gpu-switch}} from the AUR.
 +
 +
Then, just run the script as root.
 +
 +
'''Usage'''
 +
 +
The command switches are {{ic|-i}}, to switch to the integrated card, and {{ic|-d}} for switching to the discrete GPU. In order to have the changes take effect, you will need to reboot.
 +
 +
===== Switch to Intel integrated GPU and turn off discrete Nvidia GPU =====
 +
 +
To switch to intel card and poweroff the discrete GPU:
 +
 +
cd /path/to/gpu-switch
 +
./gpu-switch -i
 +
 +
Then reboot.
 +
 +
Poweroff the discrete GPU using {{ic|vgaswitcheroo}} as root:
 +
 +
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
 +
 +
This will take a second or to complete.
 +
 +
Then, check whether the discrete GPU is still on:
 +
 +
cat /sys/kernel/debug/vgaswitcheroo/switch
 +
 +
The output should look like this:
 +
 +
<nowiki>
 +
0:IGD:+:Pwr:0000:00:02.0
 +
1:DIS: :Off:0000:01:00.0
 +
2:DIS-Audio: :Off:0000:01:00.1
 +
</nowiki>
 +
 +
This is useful if you have opted to have an Arch Linux-only installation and cannot access the OS X-only tool iGPU.
 +
 +
===== Keeping the discrete GPU off at boot =====
 +
 +
If you want to keep the discrete GPU off at boot, see {{AUR|systemd-vgaswitcheroo-units}}.
 +
 +
==== Graphic artifacting under b43-firmware ====
 +
 +
While on integrated graphics with the b43-firmware package, you might encounter moderate to severe graphic artifacting that appears to be correlated to wireless network traffic. (disconnected->no artifacting, connected->periodic artifacting, large transfer->severe artifacting/unusuable) This can be resolved by removing/blacklisting {{aur|b43-firmware}} and using either {{aur|broadcom-wl}} or {{aur|broadcom-wl-dkms}}.
  
 
=== Sound ===
 
=== Sound ===
  
On the MacBookPro10,2 you may need to use the 'snd_hda_intel' driver with the model option 'mbp101'. This model option goes in the modprobe configuration and is undocumented in the list of models available online, but it work admirably. (Until you do this, it will look it is working because you'll be able to get sound out through HDMI, but /not/ the built-in speakers.) (**As of September 2013** this no longer appears to be required; this should work automatically.)
+
On the MacBookPro10,2 you may need to use the 'snd_hda_intel' driver with the model option 'mbp101'. This model option goes in the modprobe configuration and is undocumented in the list of models available online, but it work admirably. (Until you do this, it will look it is working because you will be able to get sound out through HDMI, but /not/ the built-in speakers.)
 +
 
 +
{{Note|'''As of September 2013''' this no longer appears to be required; this should work automatically.}}
  
 
=== Touchpad ===
 
=== Touchpad ===
Because of the integrated button, the synaptics touchpad driver can cause some issues. Adjusting {{AUR|xf86-input-mtrack-git}} should lead to a better end result.
+
 
 +
While {{pkg|xf86-input-synaptics}} will work, the integrated button of the touchpad may cause issues. Using the {{AUR|xf86-input-mtrack-git}} driver, with a tweaked configuration should lead to a better end result:
  
 
The following config uses a single touch for left, two for middle, three for right:
 
The following config uses a single touch for left, two for middle, three for right:
Line 102: Line 216:
 
  EndSection
 
  EndSection
  
== What doesn't work (early August 2013, 3.10.3-1) ==
+
To use natural scrolling, also add the following inside this section:
 +
 
 +
    Option          "ScrollDownButton"  "4"
 +
    Option          "ScrollUpButton"    "5"
 +
    Option          "ScrollLeftButton"  "7"
 +
    Option          "ScrollRightButton" "6"
 +
 
 +
For more configurations, check the document of {{AUR|xf86-input-mtrack-git}}.
 +
 
 +
To disable the trackpad when typing, install the {{aur|dispad-git}}{{Broken package link|{{aur-mirror|dispad-git}}}} utility.
 +
 
 +
=== Memory Card (SDHCI/SDX) Reader ===
 +
 
 +
There is currently a bug in the kernel (4.7.x) where the internal SD card reader times out.
 +
 
 +
As a workaround you will need to reload the sdhci kernel modules, as per: https://bugzilla.kernel.org/show_bug.cgi?id=73241#c55
 +
 
 +
  sudo rmmod sdhci-pci sdhci
 +
  sudo modprobe sdhci debug_quirks2=4
 +
  sudo modprobe sdhci-pci
 +
 
 +
== What does not work (early August 2013, 3.10.3-1) ==
  
 
=== General ===
 
=== General ===
* Thunderbolt ethernet controller is not hot pluggable as of the 3.10.3 kernel. The controller cannot
+
 
 +
* The thunderbolt hotplug issue has been solved as of 3.17 for non-chained device, tested to work on 3.18.1. For versions before 3.17 and for chained devices, the controller cannot
 
** be connected and used after boot
 
** be connected and used after boot
 
** be used if the controller is logically or physically disconnected and reconnected during an active session
 
** be used if the controller is logically or physically disconnected and reconnected during an active session
 
** survive suspend and resume states because the kernel is not able to successfully change the power state
 
** survive suspend and resume states because the kernel is not able to successfully change the power state
** This is caused by a non-compliant UEFI implementation by Apple. No known workarounds exist at this point.
+
** This is caused by a non-compliant UEFI implementation by Apple.  
 
* see http://mjg59.dreamwidth.org/15948.html for further information (circa August 2012)
 
* see http://mjg59.dreamwidth.org/15948.html for further information (circa August 2012)
 +
  
 
=== Graphics ===
 
=== Graphics ===
* Using vgaswitcheroo to switch between iGPU / dGPU on the 15" version will result in a black screen. The system is still running and can be rebooted safely.
 
** The dGPU/nouveau is active on boot. As of 3.10.3-1, the only known way to switch to the iGPU/intel is to force this through gfxCardStatus v2.2.1 on MacOS (later versions of gfxCardStatus do *not* work.) This setting will survive reboots. To revert it, you must reboot into MacOS *twice* and/or reset the SMC (shutdow and press  shift+control+alt+power at the same time. Press power again to boot.)
 
** "rmmod nouveau" will crash if the dGPU is manually powered off via vgaswitcheroo. Once this happens, it will be impossible to shutdown / reboot cleanly. Fresh patches (2 August) will hopefully fix this in the future. (Note: to enter this failure state, you must use gfxCardStatus to force the iGPU, then use vgaswitcheroo explicitly. This is rather uncommon.)
 
** The dGPU / iGPU issues do not affect the 13" rmbp, which only has an intel adapter. Much simpler!
 
* Nvidia drivers 319.32 fail to suspend / resume or control the backlight out of the box.
 
** Nouveau and intel work fine.
 
* If you are experiencing problems with Nvidia drivers, try using emulated BIOS boot instead of EFI boot.
 
  
=== WiFi ===
+
<ul>
* The default b43 driver works. Open issues (as of 3.10.3-1):
+
<li>
** You need proprietary firmware (see installation section above)
+
Using vgaswitcheroo to switch between iGPU / dGPU on the 15" version will result in a black screen. The system is still running and can be rebooted safely.
** Power management is not supported
+
<ul>
** Connection may be unstable on some access points
+
<li>
** Performance is relatively low (I get double speed on the same network using an external ath9k chip)
+
The dGPU/nouveau is active on boot. As of 3.10.3-1, the only known way to switch to the iGPU/intel is to force this through gfxCardStatus v2.2.1 on MacOS (later versions of gfxCardStatus do *not* work.) This setting will survive reboots. To revert it, you must reboot into MacOS *twice* and/or reset the SMC (shutdown and press shift+control+alt+power at the same time. Press power again to boot.)
* broadcom-wl-dkms from AUR offers a better experience.
+
</li>
** If you have a screen flickering issue when WiFi is active, then switching to this driver should help.
+
<li>
 +
Another way to force iGPU/intel is to add following commands into one of the {{ic|menuentry}} in {{ic|grub.cfg}},
 +
{{bc|
 +
outb 0x7c2 1
 +
outb 0x7d4 0x28
 +
outb 0x7c2 2
 +
outb 0x7d4 0x10
 +
outb 0x7c2 2
 +
outb 0x7d4 0x40
 +
 
 +
# Power down dGPU (will not work)
 +
#outb 0x7c2 1
 +
#outb 0x7d4 0x50
 +
#outb 0x7c2 0
 +
#outb 0x7d4 0x50
 +
}}
 +
The screen will remain blank until intel driver is fully loaded. Notice that dGPU will not be powered down (adding code above will prevent the system from booting up). Workaround is to compile and run following program (need {{ic|sudo}}) after system is fully booted up.
 +
{{bc|1=
 +
#include <stdio.h>
 +
#include <sys/io.h>
 +
 
 +
#define GMUX_PORT_SWITCH_DISPLAY 0x10
 +
#define GMUX_PORT_SWITCH_DDC 0x28
 +
#define GMUX_PORT_SWITCH_EXTERNAL 0x40
 +
#define GMUX_PORT_DISCRETE_POWER 0x50
 +
#define GMUX_PORT_VALUE 0xc2
 +
#define GMUX_PORT_READ 0xd0
 +
#define GMUX_PORT_WRITE 0xd4
 +
 
 +
#define GMUX_IOSTART 0x700
 +
 
 +
typedef unsigned char u8;
 +
 
 +
enum discrete_state {STATE_ON, STATE_OFF};
 +
enum gpu_id {IGD, DIS};
 +
 
 +
static void index_write8(int port, u8 val)
 +
{
 +
outb(val, GMUX_IOSTART + GMUX_PORT_VALUE);
 +
outb((port & 0xff), GMUX_IOSTART + GMUX_PORT_WRITE);
 +
}
 +
 
 +
static u8 index_read8(int port)
 +
{
 +
u8 val;
 +
outb((port & 0xff), GMUX_IOSTART + GMUX_PORT_READ);
 +
val = inb(GMUX_IOSTART + GMUX_PORT_VALUE);
 +
 
 +
return val;
 +
}
 +
 
 +
static void set_discrete_state(enum discrete_state state)
 +
{
 +
if (state == STATE_ON) { // switch on dGPU
 +
index_write8(GMUX_PORT_DISCRETE_POWER, 1);
 +
index_write8(GMUX_PORT_DISCRETE_POWER, 3);
 +
} else { // switch off dGPU
 +
index_write8(GMUX_PORT_DISCRETE_POWER, 1);
 +
index_write8(GMUX_PORT_DISCRETE_POWER, 0);
 +
}
 +
}
 +
 
 +
static u8 get_discrete_state()
 +
{
 +
return index_read8(GMUX_PORT_DISCRETE_POWER);
 +
}
 +
 
 +
static void switchto(enum gpu_id id)
 +
{
 +
if (id == IGD) { // switch to iGPU
 +
index_write8(GMUX_PORT_SWITCH_DDC, 1);
 +
index_write8(GMUX_PORT_SWITCH_DISPLAY, 2);
 +
index_write8(GMUX_PORT_SWITCH_EXTERNAL, 2);
 +
} else { // switch to dGPU
 +
index_write8(GMUX_PORT_SWITCH_DDC, 2);
 +
index_write8(GMUX_PORT_SWITCH_DISPLAY, 3);
 +
index_write8(GMUX_PORT_SWITCH_EXTERNAL, 3);
 +
}
 +
}
 +
 
 +
int main(int argc, char **argv)
 +
{
 +
if (iopl(3) < 0) {
 +
perror("No IO permissions");
 +
return 1;
 +
}
 +
 
 +
//switchto(IGD);
 +
set_discrete_state(STATE_OFF);
 +
//printf("Discrete state: 0x%X\n", get_discrete_state());
 +
 
 +
return 0;
 +
}
 +
}}
 +
For further information, please read [https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/apple-gmux.c apple-gmux] driver inside linux kernel tree.
 +
</li>
 +
<li>
 +
"rmmod nouveau" will crash if the dGPU is manually powered off via vgaswitcheroo. Once this happens, it will be impossible to shutdown / reboot cleanly. Fresh patches (2 August) will hopefully fix this in the future. (Note: to enter this failure state, you must use gfxCardStatus to force the iGPU, then use vgaswitcheroo explicitly. This is rather uncommon.)
 +
</li>
 +
<li>
 +
The dGPU / iGPU issues do not affect the 13" rmbp, which only has an intel adapter. Much simpler!
 +
</li>
 +
</ul>
 +
</li>
 +
<li>
 +
Nvidia drivers 319.32 fail to suspend / resume or control the backlight out of the box.
 +
<ul>
 +
<li>
 +
Nouveau and intel work fine.
 +
</li>
 +
</ul>
 +
</li>
 +
<li>
 +
If you are experiencing problems with Nvidia drivers, try using emulated BIOS boot instead of EFI boot.
 +
</li>
 +
</ul>
 +
 
 +
 
  
 
== Discussions ==
 
== Discussions ==
  
 
Here are a couple of interesting threads:
 
Here are a couple of interesting threads:
 +
 
* http://ubuntuforums.org/showthread.php?t=2006475
 
* http://ubuntuforums.org/showthread.php?t=2006475
 
* https://bbs.archlinux.org/viewtopic.php?id=144255&p=1
 
* https://bbs.archlinux.org/viewtopic.php?id=144255&p=1
  
== See Also ==
+
== See also ==
* A [[Puppet]] module for installing and configuring Arch (optionally with KDE) on the MBP Retina 10,2, along with initial install instructions, is available at https://github.com/jantman/puppet-archlinux-macbookretina. It's updated quite frequently, and run daily on its author's laptop.
+
 
 +
* A [[Puppet]] module for installing and configuring Arch (optionally with KDE) on the MBP Retina 10,2, along with initial install instructions, is available at https://github.com/jantman/puppet-archlinux-macbookretina. It is updated quite frequently, and run daily on its author's laptop.

Latest revision as of 18:57, 22 September 2016

This page should help you setting up ArchLinux on a MacBook Pro 10,1 with Retina display. Most of the steps are the same or very similar to the regular ArchLinux installation. However, because this is very new hardware, the setup requires a few different steps. The general installation guidelines are descibed in MacBook.

Note: To have all hardware supported, you should run this Notebook with Kernel 3.7 or newer.

Preparing for the Installation

Preparing the Hard drive

Assuming you want to dual boot with OS X, you have to shrink its partition with the Disk Utility. You can either create your Linux partition directly here, or do that later in Linux during the installation (using parted and mkfs).

Using the Thunderbolt to Ethernet adapter

As of late 2014, thunderbolt hotplugging has been included in the mainline Linux kernel. Ethernet cables can now be used as usual through the thunderbolt adapter. [1]

Using a USB-to-Ethernet adapter

No special configuration is necessary to get this to work.

Getting wireless firmware

In order for the Wi-Fi chipset to work, you need to get the firmware for it. You can just copy it from another b43-enabled Arch, extract it from Broadcom's driver using b43-fwcutter, or get the firmware through the b43-firmwareAUR package available in the AUR. In the end, you should have a folder named b43 with a lot of .fw files in it.

USB Tethering

If you have a smartphone, you can also try tethering your device to get connected to the internet. This should work out of the box.

Installation

Booting the live image

Download the latest ISO from the download page and prepare a live USB as outlined in USB flash installation media.

Shut down the Macbook. Plug in the USB drive. Hold the option key, then press the power button. After a few seconds, you should see Apple's boot loader display the choice of either starting up the built-in drive with OS X or the USB drive you plugged in.

Select the live USB with the arrow keys, and press Enter to boot into the live Arch Linux environment.

Note: You should not need to pass in any kernel parameters to boot successfully into the live environment.

Connecting Wi-Fi

Note: You can skip this if you use the Thunderbolt or USB-to-Ethernet adapter for the installation.

After it has finished booting, enter a command line. Copy the entire folder with the firmware for your wireless card to /usr/lib/firmware/.

Now you should be able to use wifi-menu to connect to your Wi-Fi network.

The installation

Note: Refer to the MacBook page if you do not want to have a separate partition for GRUB but rather prefer to use rEFInd (or rEFIt).

Run the installation wizard. When asked to partition your hard drive, create a small HFS partition. This is where you put the standalone GRUB package after the installation. The rest of the installation is pretty much the same as usual. When choosing the bootloader, select GRUB, and install it. Do not worry about any errors; we will create the bootable EFI image on our own afterwards.

After the installation has completed, directly copy the Wi-Fi firmware to the installed system to /tmp/install/usr/lib/firmware/.

Alternatively, install broadcom-wl-dkmsAUR from the AUR to improve Wi-Fi.

Bootloader

Direct EFI booting

See UEFI Bootloaders.

As of August 2013, refind can autodetect the Arch kernel, removing the need for copying the kernel into the EFI partition. Simply install refind and enable the "scan_all_linux_kernels" and "also_scan_dirs" options in refind.conf (see link above for instructions.)

GRUB

Another solution is to install GRUB. Edit /tmp/install/boot/grub/grub.cfg and edit the boot entry to load Linux mainline instead of the normal one. Also append noapic to the kernel line again.

Now cd into /tmp/install/ and create the GRUB image by calling:

grub-mkstandalone -o grub-standalone-x86_64.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi -C xz boot/grub/grub.cfg

This will create file called grub-standalone-x86_64.efi which contains GRUB and the config file. It is important to cd into the right directory to make it pick up the config file and put it into the right place within the image. Copy this file to the HFS partition you have created earlier. Downside of this method is that you need to repeat this step whenever you want to change the GRUB config.

Reboot the machine and boot into OS X. The HFS partition should be mounted and the GRUB standalone image in there. Follow the steps on this page to create the files needed to make the Apple boot loader pick up GRUB: http://mjg59.dreamwidth.org/7468.html. After creating the files, use bless on the GRUB image on the partition. If you want to boot automatically to Arch, append --setBoot.

After another reboot, you should be able to select your installed Arch Linux by keeping the alt button pressed while booting in case you have not used --setBoot while blessing.

Post installation

Wi-Fi

The Macbook Pro 10,x comes with the Broadcom BCM4331 Wireless Chipset.

There are two major options to get this chipset working in Arch Linux:

The b43-firmwareAUR package contains the open-source, reverse-engineered firmware for the chipset.

The broadcom-wlAUR and broadcom-wl-dkmsAUR packages ship with the propriety, restricted-license drivers for the chipset.

See Broadcom wireless for more information.

Graphics

Note: In order to plug in an external display, you will need to have the NVIDIA card powered on as the HDMI and thunderbolt outputs are hardwired to use the NVIDIA card.

General Notes

The Laptop comes with an nVidia and an Intel chip. The Nouveau xf86-video-nouveau, the intel xf86-video-intel (from 3.6-rc5) and proprietary nvidia (from 302.17) drivers work. You can install the nvidia driver through nvidia or the AUR package nvidia-beta-allAUR.

Note: As of September, 2013 the current nvidia driver (325.15-5) does not work with the current 3.10 series kernels; X will die with an error about "Failed to allocate EVO core DMA push buffer" and leave you with a black screen (but able to SSH in to the machine). Your best current bet is to use a 3.9-series kernel and the older 319.32-series nvidia driver.

Since this device comes with a Retina (HiDPI) display, things may be really small with native resolution for some desktop environments. There are different ways to work around this "issue":

  1. Increase the DPI value to get larger fonts (other things like icons may not look great that way)
  2. Some desktop managers like KDM offer fine grained control over the size of icons, fonts, window controls, panels, etc...
    • KDM is a great choice because the stock UI elements are vectors (not rasters which look terrible on Retina and do not scale infinitely). In addition the KWin compositor does a remarkable job on the Retina display.
  3. Lower the screen resolution to 1680x1050 (works fine at least with nouveau drivers), but things look a little bit blurry, of course
  4. Use xrandr scale option with nvidia driver to scale the resolution down to what you want. Take a look at: http://linuxmacbookproretina.blogspot.no/
  5. See HiDPI for more tweaks.

Nouveau backlight

If you are using the open-source Nouveau drivers and the active GPU is the Nvidia card, backlight levels can be adjusted by echoing a value to a file (as root):

echo 500 > /sys/class/backlight/gmux_backlight/brightness

To bring the backlight to its maximum level:

echo $(cat /sys/class/backlight/gmux_backlight/max_brightness) > /sys/class/backlight/gmux_backlight/brightness

NVIDIA backlight

If you are using the propriety nvidia drivers, note that the backlight adjustment will not work out of the box.

To enable backlight control (run as root):

setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0

Switching to/from GPUs with gpu-switch

You can switch the display output to and from the discrete or integrated intel GPU from within Arch Linux with gpu-switchAUR if you are using the open-source xf86-video-nouveau and xf86-video-intel drivers.

Installation

You can install gpu-switchAUR from the AUR.

Then, just run the script as root.

Usage

The command switches are -i, to switch to the integrated card, and -d for switching to the discrete GPU. In order to have the changes take effect, you will need to reboot.

Switch to Intel integrated GPU and turn off discrete Nvidia GPU

To switch to intel card and poweroff the discrete GPU:

cd /path/to/gpu-switch
./gpu-switch -i

Then reboot.

Poweroff the discrete GPU using vgaswitcheroo as root:

echo OFF > /sys/kernel/debug/vgaswitcheroo/switch

This will take a second or to complete.

Then, check whether the discrete GPU is still on:

cat /sys/kernel/debug/vgaswitcheroo/switch

The output should look like this:

0:IGD:+:Pwr:0000:00:02.0
1:DIS: :Off:0000:01:00.0
2:DIS-Audio: :Off:0000:01:00.1

This is useful if you have opted to have an Arch Linux-only installation and cannot access the OS X-only tool iGPU.

Keeping the discrete GPU off at boot

If you want to keep the discrete GPU off at boot, see systemd-vgaswitcheroo-unitsAUR.

Graphic artifacting under b43-firmware

While on integrated graphics with the b43-firmware package, you might encounter moderate to severe graphic artifacting that appears to be correlated to wireless network traffic. (disconnected->no artifacting, connected->periodic artifacting, large transfer->severe artifacting/unusuable) This can be resolved by removing/blacklisting b43-firmwareAUR and using either broadcom-wlAUR or broadcom-wl-dkmsAUR.

Sound

On the MacBookPro10,2 you may need to use the 'snd_hda_intel' driver with the model option 'mbp101'. This model option goes in the modprobe configuration and is undocumented in the list of models available online, but it work admirably. (Until you do this, it will look it is working because you will be able to get sound out through HDMI, but /not/ the built-in speakers.)

Note: As of September 2013 this no longer appears to be required; this should work automatically.

Touchpad

While xf86-input-synaptics will work, the integrated button of the touchpad may cause issues. Using the xf86-input-mtrack-gitAUR driver, with a tweaked configuration should lead to a better end result:

The following config uses a single touch for left, two for middle, three for right:

Section "InputClass"
    MatchIsTouchpad "on"
    Identifier      "Touchpads"
    Driver          "mtrack"
    Option          "Sensitivity" "0.65"
    Option          "IgnoreThumb" "true"
    Option          "IgnorePalm" "true"
    Option          "TapButton1" "1"  
    Option          "TapButton2" "3"
    Option          "TapButton3" "2"
    Option          "ClickFinger1" "1"
    Option          "ClickFinger2" "3"
    Option          "ClickFinger3" "2"
    Option          "BottomEdge" "25"
EndSection

To use natural scrolling, also add the following inside this section:

    Option          "ScrollDownButton"  "4"
    Option          "ScrollUpButton"    "5"
    Option          "ScrollLeftButton"  "7"
    Option          "ScrollRightButton" "6"

For more configurations, check the document of xf86-input-mtrack-gitAUR.

To disable the trackpad when typing, install the dispad-gitAUR[broken link: archived in aur-mirror] utility.

Memory Card (SDHCI/SDX) Reader

There is currently a bug in the kernel (4.7.x) where the internal SD card reader times out.

As a workaround you will need to reload the sdhci kernel modules, as per: https://bugzilla.kernel.org/show_bug.cgi?id=73241#c55

 sudo rmmod sdhci-pci sdhci
 sudo modprobe sdhci debug_quirks2=4
 sudo modprobe sdhci-pci

What does not work (early August 2013, 3.10.3-1)

General

  • The thunderbolt hotplug issue has been solved as of 3.17 for non-chained device, tested to work on 3.18.1. For versions before 3.17 and for chained devices, the controller cannot
    • be connected and used after boot
    • be used if the controller is logically or physically disconnected and reconnected during an active session
    • survive suspend and resume states because the kernel is not able to successfully change the power state
    • This is caused by a non-compliant UEFI implementation by Apple.
  • see http://mjg59.dreamwidth.org/15948.html for further information (circa August 2012)


Graphics

  • Using vgaswitcheroo to switch between iGPU / dGPU on the 15" version will result in a black screen. The system is still running and can be rebooted safely.
    • The dGPU/nouveau is active on boot. As of 3.10.3-1, the only known way to switch to the iGPU/intel is to force this through gfxCardStatus v2.2.1 on MacOS (later versions of gfxCardStatus do *not* work.) This setting will survive reboots. To revert it, you must reboot into MacOS *twice* and/or reset the SMC (shutdown and press shift+control+alt+power at the same time. Press power again to boot.)
    • Another way to force iGPU/intel is to add following commands into one of the menuentry in grub.cfg,
      outb 0x7c2 1
      outb 0x7d4 0x28
      outb 0x7c2 2
      outb 0x7d4 0x10
      outb 0x7c2 2
      outb 0x7d4 0x40
      
      # Power down dGPU (will not work)
      #outb 0x7c2 1
      #outb 0x7d4 0x50
      #outb 0x7c2 0
      #outb 0x7d4 0x50
      

      The screen will remain blank until intel driver is fully loaded. Notice that dGPU will not be powered down (adding code above will prevent the system from booting up). Workaround is to compile and run following program (need sudo) after system is fully booted up.

      #include <stdio.h>
      #include <sys/io.h>
      
      #define GMUX_PORT_SWITCH_DISPLAY	0x10
      #define GMUX_PORT_SWITCH_DDC		0x28
      #define GMUX_PORT_SWITCH_EXTERNAL	0x40
      #define GMUX_PORT_DISCRETE_POWER	0x50
      #define GMUX_PORT_VALUE			0xc2
      #define GMUX_PORT_READ			0xd0
      #define GMUX_PORT_WRITE			0xd4
      
      #define GMUX_IOSTART		0x700
      
      typedef unsigned char u8;
      
      enum discrete_state {STATE_ON, STATE_OFF};
      enum gpu_id {IGD, DIS};
      
      static void index_write8(int port, u8 val)
      {
      	outb(val, GMUX_IOSTART + GMUX_PORT_VALUE);
      	outb((port & 0xff), GMUX_IOSTART + GMUX_PORT_WRITE);
      }
      
      static u8 index_read8(int port)
      {
      	u8 val;
      	outb((port & 0xff), GMUX_IOSTART + GMUX_PORT_READ);
      	val = inb(GMUX_IOSTART + GMUX_PORT_VALUE);
      
      	return val;
      }
      
      static void set_discrete_state(enum discrete_state state)
      {
      	if (state == STATE_ON) {	// switch on dGPU
      		index_write8(GMUX_PORT_DISCRETE_POWER, 1);
      		index_write8(GMUX_PORT_DISCRETE_POWER, 3);
      	} else {			// switch off dGPU
      		index_write8(GMUX_PORT_DISCRETE_POWER, 1);
      		index_write8(GMUX_PORT_DISCRETE_POWER, 0);
      	}
      }
      
      static u8 get_discrete_state()
      {
      	return index_read8(GMUX_PORT_DISCRETE_POWER);
      }
      
      static void switchto(enum gpu_id id)
      {
      	if (id == IGD) {	// switch to iGPU
      		index_write8(GMUX_PORT_SWITCH_DDC, 1);
      		index_write8(GMUX_PORT_SWITCH_DISPLAY, 2);
      		index_write8(GMUX_PORT_SWITCH_EXTERNAL, 2);
      	} else {		// switch to dGPU
      		index_write8(GMUX_PORT_SWITCH_DDC, 2);
      		index_write8(GMUX_PORT_SWITCH_DISPLAY, 3);
      		index_write8(GMUX_PORT_SWITCH_EXTERNAL, 3);
      	}
      }
      
      int main(int argc, char **argv)
      {
      	if (iopl(3) < 0) {
      		perror("No IO permissions");
      		return 1;
      	}
      
      	//switchto(IGD);
      	set_discrete_state(STATE_OFF);
      	//printf("Discrete state: 0x%X\n", get_discrete_state());
      
      	return 0;
      }

      For further information, please read apple-gmux driver inside linux kernel tree.

    • "rmmod nouveau" will crash if the dGPU is manually powered off via vgaswitcheroo. Once this happens, it will be impossible to shutdown / reboot cleanly. Fresh patches (2 August) will hopefully fix this in the future. (Note: to enter this failure state, you must use gfxCardStatus to force the iGPU, then use vgaswitcheroo explicitly. This is rather uncommon.)
    • The dGPU / iGPU issues do not affect the 13" rmbp, which only has an intel adapter. Much simpler!
  • Nvidia drivers 319.32 fail to suspend / resume or control the backlight out of the box.
    • Nouveau and intel work fine.
  • If you are experiencing problems with Nvidia drivers, try using emulated BIOS boot instead of EFI boot.


Discussions

Here are a couple of interesting threads:

See also