Skip to content

Instantly share code, notes, and snippets.

@roadrunner2
Last active February 29, 2024 16:29
Show Gist options
  • Save roadrunner2/1289542a748d9a104e7baec6a92f9cd7 to your computer and use it in GitHub Desktop.
Save roadrunner2/1289542a748d9a104e7baec6a92f9cd7 to your computer and use it in GitHub Desktop.
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

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 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 are a couple tutorials (here and here) 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.

Summary Of Current State

What works

  • Booting (i.e Grub etc)
  • Recognizes disk on all models (older kernels may need patch for some models, though)
  • Keyboard, touchpad, and basic touchbar functionality
  • HiDPI detection
  • Accelerated video
  • Screen brightness control
  • Keyboard backlight
  • USB
  • Sensors (install lm_sensors package)
  • 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 (works partially on 13,3 models)
  • Audio (two cards show up, and intel driver is loaded, but no sound)

Details

Partitioning

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

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.

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
sudo dracut --force --kver <kernel-version>

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

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:

sudo dnf install git kernel-devel dkms

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
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
apple-ib-tb
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
sudo ln -s `pwd` /usr/src/applespi-0.1
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, 61-libinput-local.hwdb, and 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

You can test the drivers by loading them and their dependencies:

sudo modprobe intel_lpss_pci spi_pxa2xx_platform applespi apple-ib-tb

Finally, reboot to make sure it all works correctly:

sudo reboot

Screen Brightness Control

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 Dunedan/mbp-2016-linux#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

curl -o apple-gmux.patch 'https://bugzilla.kernel.org/attachment.cgi?id=192601'
curl -o apple-gmux.c 'https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/platform/x86/apple-gmux.c?id=refs/tags/v4.9.11'

patch < apple-gmux.patch

echo -e '
obj-m += apple-gmux.o

all:
\tmake -C /lib/modules/`uname -r`/build M=`pwd` modules
' > Makefile
make

mod=$(ls /lib/modules/`uname -r`/kernel/drivers/platform/x86/apple-gmux.ko*)
sudo mv $mod{,.orig}
sudo cp apple-gmux.ko /lib/modules/`uname -r`/kernel/drivers/platform/x86/
sudo depmod

popd

sudo reboot

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.

WiFi

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

Display

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 (*,3 models only)

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):

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=cuspart --file /EFI/custom/apple_set_os.efi
chainloader (${cuspart})/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

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 MacBookPro[13,14],[12] you need the bcwc_pcie driver (mainline branch) - see also Dunedan/mbp-2016-linux#15.

Bluetooth

As of kernel 4.16 bluetooth works out of the box; older kernels need patches - see Dunedan/mbp-2016-linux#29 (comment) 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, hci_bcm-4.14, or 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).

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.

# 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:*
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
EVDEV_ABS_36=::95
libinput:name:*Apple SPI Touchpad*:dmi:*
LIBINPUT_MODEL_APPLE_TOUCHPAD=1
LIBINPUT_ATTR_TOUCH_SIZE_RANGE=200:150
LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=1200
libinput:name:*Apple SPI Keyboard*:dmi:*
LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal
--- a/drivers/nvme/host/pci.c 2017-01-22 21:49:03.710949755 -0800
+++ b/drivers/nvme/host/pci.c 2017-01-22 21:49:23.490761505 -0800
@@ -2121,6 +2121,7 @@
.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
{ PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
{ PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) },
+ { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
{ 0, }
};
MODULE_DEVICE_TABLE(pci, nvme_id_table);
[MacBook(Pro) SPI Touchpads]
MatchName=*Apple SPI Touchpad*
ModelAppleTouchpad=1
AttrTouchSizeRange=200:150
AttrPalmSizeThreshold=1100
[MacBook(Pro) SPI Keyboards]
MatchName=*Apple SPI Keyboard*
AttrKeyboardIntegration=internal
[MacBookPro Touchbar]
MatchBus=usb
MatchVendor=0x05AC
MatchProduct=0x8600
AttrKeyboardIntegration=internal
@Lucianod28
Copy link

Has anyone tried using this with dwm? I followed installation instructions but none of the keys work and I'm wondering if its a dwm issue.

@noispirit
Copy link

noispirit commented Apr 3, 2022

Hey so, I was messing with bluetooth, trying to figure the choppy A2DP issue and I found out that our system tries to load a firmware from path /usr/lib/firmware/bcrm/BCM.hcd

I downloaded the bootcamp drivers from Boot Camp Assistant and unzipped the bluetooth driver, finding out several .hcd firmwares available inside, which I started to try placing them in bcrm folder, managing to get a pretty stable A2DP using "BCM4356A2_001.003.015.0041.0089.hcd" as firmware renamed "BCM.hcd". Still have some choppy audio for less than a second every 3 or 4 minutes or while trying to scan other devices while using A2DP, but so far I feel comfortable using my headphones for the first time in years!

