This gist is out of date and I can no longer help much, as I got rid of my Mac.
Please visit T2 Linux website for more and better information:
This gist is just a compilation of the hard work that others have put in. I'm not a software developer, so if there are any mistakes or better ways of doing things, I'd appreciate any suggestions. Here's a list of the real heroes who made this possible:
Kernel Patches: aunali (https://github.com/aunali1/)
T2 security chip bypass to allow access to the SSD, keyboard, and trackpad: MCMrARM (https://github.com/MCMrARM)
Audio: kevineinarsson (https://github.com/kevineinarsson)
The Arch Linux guide which I basically stole to make this one: TRBP (https://github.com/TRPB)
Wifi: Catalina is weird, so currently no one has firgured out what it's using to make WiFi work. It's either that or reverse engineer something. As a workaround, I use a USB WiFi adapter (TP-Link N150 USB) that works out of the box with most linux kernels and distros.
Sound via the speakers is a little weird. It technically works, but some apps don't seem to know how to connect. Although if you use the testing feature, you can hear the nice lady saying "Front!" "Left center", etc etc. Youtube in the browser gets sound, but sometimes VLC doesn't. Headphones through the jack or bluetooth audio seems to work OK, although I haven't fully tested out sound.
External GPU's: while other Thunderbolt 3 devices work well, including the OWC thunderbolt 3 dock, external GPU's seem to have some trouble. The eGPU is recognized and authorized, but the drivers don't load, despite what Ubuntu widgets are telling you. Even if you manually install nVidia drivers (sudo apt install nvidia etc), the driver seems to install, but using nvidia-smi
complains about no drivers.
GDM3, the standard/usual/normal windows manager for Ubuntu. I'm not sure if it's a true bug or an incompatiblity with Apple's hardware. As a fix, I installed plasma (sddm). Basically you'll need to install kubuntu. Plenty of google help out there on that.
You'll need at least the following hardware:
At least enough USB-A to USB-C converters or hub with enough ports for at least 3 USB devices if all your devices are USB-A:
- A USB drive with Ubuntu on it
- A USB keyboard
- A USB Mouse
Optional: USB to Ethernet adapter, compatible USB Wifi or USB tethering on a phone
I strongly recommend against deleting OSX entirely even if you'll never use it, it is required for locating the WiFi firmware during install and can be valuable for determining which hardware you have.
If you want to triple boot, I'd recommend installing Windows 10 before Linux, via bootcamp. If it isn't obvious, you'll need to create a partition using Disk Utility in MacOS to make room another OS partition. You'll actually want to partition drive and not just add another logical volume. Google it, if you need help with this. It's pretty well documented. NOTE: The following steps will mess up Windows boot (the install is safe). There's a fix for that at the end.
- Download Ubuntu 20.04 (focal fossa)
As of this writing, 20.04 is the only Ubuntu version out there that uses kernel 5.4, which is when the linux kernel gained the ability to access the internal Apple NVME SSD.
Download from here: http://www.cdimage.ubuntu.com/daily-live/current/focal-desktop-amd64.iso
- Use your favorite program to write the ISO to a USB stick (Balena etcher for Mac, etc).
You'll need to use a USB keyboard for the installation
Insert the USB stick and boot the laptop holding down the "option" key to seelct the USB for boot (it'll be an orange EFI disk. Choose the far right one, if there are multiple.)
The text will be tiny, but choose the second option (try Ubuntu without installing (Safe graphics).
I don't know what the issue is, but grub and/or Ubuntu really don't like this laptop. Therefore, we're going to install Ubuntu WITHOUT a bootloader. To do this, open up a terminal and type sudo ubiquity -b
Proceed to install as normal and make sure you're installing to the empty partition you made and not MacOS or Windows.
On reboot, your laptop should boot directly into MacOS as there's no way to boot into linux at this point. Download REFIND from sourceforge and install it the standard way.
REFIND: https://sourceforge.net/projects/refind/
Installation Instructions: https://www.rodsbooks.com/refind/installing.html
Reboot. You should be able to select Ubuntu now via REFIND. Boot into Ubuntu.
- Install macbook12-spi-driver-dkms:
You need the MBP15 branch:
https://github.com/roadrunner2/macbook12-spi-driver/tree/mbp15
Download and install according to the directions.
- Get MCMrArm's bridge driver and install it:
Note: Since Ubuntu 20.04 is still in developlment, the exact kernel version could change depending on when you downloaded th ISO, you'll need that to know where to copy the driver.
git clone https://github.com/MCMrARM/mbp2018-bridge-drv.git
cd mbp2018-bridge-drv
make
sudo cp bce.ko /usr/lib/modules/[whatever kernel version, eg: linux-5.4.22-18-056000-generic]/kernel/drivers/pci/bce.ko
You'll need to remember to rebuild the module every time you update the kernel), I'm looking for a way to automate this
Have it load on boot:
sudo nano /etc/modules
Add the following:
bce
Reboot.
The touchbar should light up. You can push the fn
key to switch from F1-F12 to the audio/visual controls. The keyboard backlight works intermittently for me and I can't pin down what makes it come alive.
You can now disconnect your external keyboard and use the laptop's touchpad.
The touchpad will only have very basic functionality. We'll need to apply some kernel patches (see below).
Boot into OSX and run the following in terminal: ioreg -l | grep C-4364
It will show something like:
| | | | "images" = {"C-4364__s-B2/kauai-X3.txcb"={"imagetype"="TxCap","required"=No,"imagename"="C-4364__s-B2/kauai-X3.txcb"},"C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt"={"imagetype"="NVRAM","required"=Yes,"imagename"="C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt"},"C-4364__s-B2/kauai-X3.clmb"={"imagetype"="Regulatory","required"=Yes,"imagename"="C-4364__s-B2/kauai-X3.clmb"},"C-4364__s-B2/kauai.trx"={"imagetype"="Firmware","required"=Yes,"imagename"="C-4364__s-B2/kauai.trx"}}
It'll be different depending on your exact model.
There are three files to note down. A .trx (for me: C-4364__s-B2/kauai.trx), a .clmb (for me: C-4364__s-B2/kauai-X3.clmb and a .txt (for me: C-4364__s-B2/P-kauai-X3_M-HRPN_V-u__m-7.5.txt
These refer to files on OSX in /usr/share/firmware/wifi. Copy the trx, clmb and txt somewhere you can easily access them when you boot back into linux (e.g. your home directory if you want to mount the HSF partition in linux, a usb stick, etc)
Boot back into linux and place the files in the following locations:
Copy the trx to /lib/firmware/brcm/brcmfmac4364-pcie.bin (e.g. sudo cp kauai.trx /lib/firmware/brcm/brcmfmac4364-pcie.bin The clmb to /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob (e.g. sudo cp kauai-X3.clmb /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob) The txt to something like /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,1.txt. You will need to replace 15,1 with your model number. (e.g. sudo cp P-kauai-X3_M-HRPN_V-u__m-7.5.txt /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,1.txt) Use networkmanager and iwd:
sudo pacman -S networkmanager iwd sudo systemctl start NetworkManager.service sudo systemctl enable NetworkManager.service If you're on kde also install plasma-nm
Configure networkmanager to use iwd. Create /etc/NetworkManager/NetworkManager.conf and add:
[device] wifi.backend=iwd Restart the NetworkManager service and you should have wifi working.
If you've installed the mbp15 branch of @roadrunner2's spi driver as outlined above you just need to load the modules:
modprobe apple-ib-tb
modprobe apple-ib-als
If you want the touchbar to display F* keys by default, sudo /etc/modprobe.d/apple-tb.conf
and add
options apple-ib-tb fnmode=2
MCMrARM's gist here was the basis: https://gist.github.com/MCMrARM/c357291e4e5c18894bea10665dcebffb
For the MBP 16-inch version: https://gist.github.com/kevineinarsson/8e5e92664f97508277fefef1b8015fba
Download the five files, copy them as instructed, and reboot.
As of 20/09/2019 you have to choose between audio and suspend though this will likely change when MCMrARM updates the bridge driver.
Install the suspend branch of the bce module: git clone https://github.com/MCMrARM/mbp2018-bridge-drv.git cd mbp2018-bridge-drv git checkout suspend make cp bce.ko /usr/lib/modules/extramodules-mbp/bce.ko modprobe bce Blacklist applesmc /etc/modprobe.d/applesmc.conf
blacklist applesmc Add pcie_ports=compat as a kernel parameter. Edit /etc/default/grub and add it to GRUB_CMDLINE_LINUX_DEFAULT e.g. GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet pcie_ports=compat" then run grub-mkconfig -o /boot/grub/grub.cfg and reboot.
Currently (20/09/2019) the touchbar driver crashes on resume and the thunderbolt driver causes suspend to take 30+ seconds and resume to take several minutes. This is fixed by automaitcally unloading the problematic modules on suspend and reloading them on resume.
Create /lib/systemd/system-sleep/rmmod.sh and add:
#!/bin/sh if [ "${1}" == "pre" ]; then rmmod thunderbolt rmmod apple_ib_tb elif [ "${1}" == "post" ]; then modprobe apple_ib_tb modprobe thunderbolt fi and make the file executable:
sudo chmod +x /lib/systemd/system-sleep/rmmod.sh
Works out of the box with a compatible adapter
This part is largely lifted from a StackOverflow post by Aiden Yeomin Nam:
https://stackoverflow.com/questions/51669724/install-rt-linux-patch-for-ubuntu
- Make a working directory
$ mkdir ~/kernel && cd ~/kernel
- Download kernel and patches
Download the kernel (currently 5.6-rc6) from https://www.kernel.org/. You can get it below:
(kernel) https://git.kernel.org/torvalds/t/linux-5.6-rc6.tar.gz
Note the version of the kernel. I used linux-5.6-rc6.tar.gz
Move the zip file to ~/kernel
cd ~/Download
mv linux-5.6-rc6.tar.gz ~/kernel/.
Download aunali's patches
https://github.com/aunali1/linux-mbp-arch
Download and unzip the patches
cd linux-mbp-arch-master
Delete everything that does NOT have the *.patch extension.
- Extract kernel sources and add aunali's patches
Extract kernel sources
cd ~/kernel
tar xvzf linux-5.6-rc6.tar.gz
Patch the kernel
cd linux-5.6-rc6
for i in /home/[YOUR USERNAME]/Downloads/linux-mbp-arch-master/*.patch; do patch -p1 --verbose < $i; done
- Install required packages
For using menuconfig GUI, libncurses-dev is required. flex and bison will be needed when you compile the kernel.
For using gui
sudo apt install libncurses-dev libssl-dev
For compiling kernel
sudo apt install flex bison
- Configure the kernel
make menuconfig
and enter the menuconfig GUI.
I don't change anything, because I don't know what I'm doing. Feel free to change whatever you want for your needs
Select "SAVE" and keep hitting "EXIT" to exit the GUI and back out to the command line.
- Compile the kernel
make -j8
sudo make modules_install -j8
sudo make install -j8
Your computer will churn for an hour or more compiling the kernel. Grab a beer or cofeee, depeding on the time of day.
- Make kernel images lighter
By not fiddling with the menuconfig GUI, the resulting initrd.img file in /boot is going to be almost 1TB instead of ~90MB!!! You can trim this down by:
Strip unneeded symbols of object files
sudo find . -name *.ko -exec strip --strip-unneeded {} +
then update initramfs
sudo update-initramfs -u
- Verify the new kernel is present
Make sure that initrd.img-5.6.0-rc6, vmlinuz-5.6.0-rc6, and config-5.6.0-rc6 are generated in /boot
ls
- Reboot and verify
sudo reboot
After the reboot
uname -r
Now you can check your new kernel version:
5.6.0-rc6
should be the result.
You now have an almost fully functioning Ubuntu installation working on a Macbook Pro 16-inch. Enjoy!
If you had installed Windows 10 via bootcamp prior to intalling Ubuntu, you may have noticed that Windows no longer boots. Fear not! Windows is still there, but for some reason, bootcamp installs Windows 10 in hybrid legacy/GPT mode instead of the regular UEFI. Here's the fix:
-
Boot into linux
-
Open a terminal and type
sudo gdisk /dev/nvme0n1
-
Push
x
for expert mode -
Press
n
to create a protective MBR -
Press
w
to write the partition andy
to confirm -
If you're not automatically exited from gdisk, then type
q
to exit
Reboot and hold down the option key to choose the boot drive. Pick Windows and confirm it loads properly. If so, you'll need to reboot back into MacOS and reinstall rEFInd. This should resolve any weird boot behavior (ie, no more win10, resetting MacOS password, etc).
You'll need to spoof the Macbook Pro into thinking it's booting into MacOS when it's really booting into Linux (this also works for Windows!). Follow the directions here:
Thanks for the reply, I've tried what you said but with no success. I'm on the official 20.04 release with 5.4.0-29 linux kernel if that makes a difference...