Skip to content

Instantly share code, notes, and snippets.

@roadrunner2
Last active December 14, 2024 05:19
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
@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.

@Cliffback
Copy link

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!

Didn't see this until now, but happy that I could be of help! Also, thank you for the update, lot of useful information!

@CyberAustin
Copy link

Has anyone had any luck on getting suspend/resume to work reliably? I've got Mint 21.3 working pretty well using the guide here on a Macbook Pro 13.1, but this is the last hurdle.

@Bandito11
Copy link

Bandito11 commented Aug 28, 2024

I haven't been able to install the touchbar on kernel 6.10.6-200.fc40.x86_64.

@Drayux
Copy link

Drayux commented Aug 28, 2024

I haven't been able to install the touchbar on kernel 6.10.6-200.fc40.x86_64.

Ah you're not alone! It looks like the API for platform modules changed a bit, so the driver won't be able to build. Shouldn't be too hard of a fix, but I've just started a new job so I haven't found the time to fork the module and do so myself.

I'll look to mention it here when I get the chance to work on it--if no one beats me to it if course!

@l1k
Copy link

l1k commented Aug 29, 2024

There's an effort ongoing to upstream touchbar support into the mainline kernel, so maybe try those patches and report on the mailing list if you come across issues?

https://lore.kernel.org/all/DD9C41AD-6543-47CE-8504-69E4992229B2@live.com/

@iamteedoh
Copy link

I haven't been able to install the touchbar on kernel 6.10.6-200.fc40.x86_64.

Ah you're not alone! It looks like the API for platform modules changed a bit, so the driver won't be able to build. Shouldn't be too hard of a fix, but I've just started a new job so I haven't found the time to fork the module and do so myself.

I'll look to mention it here when I get the chance to work on it--if no one beats me to it if course!

@Drayux - same here! I'm at the build step:

sudo dkms install applespi/0.1
[sudo] password for user:
Sign command: /lib/modules/6.10.9-200.fc40.x86_64/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/applespi/0.1/source/dkms.conf)

Building module:
Cleaning build area...
Building module(s)...(bad exit status: 2)
Failed command:
make -j12 KERNELRELEASE=6.10.9-200.fc40.x86_64
Error! Bad return status for module build on kernel: 6.10.9-200.fc40.x86_64 (x86_64)
Consult /var/lib/dkms/applespi/0.1/build/make.log for more information.

Checking the logs, seems like it's blowing a few chunks but I'm not sure how to handle these yet:

cat /var/lib/dkms/applespi/0.1/build/make.log
DKMS make.log for applespi-0.1 for kernel 6.10.9-200.fc40.x86_64 (x86_64)
Fri Sep 13 11:35:37 AM EDT 2024
make -C /lib/modules/6.10.9-200.fc40.x86_64/build M=/var/lib/dkms/applespi/0.1/build modules
make[1]: Entering directory '/usr/src/kernels/6.10.9-200.fc40.x86_64'
  CC [M]  /var/lib/dkms/applespi/0.1/build/applespi.o
  CC [M]  /var/lib/dkms/applespi/0.1/build/apple-ibridge.o
  CC [M]  /var/lib/dkms/applespi/0.1/build/apple-ib-tb.o
  CC [M]  /var/lib/dkms/applespi/0.1/build/apple-ib-als.o
/var/lib/dkms/applespi/0.1/build/apple-ib-als.c: In function ‘appleals_config_iio’:
/var/lib/dkms/applespi/0.1/build/apple-ib-als.c:463:36: error: passing argument 1 of ‘iio_device_alloc’ makes pointer from integer without a cast [-Wint-conversion]
  463 |         iio_dev = iio_device_alloc(sizeof(als_dev));
      |                                    ^~~~~~~~~~~~~~~
      |                                    |
      |                                    long unsigned int
In file included from ./include/linux/iio/buffer.h:10,
                 from /var/lib/dkms/applespi/0.1/build/apple-ib-als.c:32:
./include/linux/iio/iio.h:761:49: note: expected ‘struct device *’ but argument is of type ‘long unsigned int’
  761 | struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv);
      |                                  ~~~~~~~~~~~~~~~^~~~~~