Oh, btw, this is a MBP 14,3 with Fedora 35 using last stock kernel.

@stefand
Copy link

stefand commented Apr 3, 2022

Hmm, I have to see if this improves my bluetooth mouse if I use it at the same time as WiFi.

@noispirit
Copy link

Theres another BCM4356A2 firmware ending in 84.hcd that might work too, but I haven't tested it.

@Cliffback
Copy link

I installed the touchbar drivers using the method listed above, using PatrickVerners updated version (https://github.com/PatrickVerner/macbook12-spi-driver.git), because the one used doesnt work with newer kernels. The installation works fine, but, the TouchBar only appears for two seconds upon boot, but dissappears before reaching the login screen. Any idea to how I can get it to stay there permanently?

@bor-lin
Copy link

bor-lin commented May 21, 2022

I hope that Touch Bar will be well implemented in mainline kernel 5.18:
https://www.phoronix.com/scan.php?page=news_item&px=Apple-Keyboards-Linux-5.18

I see in the 5.18 sources:

input/keyboard/Kconfig: or any MacBookPro13,* or MacBookPro14,*.
.

For the time being I'am using kernel 5.7.x

@Cliffback
Copy link

Let’s hope it gets an official fix in 5.18!

However I actually just got it to work on 5.17, the issue was with usbmuxd so you have to unbind and bind those drivers after boot.

echo '1-3' | sudo tee /sys/bus/usb/drivers/usb/unbind
echo '1-3' | sudo tee /sys/bus/usb/drivers/usb/bind

To do it automatically each boot I did what’s described in this comment: roadrunner2/macbook12-spi-driver#42 (comment)

@terentev
Copy link

Ubuntu 20.04 Macbook 12 touchpad is too sensitive
Create file /etc/libinput/local-overrides.quirks

[MacBook(Pro) SPI Touchpads]
MatchName=Apple SPI Touchpad
ModelAppleTouchpad=1
AttrKeyboardIntegration=internal
AttrTouchSizeRange=200:150
AttrPalmSizeThreshold=1200
[MacBook(Pro) SPI Keyboards]
MatchName=Apple SPI Keyboard
AttrKeyboardIntegration=internal

@Cliffback
Copy link

Started working on repackaging the ISO for Pop!_OS 22.04 for my MacBook Pro 15" Late 2016 (13,3), to avoid doing all these steps manually, and also get internet during installation. If anyone want to have a look, I uploaded the first release yesterday:
https://github.com/Cliffback/POP_OS_22.04-mbp-2016

@sgalant2112
Copy link

HI,
I am dual booting mac os ventura and ubuntu 22 on a mid 2017 imac 27".Video, sound, bluetooth all work fine. I did have to install from source a different audio driver but once that was done it was fine. You need to install The "egorenarcs8409 driver".Its is on a github page. My issue is boot time. Since I did not want to touch the mac internal drive, i installed to a mybook usb hd. As far as some people with grub issues go, this ditro is fine. Simply hold option when booting and select efi from mac boot screen.My issue is a slow 3 minute boot. I am seeing the following warnings?:
20230707_164643
20230709_064725

Can someone please explain them and help me eliminate them. I am pretty sure the brcmfmac is related to bluetooth and mine works fine. Any help would be greatly appreciated.

@noispirit
Copy link

HI, I am dual booting mac os ventura and ubuntu 22 on a mid 2017 imac 27".Video, sound, bluetooth all work fine. I did have to install from source a different audio driver but once that was done it was fine. You need to install The "egorenarcs8409 driver".Its is on a github page. My issue is boot time. Since I did not want to touch the mac internal drive, i installed to a mybook usb hd. As far as some people with grub issues go, this ditro is fine. Simply hold option when booting and select efi from mac boot screen.My issue is a slow 3 minute boot. I am seeing the following warnings?: 20230707_164643 20230709_064725

Can someone please explain them and help me eliminate them. I am pretty sure the brcmfmac is related to bluetooth and mine works fine. Any help would be greatly appreciated.

Your external disk must be the cause of the slow boot time, it's USB which is pretty slow compared to the internals.

About the warnings, I wouldn't be able to help you with that but it should be fine as long as it boots. brcmfmac warning is because these Macs don't use the standard module, it's a variant of the recognized device, I have the same warnings in my Macbook Pro 2017 and everything goes just fine.

ACPI errors are caused by the custom SSDT macs use but shouldn't be affecting you as long as it runs fine, maybe suspend might be broken.

@l1k
Copy link

l1k commented Jul 29, 2023

Error -19 is -ENODEV. The apple-properties messages occur because EFI passed a device property "AAPL,ig-platform-id" but the corresponding device, i.e. the integrated graphics (Intel GPU), couldn't be found. Is this machine capable of switching the display between integrated graphics and discrete graphics? And the integrated GPU is disabled? Perhaps EFI passed the property erroneously, i.e. maybe it's an EFI bug and Linux is more verbose than macOS about the issue.

@HeIsMyStrength
Copy link

Hello I'm fairly new to this entire process. Ive grown tired of the macOS and M$ Window trash, So Ive picked up Fedora 38 Kernal Version 6.4.14.200 on my MBP 13,3 (late 2016 with touchbar) 15" works beautiful, but i've no sound, touchbar, and pretty much every within this string. have been searching and trying to follow along this tutorial as well as a few others, but as i stated im quite a bit of a no0b. I've been doing a fair bit of reading and am pretty comfortable with getting into it and have been watching a few videos. Can i get some help...please and thank you lol

@ertanmantas
Copy link

Hello I'm fairly new to this entire process. Ive grown tired of the macOS and M$ Window trash, So Ive picked up Fedora 38 Kernal Version 6.4.14.200 on my MBP 13,3 (late 2016 with touchbar) 15" works beautiful, but i've no sound, touchbar, and pretty much every within this string. have been searching and trying to follow along this tutorial as well as a few others, but as i stated im quite a bit of a no0b. I've been doing a fair bit of reading and am pretty comfortable with getting into it and have been watching a few videos. Can i get some help...please and thank you lol

For sound you could try this command on terminal:

apt install wget make gcc linux-headers-generic
git clone https://github.com/davidjo/snd_hda_macbookpro.git
cd snd_hda_macbookpro
sudo ./install.cirrus.driver.sh
reboot

@fundave3
Copy link

Ive got the ubuntu running well on the macbook pro 14.1 model 2017 but there are still some issues to solve.
Any updates on sound input ? the input device seems to work sometimes. I saw a input level sometimes i remembered.
But at the most times there is no input for the internal microphone.

WiFi is still operating only on 2,4 GHz. But stable on 2.4 GHz. When i changed manual on the wifi profile to 2.4GHz the connection is stable.
Any possibility to get 5GHz working ?

@HeIsMyStrength
Copy link

Hello I'm fairly new to this entire process. Ive grown tired of the macOS and M$ Window trash, So Ive picked up Fedora 38 Kernal Version 6.4.14.200 on my MBP 13,3 (late 2016 with touchbar) 15" works beautiful, but i've no sound, touchbar, and pretty much every within this string. have been searching and trying to follow along this tutorial as well as a few others, but as i stated im quite a bit of a no0b. I've been doing a fair bit of reading and am pretty comfortable with getting into it and have been watching a few videos. Can i get some help...please and thank you lol

For sound you could try this command on terminal:

apt install wget make gcc linux-headers-generic git clone https://github.com/davidjo/snd_hda_macbookpro.git cd snd_hda_macbookpro sudo ./install.cirrus.driver.sh reboot

thanks for the reply and help, I appreciate you. when trying this I receive a message that reads:
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package wget
E: Unable to locate package make
E: Unable to locate package gcc
E: Unable to locate package linux-headers-generic

now when i did this one,
dnf install wget make gcc kernel-devel
https://github.com/davidjo/snd_hda_mackbookpro.git
cd snd_hda_macbookpro/
./install.cirrus.driver.sh
i receive a message that reads, "Kernel version later than implemented version - there may be build problems
./install.cirrus.driver.sh: line 217: patch: command not found." this is as far as ive been able to get. still no sound unless i use my blutooth earpods but i don't like using them to much.

@leifliddy
Copy link

You need to install the patch package.
I've just submitted this PR to have that included in instructions
davidjo/snd_hda_macbookpro@7814cf9

@HeIsMyStrength
Copy link

You need to install the patch package. I've just submitted this PR to have that included in instructions davidjo/snd_hda_macbookpro@7814cf9

Thank you so much it! your a savior of sorts. It worked flawless

@FreddyNO
Copy link

Hello I'm fairly new to this entire process. Ive grown tired of the macOS and M$ Window trash, So Ive picked up Fedora 38 Kernal Version 6.4.14.200 on my MBP 13,3 (late 2016 with touchbar) 15" works beautiful, but i've no sound, touchbar, and pretty much every within this string. have been searching and trying to follow along this tutorial as well as a few others, but as i stated im quite a bit of a no0b. I've been doing a fair bit of reading and am pretty comfortable with getting into it and have been watching a few videos. Can i get some help...please and thank you lol

For sound you could try this command on terminal:

apt install wget make gcc linux-headers-generic git clone https://github.com/davidjo/snd_hda_macbookpro.git cd snd_hda_macbookpro sudo ./install.cirrus.driver.sh reboot

This worked great for me, thank you!

@Drayux
Copy link

Drayux commented Jan 24, 2024

I really appreciate how thorough this guide is...I just wish I'd found it before I'd wiped my Macbook's disk in its entirety. I have a 2017 pro with the touchbar that I'd sought to breathe new life into by making the swap, but absent the aforementioned touchbar firmware, I fear that I may be out of luck getting it up and running so far.

Do you have any suggestions where I might be able to find the firmware that I wiped, and what directory structure of the EFI partition the loader expects would look like? Thanks!

@Cliffback
Copy link

I really appreciate how thorough this guide is...I just wish I'd found it before I'd wiped my Macbook's disk in its entirety. I have a 2017 pro with the touchbar that I'd sought to breathe new life into by making the swap, but absent the aforementioned touchbar firmware, I fear that I may be out of luck getting it up and running so far.

Do you have any suggestions where I might be able to find the firmware that I wiped, and what directory structure of the EFI partition the loader expects would look like? Thanks!

I used this guide (among others) to create an iso for POP_OS on my mbp 2016, and after a few of the files used went offline, I put them up in my repo. I also went into detail on how I set it up, step by step. Eve though you are on a mbp from 2017, you might find something that you can use there :)

