Skip to content

Instantly share code, notes, and snippets.

@roadrunner2
Last active July 20, 2025 17:12

Revisions

  1. roadrunner2 revised this gist Jul 28, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion 61-libinput-local.hwdb
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    libinput:name:*Apple SPI Touchpad*:dmi:*
    LIBINPUT_MODEL_APPLE_TOUCHPAD=1
    LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal
    LIBINPUT_ATTR_TOUCH_SIZE_RANGE=200:150
    LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=1200

    libinput:name:*Apple SPI Keyboard*:dmi:*
    LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal
  2. roadrunner2 revised this gist Jul 28, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion local-overrides.quirks
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,13 @@
    [MacBook(Pro) SPI Touchpads]
    MatchName=*Apple SPI Touchpad*
    ModelAppleTouchpad=1
    AttrKeyboardIntegration=internal
    AttrTouchSizeRange=200:150
    AttrPalmSizeThreshold=1100

    [MacBook(Pro) SPI Keyboards]
    MatchName=*Apple SPI Keyboard*
    AttrKeyboardIntegration=internal

    [MacBookPro Touchbar]
    MatchBus=usb
    MatchVendor=0x05AC
  3. roadrunner2 revised this gist May 19, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -96,10 +96,13 @@ sudo dkms install applespi/0.1
    popd
    ```

    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb), [61-libinput-local.hwdb](#file-61-libinput-local-hwdb), and [local-overrides.quirks](#file-local-overrides-quirks) from this gist - the `61-libinput-local.hwdb` is needed for libinput versions < 1.12, the `local-overrides.quirks` for libinput versions >= 1.12):
    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb), [61-libinput-local.hwdb](#file-61-libinput-local-hwdb), and [local-overrides.quirks](#file-local-overrides-quirks) from this gist - the `61-evdev-local.hwdb` is only needed for udev < 242, the `61-libinput-local.hwdb` is needed for libinput versions < 1.12, the `local-overrides.quirks` for libinput versions >= 1.12):
    ```
    # if 'udevadm --version' less than 242:
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    # if 'libinput --version' less than 1.12:
    sudo cp ...the-downloaded-61-libinput-local.hwdb... /etc/udev/hwdb.d/61-libinput-local.hwdb
    # if 'libinput --version' 1.12 or later:
    sudo cp ...the-downloaded-local-overrides.quirks... /etc/libinput/local-overrides.quirks
    sudo systemd-hwdb update
    ```
  4. roadrunner2 revised this gist May 18, 2019. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -179,9 +179,10 @@ sudo mkdir /boot/efi/EFI/custom
    sudo cp apple_set_os.efi /boot/efi/EFI/custom

    config_dir=$(dirname $(sudo find /boot -name grub.cfg))
    cat <<EOF | sudo tee "$config_dir"/custom.cfg > /dev/null
    cat <<"EOF" | sudo tee "$config_dir"/custom.cfg > /dev/null
    insmod chain
    chainloader (\${root})/EFI/custom/apple_set_os.efi
    search --no-floppy --set=cuspart --file /EFI/custom/apple_set_os.efi
    chainloader (${cuspart})/EFI/custom/apple_set_os.efi
    boot
    EOF

  5. roadrunner2 revised this gist Mar 1, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -165,9 +165,9 @@ In the mean time some folks have that one or both of the following hacks make th

    The amdgpu driver works well and is automatically loaded on MacBookPro13,3. On the 13 inch models the use of the ```intel``` Xorg driver may need to be forced (see first comment below).

    ## Using the iGPU (,13 models only)
    ## Using the iGPU (\*,3 models only)

    The ,13 models have both an iGPU (intel) as well as a dGPU (amd). By default the dGPU is used. While this works well, it does use a lot more power than the iGPU. The following will set things up so the machine uses the iGPU upon boot (but see the caveats below):
    The \*,3 models have both an iGPU (intel) as well as a dGPU (amd). By default the dGPU is used. While this works well, it does use a lot more power than the iGPU. The following will set things up so the machine uses the iGPU upon boot (but see the caveats below):
    ```sh
    mkdir gpu-switch
    cd gpu-switch
  6. roadrunner2 revised this gist Jan 13, 2019. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -181,7 +181,6 @@ sudo cp apple_set_os.efi /boot/efi/EFI/custom
    config_dir=$(dirname $(sudo find /boot -name grub.cfg))
    cat <<EOF | sudo tee "$config_dir"/custom.cfg > /dev/null
    insmod chain
    #search --no-floppy --set=root --label EFI
    chainloader (\${root})/EFI/custom/apple_set_os.efi
    boot
    EOF
  7. roadrunner2 revised this gist Jan 13, 2019. 1 changed file with 54 additions and 1 deletion.
    55 changes: 54 additions & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -163,7 +163,60 @@ In the mean time some folks have that one or both of the following hacks make th

    ## Display

    The amdgpu driver works well and is automatically loaded on MacBookPro13,3. On the 13 inch models the use of the ```intel``` needs to be forced (see first comment below).
    The amdgpu driver works well and is automatically loaded on MacBookPro13,3. On the 13 inch models the use of the ```intel``` Xorg driver may need to be forced (see first comment below).

    ## Using the iGPU (,13 models only)

    The ,13 models have both an iGPU (intel) as well as a dGPU (amd). By default the dGPU is used. While this works well, it does use a lot more power than the iGPU. The following will set things up so the machine uses the iGPU upon boot (but see the caveats below):
    ```sh
    mkdir gpu-switch
    cd gpu-switch

    # Enable the iGPU at boot
    curl -O -L https://github.com/0xbb/apple_set_os.efi/releases/download/v1/apple_set_os.efi

    sudo mkdir /boot/efi/EFI/custom
    sudo cp apple_set_os.efi /boot/efi/EFI/custom

    config_dir=$(dirname $(sudo find /boot -name grub.cfg))
    cat <<EOF | sudo tee "$config_dir"/custom.cfg > /dev/null
    insmod chain
    #search --no-floppy --set=root --label EFI
    chainloader (\${root})/EFI/custom/apple_set_os.efi
    boot
    EOF

    # Switch the default gpu on boot to iGPU
    curl -O -L https://raw.githubusercontent.com/0xbb/gpu-switch/master/gpu-switch
    chmod +x gpu-switch

    ./gpu-switch -i

    # Service to disable the dGPU
    cat <<EOF | sudo tee /etc/systemd/system/disable-dgpu.service > /dev/null
    [Unit]
    Description=Disable the dGPU
    [Service]
    Type=oneshot
    ExecStart=/bin/sh -c 'echo OFF > /sys/kernel/debug/vgaswitcheroo/switch'
    ExecStop=/bin/sh -c 'echo ON > /sys/kernel/debug/vgaswitcheroo/switch'
    RemainAfterExit=yes
    [Install]
    WantedBy=multi-user.target
    EOF

    sudo chmod 644 /etc/systemd/system/disable-dgpu.service

    cd -
    ```

    Once you then disable the dGPU this will save save you about 5W - 6W, or ⅓ of the power. However, there are several caveats to aware of:
    * The dGPU needs to be manually disabled after each boot and first login with `sudo systemctl start disable-dgpu` - trying to have it run automatically at boot via `systemctl enable disable-gpu` leads to hangs.
    * In order to use an external display (via Thunderbolt/DisplayPort) the dGPU needs to be enabled again (the iGPU is not wired up for that): `sudo systemctl disable disable-dgpu`
    * The amd driver does not handle disabling and re-enabling the of the dGPU very well. In particular system shutdown may hang or just take several minutes, and you may see various errors in the kernel logs when disabling and re-enabling.
    * If you boot into MacOS, then when booting back into Linux you'll need to change the default gpu back to the iGPU again: boot, run `gpu-switch/gpu-switch -i`, and reboot.

    ## Camera

  8. roadrunner2 revised this gist Jan 13, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion local-overrides.quirks
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ AttrKeyboardIntegration=internal
    AttrTouchSizeRange=200:150
    AttrPalmSizeThreshold=1100

    [MacBook(Pro) Touchbar]
    [MacBookPro Touchbar]
    MatchBus=usb
    MatchVendor=0x05AC
    MatchProduct=0x8600
  9. roadrunner2 revised this gist Jan 13, 2019. 1 changed file with 3 additions and 5 deletions.
    8 changes: 3 additions & 5 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -20,16 +20,14 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also
    * Camera
    * Bluetooth (older kernels need patches)
    * WiFi on MBP13,1 and MBP14,1
    * Thunderbolt
    * DisplayPort

    ## What doesn't work
    * WiFi on ,2 and ,3 models (though some folks have had success with some of the workarounds)
    * Suspend/Resume
    * Suspend/Resume (works partially on 13,3 models)
    * Audio (two cards show up, and intel driver is loaded, but no sound)

    ## Untested
    * Thunderbolt
    * DisplayPort

    # Details

    ## Partitioning
  10. roadrunner2 revised this gist Jan 13, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -98,7 +98,7 @@ sudo dkms install applespi/0.1
    popd
    ```

    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb), [61-libinput-local.hwdb](#file-61-libinput-local-hwdb), and [local-overrides.quirks](#file-local-overrides-quirks) from this gist - the `/etc/libinput/local-overrides.quirks` is needed for libinput version < 1.12, the `local-overrides.quirks` for libinput version >= 1.12):
    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb), [61-libinput-local.hwdb](#file-61-libinput-local-hwdb), and [local-overrides.quirks](#file-local-overrides-quirks) from this gist - the `61-libinput-local.hwdb` is needed for libinput versions < 1.12, the `local-overrides.quirks` for libinput versions >= 1.12):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    sudo cp ...the-downloaded-61-libinput-local.hwdb... /etc/udev/hwdb.d/61-libinput-local.hwdb
  11. roadrunner2 revised this gist Jan 13, 2019. 2 changed files with 14 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -98,10 +98,11 @@ sudo dkms install applespi/0.1
    popd
    ```

    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb) and [61-libinput-local.hwdb](#file-61-libinput-local-hwdb) from this gist):
    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb), [61-libinput-local.hwdb](#file-61-libinput-local-hwdb), and [local-overrides.quirks](#file-local-overrides-quirks) from this gist - the `/etc/libinput/local-overrides.quirks` is needed for libinput version < 1.12, the `local-overrides.quirks` for libinput version >= 1.12):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    sudo cp ...the-downloaded-61-libinput-local.hwdb... /etc/udev/hwdb.d/61-libinput-local.hwdb
    sudo cp ...the-downloaded-local-overrides.quirks... /etc/libinput/local-overrides.quirks
    sudo systemd-hwdb update
    ```

    12 changes: 12 additions & 0 deletions local-overrides.quirks
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    [MacBook(Pro) SPI Touchpads]
    MatchName=*Apple SPI Touchpad*
    ModelAppleTouchpad=1
    AttrKeyboardIntegration=internal
    AttrTouchSizeRange=200:150
    AttrPalmSizeThreshold=1100

    [MacBook(Pro) Touchbar]
    MatchBus=usb
    MatchVendor=0x05AC
    MatchProduct=0x8600
    AttrKeyboardIntegration=internal
  12. roadrunner2 revised this gist Nov 28, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -74,15 +74,15 @@ Next we need to prepare for the modules to be included in the ramdisk (so they a
    ```
    cat <<EOF | sudo tee /etc/dracut.conf.d/keyboard.conf
    # load all drivers needed for the keyboard+touchpad
    add_drivers+="applespi intel_lpss_pci spi_pxa2xx_platform appletb"
    add_drivers+="applespi intel_lpss_pci spi_pxa2xx_platform apple-ib-tb"
    EOF
    ```
    On distros using ```mkinitramfs``` instead of ```dracut``` you'll want to do the following instead:
    ```
    cat <<EOF | sudo tee -a /etc/initramfs-tools/modules
    # drivers for keyboard+touchpad
    applespi
    appletb
    apple-ib-tb
    intel_lpss_pci
    spi_pxa2xx_platform
    EOF
    @@ -107,7 +107,7 @@ sudo systemd-hwdb update

    You can test the drivers by loading them and their dependencies:
    ```
    sudo modprobe intel_lpss_pci spi_pxa2xx_platform applespi appletb
    sudo modprobe intel_lpss_pci spi_pxa2xx_platform applespi apple-ib-tb
    ```

    Finally, reboot to make sure it all works correctly:
  13. roadrunner2 revised this gist Jul 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -98,7 +98,7 @@ sudo dkms install applespi/0.1
    popd
    ```

    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb) and [61-libinput-local.hwdb](#file-61-libinput-local.hwdb) from this gist):
    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb) and [61-libinput-local.hwdb](#file-61-libinput-local-hwdb) from this gist):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    sudo cp ...the-downloaded-61-libinput-local.hwdb... /etc/udev/hwdb.d/61-libinput-local.hwdb
  14. roadrunner2 revised this gist Jul 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -98,7 +98,7 @@ sudo dkms install applespi/0.1
    popd
    ```

    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb) and [61-libinput-local.hwdb](#61-libinput-local.hwdb) from this gist):
    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb) and [61-libinput-local.hwdb](#file-61-libinput-local.hwdb) from this gist):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    sudo cp ...the-downloaded-61-libinput-local.hwdb... /etc/udev/hwdb.d/61-libinput-local.hwdb
  15. roadrunner2 revised this gist Jul 14, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -158,7 +158,7 @@ WiFi works fine on MBP13,1 and MBP14,1. But the other models use a different chi

    Bug report: https://bugzilla.kernel.org/show_bug.cgi?id=193121

    In the mean time some folks have that one or both of the following hack make the WiFi work well enough them (personally, while they do improve the situation, I have not found them to be sufficient enough for actual work, i.e. I still see many packet drops and connection failures - YMMV):
    In the mean time some folks have that one or both of the following hacks make the WiFi work well enough them (personally, while they do improve the situation, I have not found them to be sufficient enough for actual work, i.e. I still see many packet drops and connection failures - YMMV):
    * reduce the transmit power: `sudo iwconfig wlp3s0 txpower 10`
    * edit the firmware blob (`/lib/firmware/brcm/brcmfmac43602-pcie.bin`) and modify the `regrev` and `ccode` values (see the above bugreport for details)

  16. roadrunner2 revised this gist Jul 14, 2018. 1 changed file with 8 additions and 3 deletions.
    11 changes: 8 additions & 3 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -18,10 +18,11 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also
    * USB
    * Sensors (install ```lm_sensors``` package)
    * Camera
    * Bluetooth (with patched kernel)
    * Bluetooth (older kernels need patches)
    * WiFi on MBP13,1 and MBP14,1

    ## What doesn't work
    * WiFi (technically it's there, but it's so bad as to be unusable)
    * WiFi on ,2 and ,3 models (though some folks have had success with some of the workarounds)
    * Suspend/Resume
    * Audio (two cards show up, and intel driver is loaded, but no sound)

    @@ -150,13 +151,17 @@ The touchpad defaults to using the bottom-left corner for right-clicks - to get

    ## WiFi

    The ```brcmfmac``` driver is automatically loaded. However, there are a number of issues with it, making it for all practical purposes unusable:
    WiFi works fine on MBP13,1 and MBP14,1. But the other models use a different chipset, and while on those the ```brcmfmac``` driver is automatically loaded, there are a number of issues with it, making it for all practical purposes unusable:
    * it only does 2.4GHz - no 5GHz channels are visible
    * it has an extremely low sensitivity - you must be within a few feet of the base station, and even at 5 feet distance it shows a weak signal.
    * it stops working after 10 or 15 or so minutes; turning WiFi off, waiting a several minutes, and then turning it back on generally gets it working again. Maybe a thermal issue?

    Bug report: https://bugzilla.kernel.org/show_bug.cgi?id=193121

    In the mean time some folks have that one or both of the following hack make the WiFi work well enough them (personally, while they do improve the situation, I have not found them to be sufficient enough for actual work, i.e. I still see many packet drops and connection failures - YMMV):
    * reduce the transmit power: `sudo iwconfig wlp3s0 txpower 10`
    * edit the firmware blob (`/lib/firmware/brcm/brcmfmac43602-pcie.bin`) and modify the `regrev` and `ccode` values (see the above bugreport for details)

    ## Display

    The amdgpu driver works well and is automatically loaded on MacBookPro13,3. On the 13 inch models the use of the ```intel``` needs to be forced (see first comment below).
  17. roadrunner2 revised this gist Apr 2, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -101,6 +101,7 @@ Next we need to set the proper dpi for the touchpad and adjust the sensitivity (
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    sudo cp ...the-downloaded-61-libinput-local.hwdb... /etc/udev/hwdb.d/61-libinput-local.hwdb
    sudo systemd-hwdb update
    ```

    You can test the drivers by loading them and their dependencies:
  18. roadrunner2 revised this gist Apr 2, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -97,9 +97,10 @@ sudo dkms install applespi/0.1
    popd
    ```

    Next we need to set the proper dpi for the touchpad (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb) from this gist):
    Next we need to set the proper dpi for the touchpad and adjust the sensitivity (download the [61-evdev-local.hwdb](#file-61-evdev-local-hwdb) and [61-libinput-local.hwdb](#61-libinput-local.hwdb) from this gist):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    sudo cp ...the-downloaded-61-libinput-local.hwdb... /etc/udev/hwdb.d/61-libinput-local.hwdb
    ```

    You can test the drivers by loading them and their dependencies:
  19. roadrunner2 revised this gist Apr 2, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -174,4 +174,6 @@ As of kernel 4.16 bluetooth works out of the box; older kernels need patches - s
    * Ensure your kernel is configured with `CONFIG_BT_HCIUART_BCM=y`
    * apply the patches from [hci_bcm-4.13](https://github.com/roadrunner2/linux/tree/hci_bcm-4.13), [hci_bcm-4.14](https://github.com/roadrunner2/linux/tree/hci_bcm-4.14), or [hci_bcm-4.15](https://github.com/roadrunner2/linux/tree/hci_bcm-4.15), depending on whether you have a 4.13 or earlier, 4.14, or 4.15 kernel.
    * build and reboot
    * on 4.14 and earlier apply the service patch from the above comment and start the service as described there (not necessary on 4.15 and later).
    * on 4.14 and earlier apply the service patch from the above comment and start the service as described there (not necessary on 4.15 and later).

    Note that as of 4.16 there are still issues on MacBookPro13,1 and MacBookPro14,1 - see the above bug for details on what additional patches are needed.
  20. roadrunner2 revised this gist Apr 2, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -114,7 +114,7 @@ sudo reboot

    ### Screen Brightness Control

    Screen brightness control works out of the box on MacBookPro13,1 and MacBookPro13,2, but requires a kernel patch on MacBookPro13,3 (see also https://github.com/Dunedan/mbp-2016-linux/issues/2). The following will create and install the patched `apple-gmux`:
    Screen brightness control works out of the box on MacBookPro13,1 and MacBookPro13,2 (all kernels), and MacBookPro13,3 with recent kernels, but requires a kernel patch on MacBookPro13,3 with older kernels (see also https://github.com/Dunedan/mbp-2016-linux/issues/2). Specifically, if you have any of these kernels you need to patch: < 4.14, 4.14 - 4.14.21, 4.15 - v4.15.5 (i.e. the issue was fixed in 4.14.21, 4.15.5, and 4.16). The following will create and install the patched `apple-gmux`:
    ```
    mkdir apple-gmux
    pushd apple-gmux
  21. roadrunner2 revised this gist Mar 4, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

    The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there's [another tutorial](https://github.com/chisNaN/ubuntu-on-macbook12) focused on that distro and the MacBook.
    The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials ([here](https://github.com/chisNaN/ubuntu-on-macbook12) and [here](https://nixaid.com/linux-on-macbookpro/)) focused on that distro and the MacBook.

    **Note**: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - see the updated instructions below and make sure to update your clone of the roadrunner2/macbook12-spi-driver repo to get the latest drivers.

  22. roadrunner2 revised this gist Feb 15, 2018. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also
    # Summary Of Current State
    ## What works
    * Booting (i.e Grub etc)
    * Recognizes disk on MacBookPro13,3; MacBookPro13,2 and MacBookPro13,1 need kernel patch
    * Recognizes disk on all models (older kernels may need patch for some models, though)
    * Keyboard, touchpad, and basic touchbar functionality
    * HiDPI detection
    * Accelerated video
    @@ -161,16 +161,17 @@ The amdgpu driver works well and is automatically loaded on MacBookPro13,3. On t

    ## Camera

    For MacBookPro13,3 you need the following:
    MacBookPro13,3/14,3: works out of the box on kernels 4.13 and later; on earlier kernels you need the following:
    ```
    echo "options uvcvideo quirks=0x100" > /etc/modprobe.d/uvcvideo.conf
    ```
    For MacBookPro13,[12] see https://github.com/Dunedan/mbp-2016-linux/issues/15.

    For MacBookPro[13,14],[12] you need the [bcwc_pcie](https://github.com/patjak/bcwc_pcie) driver (mainline branch) - see also https://github.com/Dunedan/mbp-2016-linux/issues/15.

    ## Bluetooth

    This currently needs patches to the kernel - see https://github.com/Dunedan/mbp-2016-linux/issues/29#issuecomment-331693489 and following discussion for details. But in short you'll need to:
    As of kernel 4.16 bluetooth works out of the box; older kernels need patches - see https://github.com/Dunedan/mbp-2016-linux/issues/29#issuecomment-331693489 and following discussion for details. But in short you'll need to:
    * Ensure your kernel is configured with `CONFIG_BT_HCIUART_BCM=y`
    * apply the patches from [hci_bcm-4.13](https://github.com/roadrunner2/linux/tree/hci_bcm-4.13), [hci_bcm-4.14](https://github.com/roadrunner2/linux/tree/hci_bcm-4.14), or [hci_bcm-4.15](https://github.com/roadrunner2/linux/tree/hci_bcm-4.15), depending on whether you're on a 4.13 or earlier, 4.14, or 4.15 kernel.
    * apply the patches from [hci_bcm-4.13](https://github.com/roadrunner2/linux/tree/hci_bcm-4.13), [hci_bcm-4.14](https://github.com/roadrunner2/linux/tree/hci_bcm-4.14), or [hci_bcm-4.15](https://github.com/roadrunner2/linux/tree/hci_bcm-4.15), depending on whether you have a 4.13 or earlier, 4.14, or 4.15 kernel.
    * build and reboot
    * on 4.14 and earlier apply the service patch from the above comment and start the service as described there (not necessary on 4.15 and later).
  23. roadrunner2 revised this gist Feb 12, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,9 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also

    ## Partitioning

    If you want to keep your MacOS installation, then first boot into MacOS and resize the partition there, creating a new partition for the Linux installation. If you also want to have a Windows partition, see [this comment](#gistcomment-2164350) below.
    If you want to keep your MacOS installation (generally a good idea if you can afford the disk space, because that's the only way to get/install firmware updates), then first boot into MacOS and resize the partition there, creating a new partition for the Linux installation. If you also want to have a Windows partition, see [this comment](#gistcomment-2164350) below.

    **Warning**: If you're not going to keep MacOS, either back up the EFI System Partition (and restore its contents to the new ESP after installation) or leave it intact (i.e. don't do a full disk install, but just use the space after the ESP). This partition (it's the first one) contains drivers/firmware/etc needed by Apple's EFI loader during boot, in particular to initialize the Touchbar.

    ## Initial Installation

  24. roadrunner2 revised this gist Feb 11, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Introduction

    This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 25, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.11.x (after latest update).
    This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

    The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there's [another tutorial](https://github.com/chisNaN/ubuntu-on-macbook12) focused on that distro and the MacBook.

  25. roadrunner2 revised this gist Feb 11, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -15,13 +15,13 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also
    * Accelerated video
    * Screen brightness control
    * Keyboard backlight
    * WiFi in a very limited fashion
    * USB
    * Sensors (install ```lm_sensors``` package)
    * Camera
    * Bluetooth (with patched kernel)

    ## What doesn't work
    * WiFi (technically it's there, but it's so bad as to be unusable)
    * Suspend/Resume
    * Audio (two cards show up, and intel driver is loaded, but no sound)

    @@ -146,7 +146,7 @@ The touchpad defaults to using the bottom-left corner for right-clicks - to get

    ## WiFi

    The ```brcmfmac``` driver is automatically loaded. However, there are a number of issues with it:
    The ```brcmfmac``` driver is automatically loaded. However, there are a number of issues with it, making it for all practical purposes unusable:
    * it only does 2.4GHz - no 5GHz channels are visible
    * it has an extremely low sensitivity - you must be within a few feet of the base station, and even at 5 feet distance it shows a weak signal.
    * it stops working after 10 or 15 or so minutes; turning WiFi off, waiting a several minutes, and then turning it back on generally gets it working again. Maybe a thermal issue?
  26. roadrunner2 revised this gist Feb 11, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -169,6 +169,6 @@ For MacBookPro13,[12] see https://github.com/Dunedan/mbp-2016-linux/issues/15.

    This currently needs patches to the kernel - see https://github.com/Dunedan/mbp-2016-linux/issues/29#issuecomment-331693489 and following discussion for details. But in short you'll need to:
    * Ensure your kernel is configured with `CONFIG_BT_HCIUART_BCM=y`
    * apply the patches from [hci_bcm-4.13](https://github.com/roadrunner2/linux/tree/hci_bcm-4.13) if you're on 4.13 or earlier kernel; else apply the patches from [hci_bcm-4.14](https://github.com/roadrunner2/linux/tree/hci_bcm-4.14) if you're on 4.14
    * apply the patches from [hci_bcm-4.13](https://github.com/roadrunner2/linux/tree/hci_bcm-4.13), [hci_bcm-4.14](https://github.com/roadrunner2/linux/tree/hci_bcm-4.14), or [hci_bcm-4.15](https://github.com/roadrunner2/linux/tree/hci_bcm-4.15), depending on whether you're on a 4.13 or earlier, 4.14, or 4.15 kernel.
    * build and reboot
    * apply the service patch from the above comment and start the service as described there
    * on 4.14 and earlier apply the service patch from the above comment and start the service as described there (not necessary on 4.15 and later).
  27. roadrunner2 revised this gist Nov 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -169,6 +169,6 @@ For MacBookPro13,[12] see https://github.com/Dunedan/mbp-2016-linux/issues/15.

    This currently needs patches to the kernel - see https://github.com/Dunedan/mbp-2016-linux/issues/29#issuecomment-331693489 and following discussion for details. But in short you'll need to:
    * Ensure your kernel is configured with `CONFIG_BT_HCIUART_BCM=y`
    * apply the patches from [hci_bcm-4.13](/roadrunner2/linux/tree/hci_bcm-4.13) if you're on 4.13 or earlier kernel; else apply the patches from [hci_bcm-4.14](/roadrunner2/linux/tree/hci_bcm-4.14) if you're on 4.14
    * apply the patches from [hci_bcm-4.13](https://github.com/roadrunner2/linux/tree/hci_bcm-4.13) if you're on 4.13 or earlier kernel; else apply the patches from [hci_bcm-4.14](https://github.com/roadrunner2/linux/tree/hci_bcm-4.14) if you're on 4.14
    * build and reboot
    * apply the service patch from the above comment and start the service as described there
  28. roadrunner2 revised this gist Oct 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ First some extra packages:
    sudo dnf install git kernel-devel dkms
    ```

    Next we need to prepare for the modules to be loaded early during boot:
    Next we need to prepare for the modules to be included in the ramdisk (so they are loaded early during boot):
    ```
    cat <<EOF | sudo tee /etc/dracut.conf.d/keyboard.conf
    # load all drivers needed for the keyboard+touchpad
  29. roadrunner2 revised this gist Oct 11, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ First some extra packages:
    sudo dnf install git kernel-devel dkms
    ```

    Next we need to prepare for the modules to be loaded early during boot (download the [keyboard.conf](#file-keyboard-conf) from this gist):
    Next we need to prepare for the modules to be loaded early during boot:
    ```
    cat <<EOF | sudo tee /etc/dracut.conf.d/keyboard.conf
    # load all drivers needed for the keyboard+touchpad
    @@ -77,7 +77,7 @@ EOF
    On distros using ```mkinitramfs``` instead of ```dracut``` you'll want to do the following instead:
    ```
    cat <<EOF | sudo tee -a /etc/initramfs-tools/modules
    # applespi
    # drivers for keyboard+touchpad
    applespi
    appletb
    intel_lpss_pci
  30. roadrunner2 revised this gist Oct 11, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -69,14 +69,14 @@ sudo dnf install git kernel-devel dkms

    Next we need to prepare for the modules to be loaded early during boot (download the [keyboard.conf](#file-keyboard-conf) from this gist):
    ```
    cat <<EOF > /etc/dracut.conf.d/keyboard.conf
    cat <<EOF | sudo tee /etc/dracut.conf.d/keyboard.conf
    # load all drivers needed for the keyboard+touchpad
    add_drivers+="applespi intel_lpss_pci spi_pxa2xx_platform appletb"
    EOF
    ```
    On distros using ```mkinitramfs``` instead of ```dracut``` you'll want to do the following instead:
    ```
    cat <<EOF >> /etc/initramfs-tools/modules
    cat <<EOF | sudo tee -a /etc/initramfs-tools/modules
    # applespi
    applespi
    appletb