/var/lib/dkms/applespi/0.1/build/apple-ib-als.c:463:19: error: too few arguments to function ‘iio_device_alloc’
  463 |         iio_dev = iio_device_alloc(sizeof(als_dev));
      |                   ^~~~~~~~~~~~~~~~
./include/linux/iio/iio.h:761:17: note: declared here
  761 | struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv);
      |                 ^~~~~~~~~~~~~~~~
In file included from /var/lib/dkms/applespi/0.1/build/apple-ib-als.c:36:
/var/lib/dkms/applespi/0.1/build/apple-ib-als.c:485:72: error: ‘struct iio_dev’ has no member named ‘id’
  485 |         iio_trig = iio_trigger_alloc("%s-dev%d", iio_dev->name, iio_dev->id);
      |                                                                        ^~
./include/linux/iio/trigger.h:160:61: note: in definition of macro ‘iio_trigger_alloc’
  160 |         __iio_trigger_alloc((parent), THIS_MODULE, (fmt), ##__VA_ARGS__)
      |                                                             ^~~~~~~~~~~
./include/linux/iio/trigger.h:160:29: error: passing argument 1 of ‘__iio_trigger_alloc’ from incompatible pointer type [-Wincompatible-pointer-types]
  160 |         __iio_trigger_alloc((parent), THIS_MODULE, (fmt), ##__VA_ARGS__)
      |                             ^~~~~~~~
      |                             |
      |                             char *
/var/lib/dkms/applespi/0.1/build/apple-ib-als.c:485:20: note: in expansion of macro ‘iio_trigger_alloc’
  485 |         iio_trig = iio_trigger_alloc("%s-dev%d", iio_dev->name, iio_dev->id);
      |                    ^~~~~~~~~~~~~~~~~
./include/linux/iio/trigger.h:163:56: note: expected ‘struct device *’ but argument is of type ‘char *’
  163 | struct iio_trigger *__iio_trigger_alloc(struct device *parent,
      |                                         ~~~~~~~~~~~~~~~^~~~~~
/var/lib/dkms/applespi/0.1/build/apple-ib-tb.c: In function ‘appletb_fill_report_info’:
/var/lib/dkms/applespi/0.1/build/apple-ib-tb.c:949:9: warning: enumeration value ‘HID_REPORT_TYPES’ not handled in switch [-Wswitch]
  949 |         switch (field->report->type) {
      |         ^~~~~~
/var/lib/dkms/applespi/0.1/build/apple-ibridge.c:192:6: warning: no previous prototype for ‘appleib_detach_and_free_hid_driver’ [-Wmissing-prototypes]
  192 | void appleib_detach_and_free_hid_driver(struct appleib_device *ib_dev,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [scripts/Makefile.build:244: /var/lib/dkms/applespi/0.1/build/apple-ib-als.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/var/lib/dkms/applespi/0.1/build/apple-ibridge.c:901:10: error: ‘struct acpi_driver’ has no member named ‘owner’
  901 |         .owner          = THIS_MODULE,
      |          ^~~~~
In file included from ./arch/x86/include/asm/mem_encrypt.h:15,
                 from ./include/linux/mem_encrypt.h:17,
                 from ./arch/x86/include/asm/processor-flags.h:6,
                 from ./arch/x86/include/asm/irqflags.h:5,
                 from ./include/linux/irqflags.h:18,
                 from ./include/linux/spinlock.h:59,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/slab.h:16,
                 from ./include/linux/resource_ext.h:11,
                 from ./include/linux/acpi.h:13,
                 from /var/lib/dkms/applespi/0.1/build/apple-ibridge.c:45:
./include/linux/init.h:180:21: error: initialization of ‘const struct acpi_device_id *’ from incompatible pointer type ‘struct module *’ [-Wincompatible-pointer-types]
  180 | #define THIS_MODULE (&__this_module)
      |                     ^
/var/lib/dkms/applespi/0.1/build/apple-ibridge.c:901:27: note: in expansion of macro ‘THIS_MODULE’
  901 |         .owner          = THIS_MODULE,
      |                           ^~~~~~~~~~~
./include/linux/init.h:180:21: note: (near initialization for ‘appleib_driver.ids’)
  180 | #define THIS_MODULE (&__this_module)
      |                     ^
/var/lib/dkms/applespi/0.1/build/apple-ibridge.c:901:27: note: in expansion of macro ‘THIS_MODULE’
  901 |         .owner          = THIS_MODULE,
      |                           ^~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/apple-ibridge.c:905:35: error: initialization of ‘void (*)(struct acpi_device *)’ from incompatible pointer type ‘int (*)(struct acpi_device *)’ [-Wincompatible-pointer-types]
  905 |                 .remove         = appleib_remove,
      |                                   ^~~~~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/apple-ibridge.c:905:35: note: (near initialization for ‘appleib_driver.ops.remove’)
make[3]: *** [scripts/Makefile.build:244: /var/lib/dkms/applespi/0.1/build/apple-ibridge.o] Error 1
/var/lib/dkms/applespi/0.1/build/applespi.c: In function ‘applespi_setup_read_txfrs’:
/var/lib/dkms/applespi/0.1/build/applespi.c:590:13: error: ‘struct spi_transfer’ has no member named ‘delay_usecs’
  590 |         dl_t->delay_usecs = applespi->spi_settings.spi_cs_delay;
      |             ^~
/var/lib/dkms/applespi/0.1/build/applespi.c: In function ‘applespi_setup_write_txfrs’:
/var/lib/dkms/applespi/0.1/build/applespi.c:619:13: error: ‘struct spi_transfer’ has no member named ‘delay_usecs’
  619 |         wt_t->delay_usecs = SPI_RW_CHG_DELAY_US;
      |             ^~
/var/lib/dkms/applespi/0.1/build/applespi.c:622:13: error: ‘struct spi_transfer’ has no member named ‘delay_usecs’
  622 |         dl_t->delay_usecs = applespi->spi_settings.spi_cs_delay;
      |             ^~
/var/lib/dkms/applespi/0.1/build/applespi.c:626:13: error: ‘struct spi_transfer’ has no member named ‘delay_usecs’
  626 |         wr_t->delay_usecs = SPI_RW_CHG_DELAY_US;
      |             ^~
In file included from ./include/linux/percpu.h:5,
                 from ./arch/x86/include/asm/msr.h:15,
                 from ./arch/x86/include/asm/tsc.h:10,
                 from ./arch/x86/include/asm/timex.h:6,
                 from ./include/linux/timex.h:67,
                 from ./include/linux/time32.h:13,
                 from ./include/linux/time.h:60,
                 from ./include/linux/jiffies.h:10,
                 from ./include/linux/ktime.h:25,
                 from ./include/linux/timer.h:6,
                 from ./include/linux/workqueue.h:9,
                 from ./include/linux/srcu.h:21,
                 from ./include/linux/notifier.h:16,
                 from ./arch/x86/include/asm/uprobes.h:13,
                 from ./include/linux/uprobes.h:49,
                 from ./include/linux/mm_types.h:16,
                 from ./include/linux/mmzone.h:22,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/slab.h:16,
                 from ./include/linux/resource_ext.h:11,
                 from ./include/linux/acpi.h:13,
                 from /var/lib/dkms/applespi/0.1/build/applespi.c:44:
/var/lib/dkms/applespi/0.1/build/applespi.c: In function ‘applespi_get_saved_bl_level’:
/var/lib/dkms/applespi/0.1/build/applespi.c:1794:38: error: invalid application of ‘sizeof’ to incomplete type ‘struct efivar_entry’
 1794 |         efivar_entry = kmalloc(sizeof(*efivar_entry), GFP_KERNEL);
      |                                      ^
./include/linux/alloc_tag.h:206:16: note: in definition of macro ‘alloc_hooks_tag’
  206 |         typeof(_do_alloc) _res = _do_alloc;                             \
      |                ^~~~~~~~~
./include/linux/slab.h:666:49: note: in expansion of macro ‘alloc_hooks’
  666 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
      |                                                 ^~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1794:24: note: in expansion of macro ‘kmalloc’
 1794 |         efivar_entry = kmalloc(sizeof(*efivar_entry), GFP_KERNEL);
      |                        ^~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1794:38: error: invalid application of ‘sizeof’ to incomplete type ‘struct efivar_entry’
 1794 |         efivar_entry = kmalloc(sizeof(*efivar_entry), GFP_KERNEL);
      |                                      ^
./include/linux/alloc_tag.h:206:34: note: in definition of macro ‘alloc_hooks_tag’
  206 |         typeof(_do_alloc) _res = _do_alloc;                             \
      |                                  ^~~~~~~~~
./include/linux/slab.h:666:49: note: in expansion of macro ‘alloc_hooks’
  666 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
      |                                                 ^~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1794:24: note: in expansion of macro ‘kmalloc’
 1794 |         efivar_entry = kmalloc(sizeof(*efivar_entry), GFP_KERNEL);
      |                        ^~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1794:22: error: assignment to ‘struct efivar_entry *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
 1794 |         efivar_entry = kmalloc(sizeof(*efivar_entry), GFP_KERNEL);
      |                      ^
In file included from ./include/linux/string.h:374,
                 from ./include/linux/bitmap.h:13,
                 from ./include/linux/cpumask.h:13,
                 from ./arch/x86/include/asm/paravirt.h:21,
                 from ./arch/x86/include/asm/irqflags.h:60,
                 from ./include/linux/irqflags.h:18,
                 from ./include/linux/spinlock.h:59,
                 from ./include/linux/mmzone.h:8:
/var/lib/dkms/applespi/0.1/build/applespi.c:1798:28: error: invalid use of undefined type ‘struct efivar_entry’
 1798 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |                            ^~
./include/linux/fortify-string.h:626:34: note: in definition of macro ‘__fortify_memcpy_chk’
  626 |         const size_t __p_size = (p_size);                               \
      |                                  ^~~~~~
./include/linux/fortify-string.h:683:17: note: in expansion of macro ‘__struct_size’
  683 |                 __struct_size(p), __struct_size(q),                     \
      |                 ^~~~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1798:9: note: in expansion of macro ‘memcpy’
 1798 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |         ^~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1798:28: error: invalid use of undefined type ‘struct efivar_entry’
 1798 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |                            ^~
./include/linux/fortify-string.h:628:40: note: in definition of macro ‘__fortify_memcpy_chk’
  628 |         const size_t __p_size_field = (p_size_field);                   \
      |                                        ^~~~~~~~~~~~
./include/linux/fortify-string.h:684:17: note: in expansion of macro ‘__member_size’
  684 |                 __member_size(p), __member_size(q),                     \
      |                 ^~~~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1798:9: note: in expansion of macro ‘memcpy’
 1798 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |         ^~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1798:28: error: invalid use of undefined type ‘struct efivar_entry’
 1798 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |                            ^~
./include/linux/fortify-string.h:637:27: note: in definition of macro ‘__fortify_memcpy_chk’
  637 |         __underlying_##op(p, q, __fortify_size);                        \
      |                           ^
/var/lib/dkms/applespi/0.1/build/applespi.c:1798:9: note: in expansion of macro ‘memcpy’
 1798 |         memcpy(efivar_entry->var.VariableName, EFI_BL_LEVEL_NAME,
      |         ^~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:1800:21: error: invalid use of undefined type ‘struct efivar_entry’
 1800 |         efivar_entry->var.VendorGuid = EFI_BL_LEVEL_GUID;
      |                     ^~
/var/lib/dkms/applespi/0.1/build/applespi.c:1803:15: error: implicit declaration of function ‘efivar_entry_get’; did you mean ‘efi_mokvar_entry_next’? [-Wimplicit-function-declaration]
 1803 |         sts = efivar_entry_get(efivar_entry, NULL, &efi_data_len, &efi_data);
      |               ^~~~~~~~~~~~~~~~
      |               efi_mokvar_entry_next
/var/lib/dkms/applespi/0.1/build/applespi.c: In function ‘applespi_save_bl_level’:
/var/lib/dkms/applespi/0.1/build/applespi.c:1830:15: error: implicit declaration of function ‘efivar_entry_set_safe’ [-Wimplicit-function-declaration]
 1830 |         sts = efivar_entry_set_safe((efi_char16_t *)EFI_BL_LEVEL_NAME, efi_guid,
      |               ^~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c: At top level:
/var/lib/dkms/applespi/0.1/build/applespi.c:2228:27: error: initialization of ‘void (*)(struct spi_device *)’ from incompatible pointer type ‘int (*)(struct spi_device *)’ [-Wincompatible-pointer-types]
 2228 |         .remove         = applespi_remove,
      |                           ^~~~~~~~~~~~~~~
/var/lib/dkms/applespi/0.1/build/applespi.c:2228:27: note: (near initialization for ‘applespi_driver.remove’)
make[3]: *** [scripts/Makefile.build:244: /var/lib/dkms/applespi/0.1/build/applespi.o] Error 1
make[2]: *** [/usr/src/kernels/6.10.9-200.fc40.x86_64/Makefile:1946: /var/lib/dkms/applespi/0.1/build] Error 2
make[1]: *** [Makefile:252: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/kernels/6.10.9-200.fc40.x86_64'
make: *** [Makefile:16: all] Error 2

Thanks in advance!

@stefand
Copy link

stefand commented Nov 15, 2024

With Linux 6.11 I am running into a new issue: The brcmfmac is crashing on load:

[   10.153130] BUG: unable to handle page fault for address: 00007f033c669379
[   10.154402] #PF: supervisor read access in kernel mode
[   10.155665] #PF: error_code(0x0001) - permissions violation
[   10.156913] PGD 8000000101341067 P4D 8000000101341067 PUD 101340067 PMD 1013bb067 PTE 800000010aee9025
[   10.157993] Oops: Oops: 0001 [#1] SMP PTI
[   10.157996] CPU: 4 UID: 0 PID: 827 Comm: (udev-worker) Not tainted 6.11.8-gentoo #1
[   10.158000] Hardware name: Apple Inc. MacBookPro14,3/Mac-551B86E5744E2388, BIOS 529.140.2.0.0 06/23/2024
[   10.158001] RIP: 0010:strlen+0x4/0x30
[   10.158006] Code: f7 75 ec 31 c0 c3 cc cc cc cc 48 89 f8 c3 cc cc cc cc 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa <80> 3f 00 74 14 48 89 f8 48 83 c0 01 80 38 00 75 f7 48 29 f8 c3 cc
[   10.158008] RSP: 0018:ffffb4aac0683ad8 EFLAGS: 00010202
[   10.158011] RAX: 00000000ffffffea RBX: 00007f033c669379 RCX: 0000000000000001
[   10.158013] RDX: 0000000000000cc0 RSI: 00007f033c669379 RDI: 00007f033c669379
[   10.158014] RBP: 00000000ffffffea R08: 0000000000000000 R09: 00000000c0ba916a
[   10.169779] R10: ffffffffffffffff R11: ffffffffb61ea260 R12: ffff91f7815b50c8
[   10.169781] R13: 0000000000000cc0 R14: ffff91fafefffe30 R15: ffffb4aac0683b30
[   10.169803] FS:  00007f033ccbe8c0(0000) GS:ffff91faeed00000(0000) knlGS:0000000000000000
[   10.169805] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   10.169806] CR2: 00007f033c669379 CR3: 0000000107b1e004 CR4: 00000000003706f0
[   10.169808] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   10.169809] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   10.169810] Call Trace:
[   10.169812]  <TASK>
[   10.181768]  ? __die+0x23/0x70
[   10.181794]  ? page_fault_oops+0x149/0x4c0
[   10.181797]  ? raw_spin_rq_lock_nested+0xe/0x20
[   10.181799]  ? sched_balance_newidle+0x22b/0x3c0
[   10.181803]  ? update_load_avg+0x78/0x770
[   10.181806]  ? exc_page_fault+0x6f/0x150
[   10.181809]  ? asm_exc_page_fault+0x26/0x30
[   10.190817]  ? __pfx_pci_conf1_write+0x10/0x10
[   10.190822]  ? strlen+0x4/0x30
[   10.190825]  devm_kstrdup+0x25/0x70
[   10.190831]  brcmf_of_probe+0x273/0x350 [brcmfmac]

I could work around the problem with a simple change in drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c:

@@ -98,7 +98,7 @@
        root = of_find_node_by_path("/");
        if (root && err) {
                char *board_type;
-               const char *tmp;
+               const char *tmp = NULL;
 
                of_property_read_string_index(root, "compatible", 0, &tmp);

I'll try to find the time to do a bisect in the next few days. This file hasn't changed lately, so it's probably not as easy as sloppy error handling in new code. Still, if this is what it looks like (uninitialized pointer being read due to incorrect error handling) then I'd be shocked it made it into the upstream kernel.

Judging from the surrounding code, you might be able to avoid the bug by disabling CONFIG_BRCMFMAC_SDIO. I haven't tested this though.

@pvraj
Copy link

pvraj commented Nov 21, 2024

Hello,
New member here. I have an old 2016 MBP I’m interested in installing Ubuntu on. I’ve found a number of resources but this and https://github.com/Dunedan/mbp-2016-linux seem the most fleshed out

  1. Is the guide at the top of this thread still up to date?
  2. Does this process work with Ubuntu (not familiar with Fedora)?
  3. Is the process essentially that after using a bootable USB to install Ubuntu to tackle driver related issues on a case by case basis?

If anyone is trying to run Ubuntu or has it running successfully, please leave a comment and I’ll send a direct message. Thank you!

thanks!

@TheOnly3aq
Copy link

Hello, New member here. I have an old 2016 MBP I’m interested in installing Ubuntu on. I’ve found a number of resources but this and https://github.com/Dunedan/mbp-2016-linux seem the most fleshed out

  1. Is the guide at the top of this thread still up to date?
  2. Does this process work with Ubuntu (not familiar with Fedora)?
  3. Is the process essentially that after using a bootable USB to install Ubuntu to tackle driver related issues on a case by case basis?

If anyone is trying to run Ubuntu or has it running successfully, please leave a comment and I’ll send a direct message. Thank you!

thanks!

Hi pvraj,
I've recently installed Ubuntu on my Macbook Pro 2017 W TouchBar using this guide, so let me give you some quick tips.

First off all, you want to use Almas' guide. I was trying to use roadrunner2's guide but I believe it's for older kernels, Almas' guide & repo is updated for newer kernels too.

I'm not sure if this is necessary, but disable FileVault Disk Encryption in MacOS. Don't know if it will, but it might give you trouble later on.

The first time I tried to install it I just used the whole 1TB disk, no more MacOS. Though when I booted into Ubuntu after I installed it, I could not see the Touch Bar device, and after a couple days of searching I figured out that you do need to keep MacOS to somehow enable the Touch Bar device. Not sure if this is the case for everyone, but it was for me. So depending on how big your disk is, you might want to add a partition for linux, instead of using the whole disk.

To keep it simple; I created a partition (for the linux installation, in my case I used 300GB) using the Apple Recovery Mode. To be able to resize the partition it needs to be APFS. After that, all I did was plug in the Ubuntu live installation media, delete the APFS partition to create free space and continue with the GUI installer. Keyboard and trackpad worked out of the box, Touch Bar worked perfectly with Almas's guide, and so did sound. Wifi was working (ish, kept asking for password), but Almas' also has a section for that.

Also a huge tip for troubleshooting;
Look through this repo's closed issues, helped me a lot.

If you need any help shoot me a dm or leave a comment.

@pvraj
Copy link

pvraj commented Nov 21, 2024

Thank you so much @TheOnly3aq ! It looks like direct messaging on GitHub is no longer around; I made a separate gist and tagged you to exchange contact info to not derail the existing thread

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