https://github.com/Cliffback/POP_OS_22.04-mbp-2016

@Drayux
Copy link

Drayux commented Feb 25, 2024

I really appreciate how thorough this guide is...I just wish I'd found it before I'd wiped my Macbook's disk in its entirety. I have a 2017 pro with the touchbar that I'd sought to breathe new life into by making the swap, but absent the aforementioned touchbar firmware, I fear that I may be out of luck getting it up and running so far.
Do you have any suggestions where I might be able to find the firmware that I wiped, and what directory structure of the EFI partition the loader expects would look like? Thanks!

I used this guide (among others) to create an iso for POP_OS on my mbp 2016, and after a few of the files used went offline, I put them up in my repo. I also went into detail on how I set it up, step by step. Eve though you are on a mbp from 2017, you might find something that you can use there :)

https://github.com/Cliffback/POP_OS_22.04-mbp-2016

Hey I want to thank you for the reply! I saw it back when you first posted it, and failed to find a reply as I wasn't sure what my next question should be. Alas, I am happy to finally provide updates!

For the firmware side of things--for any who may have wiped their EFI partition like me. It's a bit of a pain, but if you hold Option-R during the initial boot phase, the apple EFI loader will put you into recovery mode, where you can wipe your disk, and subsequently perform a fresh install of OSX from scratch. After that, the EFI partition will contain all of the previously-missing firmware, specific to your machine's model.

