Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ptzagk/4192c35c783769b3989284853e704653 to your computer and use it in GitHub Desktop.
Save ptzagk/4192c35c783769b3989284853e704653 to your computer and use it in GitHub Desktop.

Revisions

  1. @roadrunner2 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
  2. @roadrunner2 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
  3. @roadrunner2 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
  4. @roadrunner2 roadrunner2 revised this gist Oct 11, 2017. 2 changed files with 32 additions and 20 deletions.
    50 changes: 32 additions & 18 deletions 0 Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -19,6 +19,7 @@ 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)

    ## What doesn't work
    * Suspend/Resume
    @@ -27,7 +28,6 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also
    ## Untested
    * Thunderbolt
    * DisplayPort
    * Bluetooth

    # Details

    @@ -64,18 +64,34 @@ For this we need the drivers from https://github.com/roadrunner2/macbook12-spi-d

    First some extra packages:
    ```
    sudo dnf install git kernel-devel
    sudo dnf install git kernel-devel dkms
    ```

    Get and build the drivers:
    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
    # 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
    # applespi
    applespi
    appletb
    intel_lpss_pci
    spi_pxa2xx_platform
    EOF
    ```

    Now get and build the drivers:
    ```
    git clone https://github.com/roadrunner2/macbook12-spi-driver.git
    pushd macbook12-spi-driver
    git checkout touchbar-driver-hid-driver
    make
    sudo mkdir /lib/modules/`uname -r`/custom/
    sudo cp applespi.ko appletb.ko /lib/modules/`uname -r`/custom/
    sudo depmod
    sudo ln -s `pwd` /usr/src/applespi-0.1
    sudo dkms install applespi/0.1
    popd
    ```

    @@ -89,21 +105,11 @@ You can test the drivers by loading them and their dependencies:
    sudo modprobe intel_lpss_pci spi_pxa2xx_platform applespi appletb
    ```

    You'll want these loaded on boot, so rebuild the initramfs (download the [keyboard.conf](#file-keyboard-conf) from this gist):
    ```
    sudo mv /boot/initramfs-`uname -r`.img{,.orig}
    sudo mv ...the-downloaded-keyboard.conf... /etc/dracut.conf.d/keyboard.conf
    sudo dracut
    ```

    Finally, reboot to make sure it all works correctly:
    ```
    sudo reboot
    ```

    Note: on distros using ```mkinitramfs``` instead of ```dracut``` you'll want to do the following instead of using ```keyboard.conf```
    * add the modules (listed in ```keyboard.conf```) to ```/etc/initramfs-tools/modules```

    ### 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`:
    @@ -157,4 +163,12 @@ For MacBookPro13,3 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 MacBookPro13,[12] see 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:
    * 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
    * build and reboot
    * apply the service patch from the above comment and start the service as described there
    2 changes: 0 additions & 2 deletions keyboard.conf
    Original file line number Diff line number Diff line change
    @@ -1,2 +0,0 @@
    # load all drivers needed for the keyboard+touchpad
    add_drivers+="applespi intel_lpss_pci spi_pxa2xx_platform appletb"
  5. @roadrunner2 roadrunner2 renamed this gist Sep 23, 2017. 1 changed file with 0 additions and 0 deletions.
  6. @roadrunner2 roadrunner2 renamed this gist Sep 23, 2017. 1 changed file with 0 additions and 0 deletions.
  7. @roadrunner2 roadrunner2 renamed this gist Sep 23, 2017. 1 changed file with 0 additions and 0 deletions.
  8. @roadrunner2 roadrunner2 renamed this gist Sep 23, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Linux-On-MBP-Late-2016.md → \ Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -79,7 +79,7 @@ sudo depmod
    popd
    ```

    Next we need to set the proper dpi for the touchpad (download the #file-61-evdev-local-hwdb from this gist):
    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):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    ```
    @@ -89,7 +89,7 @@ You can test the drivers by loading them and their dependencies:
    sudo modprobe intel_lpss_pci spi_pxa2xx_platform applespi appletb
    ```

    You'll want these loaded on boot, so rebuild the initramfs (download the `keyboard.conf` from this gist):
    You'll want these loaded on boot, so rebuild the initramfs (download the [keyboard.conf](#file-keyboard-conf) from this gist):
    ```
    sudo mv /boot/initramfs-`uname -r`.img{,.orig}
    sudo mv ...the-downloaded-keyboard.conf... /etc/dracut.conf.d/keyboard.conf
  9. @roadrunner2 roadrunner2 revised this gist Sep 23, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ Since the internal keyboard and touchpad won't work until you have built and loa

    If you're booting a 4.11 or later kernel, no special params or patches are needed.

    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the [kernel-nvme-controller.patch](#file-kernel-nvme-controller.patch) from this gist in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the [kernel-nvme-controller.patch](#file-kernel-nvme-controller-patch) from this gist in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    ```
    echo 'install nvme /sbin/modprobe --ignore-install nvme $CMDLINE_OPTS; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id' | sudo tee /etc/modprobe.d/nvme.conf
    echo 'force_drivers+="nvme"' | sudo tee /etc/dracut.conf.d/disk.conf
    @@ -79,7 +79,7 @@ sudo depmod
    popd
    ```

    Next we need to set the proper dpi for the touchpad (download the #file-61-evdev-local.hwdb from this gist):
    Next we need to set the proper dpi for the touchpad (download the #file-61-evdev-local-hwdb from this gist):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    ```
  10. @roadrunner2 roadrunner2 revised this gist Sep 23, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ Since the internal keyboard and touchpad won't work until you have built and loa

    If you're booting a 4.11 or later kernel, no special params or patches are needed.

    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the [kernel-nvme-controller.patch](#kernel-nvme-controller.patch) from this gist in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the [kernel-nvme-controller.patch](#file-kernel-nvme-controller.patch) from this gist in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    ```
    echo 'install nvme /sbin/modprobe --ignore-install nvme $CMDLINE_OPTS; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id' | sudo tee /etc/modprobe.d/nvme.conf
    echo 'force_drivers+="nvme"' | sudo tee /etc/dracut.conf.d/disk.conf
    @@ -79,7 +79,7 @@ sudo depmod
    popd
    ```

    Next we need to set the proper dpi for the touchpad (download the #61-evdev-local.hwdb from this gist):
    Next we need to set the proper dpi for the touchpad (download the #file-61-evdev-local.hwdb from this gist):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    ```
  11. @roadrunner2 roadrunner2 revised this gist Sep 23, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ Since the internal keyboard and touchpad won't work until you have built and loa

    If you're booting a 4.11 or later kernel, no special params or patches are needed.

    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the `kernel-nvme-controller.patch` from this gist in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the [kernel-nvme-controller.patch](#kernel-nvme-controller.patch) from this gist in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    ```
    echo 'install nvme /sbin/modprobe --ignore-install nvme $CMDLINE_OPTS; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id' | sudo tee /etc/modprobe.d/nvme.conf
    echo 'force_drivers+="nvme"' | sudo tee /etc/dracut.conf.d/disk.conf
    @@ -79,7 +79,7 @@ sudo depmod
    popd
    ```

    Next we need to set the proper dpi for the touchpad (download the `61-evdev-local.hwdb` from this gist):
    Next we need to set the proper dpi for the touchpad (download the #61-evdev-local.hwdb from this gist):
    ```
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    ```
  12. @roadrunner2 roadrunner2 revised this gist Sep 23, 2017. No changes.
  13. @roadrunner2 roadrunner2 renamed this gist Sep 23, 2017. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions Linux-On-MBP-Late-2016.md → Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ Since the internal keyboard and touchpad won't work until you have built and loa

    If you're booting a 4.11 or later kernel, no special params or patches are needed.

    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the attached kernel patch in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the `kernel-nvme-controller.patch` from this gist in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    ```
    echo 'install nvme /sbin/modprobe --ignore-install nvme $CMDLINE_OPTS; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id' | sudo tee /etc/modprobe.d/nvme.conf
    echo 'force_drivers+="nvme"' | sudo tee /etc/dracut.conf.d/disk.conf
    @@ -79,20 +79,20 @@ sudo depmod
    popd
    ```

    Next we need to set the proper dpi for the touchpad:
    Next we need to set the proper dpi for the touchpad (download the `61-evdev-local.hwdb` from this gist):
    ```
    sudo cp ...the-attached-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    sudo cp ...the-downloaded-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    ```

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

    You'll want these loaded on boot, so rebuild the initramfs:
    You'll want these loaded on boot, so rebuild the initramfs (download the `keyboard.conf` from this gist):
    ```
    sudo mv /boot/initramfs-`uname -r`.img{,.orig}
    sudo mv ...the-attached-keyboard.conf... /etc/dracut.conf.d/keyboard.conf
    sudo mv ...the-downloaded-keyboard.conf... /etc/dracut.conf.d/keyboard.conf
    sudo dracut
    ```

  14. @roadrunner2 roadrunner2 revised this gist Aug 9, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions 61-libinput-local.hwdb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    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
  15. @roadrunner2 roadrunner2 revised this gist Aug 2, 2017. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,10 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also

    # Details

    ## 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.

    ## Initial Installation

    Since the internal keyboard and touchpad won't work until you have built and loaded the drivers, you'll need to plug in an external USB keyboard to do the initial setup and installation.
  16. @roadrunner2 roadrunner2 revised this gist Jul 26, 2017. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions 61-evdev-local.hwdb
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,12 @@
    # MacBook8,1 (2015), MacBook9,1 (2016), MacBook10,1 (2017)
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBook8,1:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBook9,1:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBook10,1:*
    EVDEV_ABS_00=::95
    EVDEV_ABS_01=::90
    EVDEV_ABS_35=::95
    EVDEV_ABS_36=::90

    # MacBookPro13,* (Late 2016), MacBookPro14,* (Mid 2017)
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,1:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,2:*
  17. @roadrunner2 roadrunner2 revised this gist Jul 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 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 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).

    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 .
    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.

    **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.

  18. @roadrunner2 roadrunner2 revised this gist Jun 29, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,7 @@ Since the internal keyboard and touchpad won't work until you have built and loa

    If you're booting a 4.11 or later kernel, no special params or patches are needed.

    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), wich have the Apple NVMe controller, you'll need the attached kernel patch in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), which have the Apple NVMe controller, you'll need the attached kernel patch in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    ```
    echo 'install nvme /sbin/modprobe --ignore-install nvme $CMDLINE_OPTS; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id' | sudo tee /etc/modprobe.d/nvme.conf
    echo 'force_drivers+="nvme"' | sudo tee /etc/dracut.conf.d/disk.conf
  19. @roadrunner2 roadrunner2 revised this gist Jun 25, 2017. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,10 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also

    # Details

    ## Initial Installation

    Since the internal keyboard and touchpad won't work until you have built and loaded the drivers, you'll need to plug in an external USB keyboard to do the initial setup and installation.

    ## Booting

    If you're booting a 4.11 or later kernel, no special params or patches are needed.
  20. @roadrunner2 roadrunner2 revised this gist Jun 15, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 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 MPB's; the focus is mostly on the MacBookPro13,3 (15inch model), but I try to make it relevant and provide information for MacBookPro13,1 and MacBookPro13,2 (13inch models) too; also, I'm guessing pretty much everything here applies equally to the MacBookPro14,\* models. 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.9.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 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).

    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 .

  21. @roadrunner2 roadrunner2 revised this gist Jun 15, 2017. 1 changed file with 9 additions and 7 deletions.
    16 changes: 9 additions & 7 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -33,20 +33,22 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also

    ## Booting

    One kernel param necessary to boot properly: `intremap=nosid`. E.g.
    ```
    sudo sed -i 's/\(GRUB_CMDLINE_LINUX=.*\)"/\1 intremap=nosid"/' /etc/default/grub
    sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
    ```
    If you're booting a 4.11 or later kernel, no special params or patches are needed.

    Also, MacBookPro13,1 and MacBookPro13,2 (13inch models) have the Apple NVMe controller and hence need the attached kernel patch (if running a kernel < 4.11) in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    If you're booting a kernel < 4.11 and have a MacBookPro13,1, MacBookPro13,2, MacBookPro14,1 or MacBookPro14,2 (13inch models), wich have the Apple NVMe controller, you'll need the attached kernel patch in order for the disk to be correctly recognized (MacBookPro13,3 uses a Samsung NVMe controller which is automatically detected correctly). Alternatively, instead of patching you can also do the following (for distros using something other than dracut to create the initrd you'll need to adjust the 2nd and 3rd lines appropriately):
    ```
    echo 'install nvme /sbin/modprobe --ignore-install nvme $CMDLINE_OPTS; echo 106b 2003 > /sys/bus/pci/drivers/nvme/new_id' | sudo tee /etc/modprobe.d/nvme.conf
    echo 'force_drivers+="nvme"' | sudo tee /etc/dracut.conf.d/disk.conf
    sudo dracut --force --kver <kernel-version>
    ```

    If you are booting a live CD or similar with a kernel < 4.9 then you will also need to add the ```nomodeset``` kernel parameter to your kernel line; you will then not have proper HiDPI detection or accelerated graphics.
    If you're booting a kernel < 4.10 then you'll need the following kernel param to boot properly: `intremap=nosid`. E.g.
    ```
    sudo sed -i 's/\(GRUB_CMDLINE_LINUX=.*\)"/\1 intremap=nosid"/' /etc/default/grub
    sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
    ```

    Lastly, if you are booting a live CD or similar with a kernel < 4.9 then you will also need to add the ```nomodeset``` kernel parameter to your kernel line; you will then not have proper HiDPI detection or accelerated graphics.

    ## Keyboard/Touchpad/Touchbar

  22. @roadrunner2 roadrunner2 revised this gist Jun 12, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions 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 MPB's; the focus is mostly on the MacBookPro13,3 (15inch model), but I try to make it relevant and provide information for MacBookPro13,1 and MacBookPro13,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.9.x (after latest update).
    This is about documenting getting Linux running on the late 2016 MPB's; the focus is mostly on the MacBookPro13,3 (15inch model), but I try to make it relevant and provide information for MacBookPro13,1 and MacBookPro13,2 (13inch models) too; also, I'm guessing pretty much everything here applies equally to the MacBookPro14,\* models. 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.9.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 .

    @@ -14,14 +14,14 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also
    * HiDPI detection
    * Accelerated video
    * Screen brightness control
    * Keyboard backlight
    * WiFi in a very limited fashion
    * USB
    * Sensors (install ```lm_sensors``` package)
    * Camera

    ## What doesn't work
    * Suspend/Resume
    * Keyboard backlight (always off)
    * Audio (two cards show up, and intel driver is loaded, but no sound)

    ## Untested
  23. @roadrunner2 roadrunner2 revised this gist Jun 8, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 61-evdev-local.hwdb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # MacBookPro13,* (Late 2016)
    # MacBookPro13,* (Late 2016), MacBookPro14,* (Mid 2017)
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,1:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,2:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro14,1:*
  24. @roadrunner2 roadrunner2 revised this gist Jun 8, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions 61-evdev-local.hwdb
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,15 @@
    # MacBookPro13,* (Late 2016)
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,1:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,2:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro14,1:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro14,2:*
    EVDEV_ABS_00=::96
    EVDEV_ABS_01=::94
    EVDEV_ABS_35=::96
    EVDEV_ABS_36=::94

    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,3:*
    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro14,3:*
    EVDEV_ABS_00=::96
    EVDEV_ABS_01=::95
    EVDEV_ABS_35=::96
  25. @roadrunner2 roadrunner2 revised this gist May 31, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ First some extra packages:
    sudo dnf install git kernel-devel
    ```

    Get and build the driver:
    Get and build the drivers:
    ```
    git clone https://github.com/roadrunner2/macbook12-spi-driver.git
    pushd macbook12-spi-driver
  26. @roadrunner2 roadrunner2 revised this gist May 31, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@ This is about documenting getting Linux running on the late 2016 MPB's; the focu

    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 .

    **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.

    # Summary Of Current State
    ## What works
    * Booting (i.e Grub etc)
  27. @roadrunner2 roadrunner2 revised this gist May 29, 2017. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -72,10 +72,9 @@ Next we need to set the proper dpi for the touchpad:
    sudo cp ...the-attached-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    ```

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

    You'll want these loaded on boot, so rebuild the initramfs:
  28. @roadrunner2 roadrunner2 revised this gist May 28, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 61-evdev-local.hwdb
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,2:*
    EVDEV_ABS_01=::94
    EVDEV_ABS_35=::96
    EVDEV_ABS_36=::94

    evdev:name:Apple SPI Touchpad:dmi:*:svnAppleInc.:pnMacBookPro13,3:*
    EVDEV_ABS_00=::96
    EVDEV_ABS_01=::95
  29. @roadrunner2 roadrunner2 revised this gist May 28, 2017. 3 changed files with 13 additions and 49 deletions.
    38 changes: 13 additions & 25 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -52,8 +52,9 @@ For this we need the drivers from https://github.com/roadrunner2/macbook12-spi-d

    First some extra packages:
    ```
    sudo dnf install git kernel-devel acpica-tools patch
    sudo dnf install git kernel-devel
    ```

    Get and build the driver:
    ```
    git clone https://github.com/roadrunner2/macbook12-spi-driver.git
    @@ -65,45 +66,32 @@ sudo cp applespi.ko appletb.ko /lib/modules/`uname -r`/custom/
    sudo depmod
    popd
    ```
    Patch up the DSDT:
    ```
    mkdir dsdt
    pushd dsdt

    sudo cp /sys/firmware/acpi/tables/DSDT dsdt.orig
    sudo cp /sys/firmware/acpi/tables/SSDT* .
    sudo chown ${USER}:$GROUP *
    iasl -e SSDT* -d dsdt.orig
    mv ...the-attached-dsdt.dsl.patch... dsdt.dsl.patch
    patch -b < dsdt.dsl.patch
    Next we need to set the proper dpi for the touchpad:
    ```
    sudo cp ...the-attached-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    ```

    iasl -tc dsdt.dsl
    sudo mkdir -p /usr/local/lib/firmware/acpi/
    sudo cp dsdt.aml /usr/local/lib/firmware/acpi/
    popd
    You can test the drivers by loading them:
    ```
    Now rebuild the initramfs:
    sudo modprobe applespi
    sudo modprobe appletb
    ```

    You'll want these loaded on boot, so rebuild the initramfs:
    ```
    sudo mv /boot/initramfs-`uname -r`.img{,.orig}
    sudo mv ...the-attached-keyboard.conf... /etc/dracut.conf.d/keyboard.conf
    sudo sed -i.orig 's/CONFIG_ACPI_INITRD_TABLE_OVERRIDE/CONFIG_ACPI_TABLE_UPGRADE/g' /usr/bin/dracut
    sudo dracut
    ```

    Next we need to set the proper dpi for the touchpad:
    ```
    sudo cp ...the-attached-61-evdev-local.hwdb... /etc/udev/hwdb.d/61-evdev-local.hwdb
    ```

    Finally, reboot to get the new DSDT and other changes:
    Finally, reboot to make sure it all works correctly:
    ```
    sudo reboot
    ```

    Note: on distros using ```mkinitramfs``` instead of ```dracut``` you'll want to do the following instead of using ```keyboard.conf```
    * add the modules (listed in ```keyboard.conf```) to ```/etc/initramfs-tools/modules```
    * copy the ```dsdt.aml``` to ```/etc/initramfs-tools/DSDT.aml```

    ### Screen Brightness Control

    20 changes: 0 additions & 20 deletions dsdt.dsl.patch
    Original file line number Diff line number Diff line change
    @@ -1,20 +0,0 @@
    --- dsdt.dsl.orig 2017-01-14 06:09:53.435098814 -0800
    +++ dsdt.dsl 2017-01-14 23:15:53.020864710 -0800
    @@ -18,7 +18,7 @@
    * Compiler ID "INTL"
    * Compiler Version 0x20140424 (538182692)
    */
    -DefinitionBlock ("", "DSDT", 2, "APPLE ", "MacBookP", 0x00150001)
    +DefinitionBlock ("", "DSDT", 2, "APPLE ", "MacBookP", 0x00150002)
    {
    /*
    * iASL Warning: There were 8 external control methods found during
    @@ -7232,7 +7232,7 @@
    Name (ABUF, ResourceTemplate ()
    {
    })
    - If (!OSDW ())
    + If (OSDW ())
    {
    Return (UBUF) /* \_SB_.PCI0.SPI1.SPIT._CRS.UBUF */
    }
    4 changes: 0 additions & 4 deletions keyboard.conf
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,2 @@
    # override the acpi with our patched one
    acpi_override="yes"
    acpi_table_dir="/usr/local/lib/firmware/acpi"

    # load all drivers needed for the keyboard+touchpad
    add_drivers+="applespi intel_lpss_pci spi_pxa2xx_platform appletb"
  30. @roadrunner2 roadrunner2 revised this gist Apr 23, 2017. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions Linux-On-MBP-Late-2016.md
    Original file line number Diff line number Diff line change
    @@ -15,12 +15,12 @@ The state of linux on the MBP (with particular focus on MacBookPro13,2) is also
    * WiFi in a very limited fashion
    * USB
    * Sensors (install ```lm_sensors``` package)
    * Camera

    ## What doesn't work
    * Suspend/Resume
    * Keyboard backlight (always off)
    * Audio (two cards show up, and intel driver is loaded, but no sound)
    * Camera

    ## Untested
    * Thunderbolt
    @@ -48,7 +48,7 @@ If you are booting a live CD or similar with a kernel < 4.9 then you will also n

    ## Keyboard/Touchpad/Touchbar

    For this we need the drivers from https://github.com/roadrunner2/macbook12-spi-driver.git (a clone of https://github.com/cb22/macbook12-spi-driver which includes a preliminary touchbar driver). The following commands set this up.
    For this we need the drivers from https://github.com/roadrunner2/macbook12-spi-driver.git (a clone of https://github.com/cb22/macbook12-spi-driver which includes a preliminary touchbar driver and keyboard fixes). The following commands set this up.

    First some extra packages:
    ```
    @@ -135,14 +135,6 @@ popd
    sudo reboot
    ```

    ### Post Boot

    There is one more thing that is currently needed after each boot:
    * the touchpad usually is not working, but can be gotten to work by reloading the ```applespi``` driver (sometimes it takes more than one attempt):
    ```
    sudo rmmod applespi && sudo modprobe applespi
    ```

    ### Other

    The touchpad defaults to using the bottom-left corner for right-clicks - to get 2-finger right click, install the Gnome tweak tool and change it in there.
    @@ -159,3 +151,11 @@ Bug report: https://bugzilla.kernel.org/show_bug.cgi?id=193121
    ## 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).

    ## Camera

    For MacBookPro13,3 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.