Zero-Fork-Storage / T2-Ubuntu-Kernel

Ubuntu/Debian Clang(LLVM) Linux Kernel build for T2 Macs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

T2 Ubuntu Kernel

Ubuntu/Mint/Debian kernel with Apple T2 patches built-in. This repo will try to keep up with kernel new releases.

Build Kernel Package

This project is closely inspired by mikeeq/mbp-fedora-kernel and marcosfad/mbp-ubuntu-kernel. Thank you @mikeeq and @marcosfad for the scripts and setup.

Special thanks to @Redecorating for the CI.

If this repo helped you in any way, consider inviting a coffee to the people in the credits (links given here).

Pre installation steps

Releases starting from 5.16.2 and 5.15.16 (LTS) have apple-bce and apple-ibridge drivers built-into the kernel. Thus, you may remove the dkms versions of them by running :-

sudo rm -r /usr/src/apple-bce*
sudo rm -r /usr/src/apple-ibridge*
sudo rm -r /var/lib/dkms/apple-bce
sudo rm -r /var/lib/dkms/apple-ibridge

In case you have used an iso with kernel version 5.8.x or lower, then the above steps are compulsory.

If you want to install an older kernel (i.e. older than 5.16.2 or 5.15.16 (LTS)), then follow the DKMS Guide to uninstall old drivers and get new drivers for the kernels. It is required only once and must be done before installing a kernel from here.

INSTALLATION

Using the Kernel Upgrade script

Firstly get a copy of the kernel upgrade script by running :-

sudo wget https://raw.githubusercontent.com/t2linux/T2-Ubuntu-Kernel/Mainline/update_t2_kernel -P /usr/bin
sudo chmod 755 /usr/bin/update_t2_kernel

Now, whenever you wish to upgrade your kernel, run :-

update_t2_kernel -v

Case of users wanting latest LTS kernels

In case you want to download the latest LTS release, instead of the Mainline ones, then edit the script by running sudo gedit /usr/bin/update_t2_kernel and change use_lts=false to use_lts=true and save the file. Now, running update_t2_kernel -v shall upgrade the kernel to the latest LTS release.

Download package manually

Download the .deb packages of linux-headers and linux-image of the kernel you wish to install from the releases section.

Install linux-headers first and then linux-image using apt and restart your Mac. In case you do not know how to do so, follow the instructions given below. Else you are good to go.

On terminal, type sudo apt install and then drag and drop the linux-headers file to the terminal and press enter/return key.

Do the similar process for linux-images package.

Restart your Mac.

Building yourself

Clone the repo using

git clone https://github.com/t2linux/T2-Ubuntu-Kernel

Open a terminal window and run

cd T2-Ubuntu-Kernel
sudo ./build.sh

The kernel shall take around an hour to compile. After that you shall find three .deb packages in /root/work.

Install the linux-headers package first using apt. In case you do not know how to do so, follow the instructions described in the above The easy way section. Similarly install the linux-image package too.

Restart your Mac.

You may then delete the /root/work directory using sudo rm -r /root/work to free up space.

Docs

Ubuntu

Credits

  • @Redecorating - thanks for editing the scripts and CI for Ubuntu
  • @fishpm-anu - thanks for the kernel upgrade script
  • @marcosfad - thanks for the original script for Ubuntu
  • @MCMrARM - thanks for all RE work
  • @ozbenh - thanks for submitting NVME patch
  • @roadrunner2 - thanks for SPI (touchbar) driver
  • @aunali1 - thanks for ArchLinux Kernel CI and active support
  • @jamlam - thanks for providing the Correlium wifi patch
  • @ppaulweber - thanks for keyboard and Macbook Air patches
  • @mikeeq - thanks for the fedora kernel project and compilation scripts

About

Ubuntu/Debian Clang(LLVM) Linux Kernel build for T2 Macs.


Languages

Language:Shell 76.0%Language:Dockerfile 24.0%