To actually get the touchbar working, I had some additional kinks I had to work out. Most of this information is available on the touchbar driver repo, issues, or forks of said repo, but I want to put everything I had to do into one place:

I'm using artix linux, with kernel 6.7.5 as of writing this. This fork is currently an open PR on roadrunner's repo with fixes for compiling up to kernel 5.18, which fortunately also still apply in 6.7.5.

That said, if you try to build, you will get errors in the applespi module. This module is no longer necessary as it's been included in the kernel source tree. One can simply edit the makefile and remove the applespi target on line 1.

The other major roadblock was the usbmuxd service; It seems to conflict with the ibridge HID driver. On my system, usbmuxd was being started as a udev rule. If the process runs at all, the ibridge will fail to initialize its interfaces: aka the touch bar and related components. Finally, if all goes well, as soon as you modprobe/insmod the apple-ib-tb module, the touchbar will turn on immediately. This depends upon apple-ibridge and not apple-ib-als, as the latter is relevant to the display brightness.

EDIT: A few notes I forgot to add:
When editing the makefile, I also modified the DKMS module to remove its expected module names. I shifted the indices of the subsequent array objects down so that apple-ibridge was in position 0.

I also added the Touchbar section to the libinput/local-overrides.quirks file specified in this gist. I did this early on, and truthfully I haven't tested if it was necessary for the bar to work.

When modifying the usbmuxd service, I later found that you don't have to disable it entirely. In /lib/udev/rules.d/39-usbmuxd.rules just remove the match for 05ac:8600 from each of the four rules, as this is the device VID:PID for the ibridge.

Unrelated to the touchbar, I was struggling getting my networking working at my parent's place. They have the hot new Wifi 6...some unofficial standard access points. As soon as I added the brcmfmac43602-pcie.txt file from Cliffback's repo, it worked flawlessly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment