/mbp-ubuntu

UBUNTU 20.04 for Mac with T2

Primary LanguageShell

mbp-ubuntu

UBUNTU 20.04 ISO with Apple T2 patches built-in. The ISO in from this repo should allow you to install ubuntu without using an external keyboard or mouse on a MacBook Pro. It work in my MacBook with T2.

CI

If this repo helped you in any way, consider inviting a coffee to the people in the credits or me.

This repo is a rework of the great work done by @mikeeq

I'm using the Kernel from - https://github.com/t2linux/T2-Ubuntu-Kernel

Using additional drivers:

Bootloader is configure correctly out of the box. No workaround needed.

How to install (Based on mikeeq/mbp-fedora)

  1. Reduce the size of the mac partition in MacOS

  2. Turn off secure boot and allow booting from external media - https://support.apple.com/en-us/HT208330

  3. Download .iso from releases section - https://github.com/marcosfad/mbp-ubuntu/releases/latest

    If it's split into multiple zip parts, i.e.: livecd.zip and livecd.z01 you need to download all zip parts and then

  4. Next you can check the SHA256 checksum of extracted .ISO to verify if your extraction process went well

    MacOS: shasum -a 256 ubuntu-20.04.iso Linux sha256sum ubuntu-20.04.iso please compare it with a value in sha256 file available in github releases

  5. Burn the image on USB stick >=8GB via:

    • dd

      • Linux sudo dd bs=4M if=/home/user/Downloads/ubuntu-20.04.iso of=/dev/sdc conv=fdatasync status=progress
      • MacOS
        diskutil list # found which number has the USB
        sudo diskutil umountDisk /dev/diskX
        sudo dd bs=4096 if=ubuntu-20.04-XXX.iso of=/dev/diskX
      • if dd is not working for you for some reason you can try to install gdd via brew and use GNU dd command instead sudo gdd bs=4M if=ubuntu-20.04-XXX.iso of=/dev/diskX conv=fdatasync status=progress
    • Rufus (GPT)- https://rufus.ie/, if prompted use DD mode

    • Please don't use livecd-iso-to-disk as it's overwriting ISO default grub settings and Ubuntu will not boot correctly!

  6. Boot in Recovery mode and allow booting unknown OS

  7. Restart and immediately press the option key until the Logo come up

  8. Select "EFI Boot" (the third option was the one that worked for me)

  9. Launch Ubuntu Live

  10. Use Ubiquity to install (just click on it)

  11. [IMPORTANT] Select the options that work for you and use for the partition the following setup:

    • Leave the efi boot as preselected by the installer. Your Mac will keep on working without problems.
    • Add a ext4 partition and mounted as /boot (1024MB).
    • Add a ext4 partition and monted as / (rest).
    • Select the /boot partition as a target for GRUB installation, otherwise the system won't boot.
  12. Run the installer (In my case it had some problem removing some packages at the end, but this is no real problem)

  13. Shutdown and remove the USB Drive

  14. Start again using the option key. Select the new efi boot.

  15. Enjoy.

See https://wiki.t2linux.org/distributions/ubuntu/installation/ for more details.

Configuration

# /etc/modprobe.d/hid_apple.conf
options hid_apple swap_fn_leftctrl=1
options hid_apple swap_opt_cmd=1
  • I switch the touchbar to show f* by default. If you like another configuration, change /etc/modprobe.d/apple-tb.conf or remove it.
  • To update grub, run: grub-mkconfig -o /boot/grub/grub.cfg
  • If you have problems with shutdown and your mac has an AMD video Card, try deactivating the dpm on kernel (by adding amdgpu.dpm=0 to the kernel options) or use copy the udev rule (sudo cp /usr/src/udev_rules_d_30-amdgpu-pm.rules /etc/udev/rules.d/30-amdgpu-pm.rules)

MISC

Activate Grub Menu

For the people who want to have a menu, they can modify /etc/default/grub with the following changes:

GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10

and then: sudo update-grub

Crashes with amdgpu or shutdown issues

Try to disable the power management by adding amdgpu.dpm=0 to the kernel command line or disabling it temporarily using:

echo high | sudo tee /sys/bus/pci/drivers/amdgpu/0000:??:??.?/power_dpm_force_performance_level

if that fix the issue for you, you can make this change permanent using:

sudo su
cat << EOF > /etc/udev/rules.d/30-amdgpu-pm.rules
KERNEL=="card0", SUBSYSTEM=="drm", DRIVERS=="amdgpu", ATTR{device/power_dpm_force_performance_level}="high"
EOF

Update to newer kernels

IF YOU UPDATE THE KERNEL, REMEMBER TO ADD THE REQUIRED DRIVERS AGAIN.

The easy way:

The live cd includes a script to download the latest T2-Ubuntu-Kernel. Just run update_kernel_mbp.

Another way:

Check https://github.com/marcosfad/mbp-ubuntu/blob/master/files/chroot_build.sh to see how it is done.

Or read https://wiki.t2linux.org/guides/kernel/

Know issues

  • Checksum is failing for 2 files: md5sum.txt and /boot/grub/bios.img

Not working (Following the mikeeq/mbp-fedora)

  • Dynamic audio input/output change (on connecting/disconnecting headphones jack)
  • TouchID - (@MCMrARM is working on it - Dunedan/mbp-2016-linux#71 (comment))
  • Microphone (it's recognised with new apple t2 sound driver, but there is a low mic volume amp)

TODO

  • ISO is using gzip initramfs. It would be great to change it lz4
  • Optimize the software installed.

Known issues (Following the mikeeq/mbp-fedora)

  • Kernel/Mac related issues are mentioned in kernel repo
  • ctrl+x is not working in GRUB, so if you are trying to change kernel parameters - start your OS by clicking ctrl+shift+f10 on external keyboard

Docs

Ubuntu

Github

Credits

  • @mikeeq - thanks for the amazing work in mbp-fedora
  • @MCMrARM - thanks for all RE work
  • @ozbenh - thanks for submitting NVME patch
  • @roadrunner2 - thanks for SPI (touchbar) driver
  • @aunali1 - thanks for ArchLinux Kernel CI, the continuous support on discord and your continuous efforts.
  • @ppaulweber - thanks for keyboard and Macbook Air patches
  • @kevineinarsson - thanks for the audio settings

(deprecated) Which kernel to choose

I've pre installed several different kernel, to allow better support to different hardware.

If your macbook came with Big Sur preinstalled, you should use a bigsur version of kernel.

If your macbook came with mojave, you should use a mojave version of the kernel.

This will allow you to activate wifi in your macbook. See this page for more information about wifi drivers

I've recommend starting with the HWE Kernel. That one comes from Ubuntu own repository and I have had great performance with it.