Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit b2a02a5

Browse files
committed
Initial commit
0 parents  commit b2a02a5

25 files changed

Lines changed: 262594 additions & 0 deletions

.drone.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
kind: pipeline
3+
name: mbp-ubuntu-kernel
4+
5+
trigger:
6+
event:
7+
exclude:
8+
- pull_request
9+
10+
steps:
11+
- name: lint
12+
image: alpine
13+
pull: always
14+
commands:
15+
- apk add --no-cache shellcheck python3 bash
16+
- pip3 install yamllint
17+
- yamllint .
18+
- shellcheck ./*.sh
19+
20+
- name: build
21+
image: ubuntu:20.04
22+
pull: always
23+
volumes:
24+
- name: build-artifacts
25+
path: /tmp/artifacts
26+
commands:
27+
- ./build.sh
28+
29+
- name: publish-github
30+
image: plugins/github-release
31+
volumes:
32+
- name: build-artifacts
33+
path: /tmp/artifacts
34+
settings:
35+
api_key:
36+
from_secret: github_token
37+
files: /tmp/artifacts/*
38+
prerelease: true
39+
when:
40+
event: tag
41+
42+
volumes:
43+
- name: build-artifacts
44+
temp: {}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/patches/custom-drivers.patch
2+
/releases
3+
/linux-*

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
language: bash
3+
4+
os:
5+
- linux
6+
7+
services:
8+
- docker
9+
10+
branches:
11+
only:
12+
- master
13+
14+
script:
15+
- ./publish.sh

README.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# mbp-ubuntu-kernel
2+
3+
Ubuntu/Mint/Debian kernel 5.6 with Apple T2 patches built-in (Macbooks produced >= 2018).
4+
5+
Drivers:
6+
7+
- Apple T2 (audio, keyboard, touchpad) - <https://github.com/MCMrARM/mbp2018-bridge-drv>
8+
- Apple SMC - <https://github.com/MCMrARM/mbp2018-etc>
9+
- Touchbar - <https://github.com/roadrunner2/macbook12-spi-driver/tree/mbp15>
10+
11+
This project is closely inspired by mikeeq/mbp-fedora-kernel. Thank you @mikeeq for the scripts and setup.
12+
13+
IF YOU ENJOY THIS CODE, CONSIDER CONTRIBUTING TO THE AUTHORS @MCMrARM @roadrunner2 @aunali1 @ppaulweber @mikeeq, they did all the hard work.
14+
15+
## CI status
16+
17+
Drone kernel build status:
18+
[![Build Status](https://cloud.drone.io/api/badges/marcosfad/mbp-ubuntu-kernel/status.svg)](https://cloud.drone.io/marcosfad/mbp-ubuntu-kernel)
19+
20+
Travis kernel publish status - <http://mbp-ubuntu-kernel.herokuapp.com/> :
21+
[![Build Status](https://travis-ci.com/marcosfad/mbp-ubuntu-kernel.svg?branch=master)](https://travis-ci.com/marcosfad/mbp-ubuntu-kernel)
22+
23+
## TODO
24+
25+
### Known issues
26+
27+
- Dynamic audio input/output change (on connecting/disconnecting headphones jack)
28+
- TouchID - (@MCMrARM is working on it - https://github.com/Dunedan/mbp-2016-linux/issues/71#issuecomment-528545490)
29+
- Thunderbolt (is disabled, because driver was causing kernel panics (not tested with 5.5 kernel))
30+
- Microphone (it's recognised with new apple t2 sound driver, but there is a low mic volume amp)
31+
32+
#### Working with upstream stable kernel 5.1
33+
34+
- Display/Screen
35+
- USB-C
36+
- Battery/AC
37+
- Ethernet/Video USB-C adapters
38+
- Bluetooth
39+
40+
#### Working with mbp-ubuntu-kernel
41+
42+
- NVMe
43+
- Camera
44+
- keyboard
45+
- touchpad (scroll, right click)
46+
- wifi (not Macbook pro 16,1)
47+
- you need to manually extract firmware from macOS
48+
- <https://github.com/Dunedan/mbp-2016-linux/issues/71#issuecomment-517444300>
49+
- <https://github.com/Dunedan/mbp-2016-linux/issues/71#issuecomment-515401480>
50+
- or download it from <https://packages.aunali1.com/apple/wifi-fw/18G2022>
51+
52+
> Firmware can be found by running `ioreg -l | grep C-4364` or `ioreg -l | grep RequestedFiles` under macOS
53+
54+
```
55+
Put the firmware in the right place!
56+
The .trx file for your model goes to /lib/firmware/brcm/brcmfmac4364-pcie.bin,
57+
the .clmb goes to /lib/firmware/brcm/brcmfmac4364-pcie.clm_blob
58+
and the .txt to something like /lib/firmware/brcm/brcmfmac4364-pcie.Apple Inc.-MacBookPro15,2.txt
59+
```
60+
61+
```
62+
# ls -l /lib/firmware/brcm | grep 4364
63+
-rw-r--r--. 1 root root 12860 Mar 1 12:44 brcmfmac4364-pcie.Apple Inc.-MacBookPro15,2.txt
64+
-rw-r--r--. 1 root root 922647 Mar 1 12:44 brcmfmac4364-pcie.bin
65+
-rw-r--r--. 1 root root 33226 Mar 1 12:44 brcmfmac4364-pcie.clm_blob
66+
```
67+
68+
```
69+
# dmesg
70+
brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)
71+
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
72+
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4364-pcie for chip BCM4364/3
73+
brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4364/3 wl0: Mar 28 2019 19:17:52 version 9.137.9.0.32.6.34 FWID 01-36f56c94
74+
brcmfmac 0000:01:00.0 wlp1s0: renamed from wlan0
75+
```
76+
77+
#### Working with external drivers
78+
79+
>> with @MCMrARM mbp2018-bridge-drv
80+
81+
- keyboard
82+
- touchpad
83+
- touchbar
84+
- audio
85+
86+
#### Not tested
87+
88+
- eGPU
89+
- Thunderbolt
90+
91+
## Docs
92+
93+
- Discord: <https://discord.gg/Uw56rqW>
94+
- WiFi firmware: <https://packages.aunali1.com/apple/wifi-fw/18G2022>
95+
- blog `Installing Fedora 31 on a 2018 Mac mini`: <https://linuxwit.ch/blog/2020/01/installing-fedora-on-mac-mini/>
96+
- iwd:
97+
- <https://iwd.wiki.kernel.org/networkconfigurationsettings>
98+
- <https://wiki.archlinux.org/index.php/Iwd>
99+
- <https://www.vocal.com/secure-communication/eap-types/>
100+
101+
### Ubuntu
102+
103+
- <https://wiki.ubuntu.com/KernelTeam/GitKernelBuild>
104+
- <https://help.ubuntu.com/community/Repositories/Personal>
105+
- <https://medium.com/sqooba/create-your-own-custom-and-authenticated-apt-repository-1e4a4cf0b864>
106+
- <https://help.ubuntu.com/community/Kernel/Compile>
107+
- <https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel>
108+
- <https://www.linux.com/training-tutorials/kernel-newbie-corner-building-and-running-new-kernel/>
109+
- <https://wiki.ubuntu.com/KernelTeam/KernelMaintenance>
110+
111+
### Github
112+
113+
- GitHub issue (RE history): <https://github.com/Dunedan/mbp-2016-linux/issues/71>
114+
- VHCI+Sound driver (Apple T2): <https://github.com/MCMrARM/mbp2018-bridge-drv/>
115+
- AppleSMC driver (fan control): <https://github.com/MCMrARM/mbp2018-etc/tree/master/applesmc>
116+
- hid-apple keyboard backlight patch: <https://github.com/MCMrARM/mbp2018-etc/tree/master/apple-hid>
117+
- TouchBar driver: <https://github.com/roadrunner2/macbook12-spi-driver/tree/mbp15>
118+
- Kernel patches (all are mentioned in github issue above): <https://github.com/aunali1/linux-mbp-arch>
119+
- ArchLinux kernel patches: <https://github.com/ppaulweber/linux-mba>
120+
- hid-apple-patched module for changing mappings of ctrl, fn, option keys: <https://github.com/free5lot/hid-apple-patched>
121+
122+
## Credits
123+
124+
- @MCMrARM - thanks for all RE work
125+
- @ozbenh - thanks for submitting NVME patch
126+
- @roadrunner2 - thanks for SPI (touchbar) driver
127+
- @aunali1 - thanks for ArchLinux Kernel CI
128+
- @ppaulweber - thanks for keyboard and Macbook Air patches
129+
- @mikeeq - thanks for the fedora kernel project and compilation scripts

apt-repo/Dockerfile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
FROM ubuntu:20.04
2+
3+
ARG RELEASE_VERSION=5.6.4
4+
ARG GPG_KEY=some_key
5+
ARG GPG_PASS=some_pass
6+
ARG GPG_KEY_ID=some_id
7+
8+
ENV GITHUB_URL=github.com/marcosfad/mbp-ubuntu-kernel/releases
9+
ENV REPO_URL=mbp-ubuntu-kernel.herokuapp.com
10+
ENV LANG en_US.utf8
11+
12+
WORKDIR /var/repo
13+
14+
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
15+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
16+
locales dpkg-dev dpkg-sig nginx gettext wget curl apt-utils \
17+
&& rm -rf /var/lib/apt/lists/* \
18+
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
19+
20+
RUN echo "${GPG_KEY}" > PRIVATE_GPG_KEY.asc \
21+
&& gpg -v --batch --passphrase "${GPG_PASS}" --import PRIVATE_GPG_KEY.asc \
22+
&& rm PRIVATE_GPG_KEY.asc \
23+
&& gpg --list-keys \
24+
&& gpg --output /var/repo/KEY.gpg --armor --export ${GPG_KEY_ID}
25+
26+
RUN for deb in $(curl -s https://${REPO_URL}/ -L | grep deb | grep a | cut -d'>' -f2 | cut -d'<' -f1); do \
27+
wget -q --backups=1 https://${REPO_URL}/${deb}; \
28+
done \
29+
; rm -rfv *.1
30+
31+
RUN echo "${GPG_PASS}" > PRIVATE_GPG_PASS \
32+
&& export GPG_TTY=$(tty) && \
33+
for deb in $(curl -s https://${GITHUB_URL}/latest -L | grep deb | grep span | cut -d'>' -f2 | cut -d'<' -f1); do \
34+
wget -q --backups=1 https://${GITHUB_URL}/download/v${RELEASE_VERSION}/${deb} && \
35+
dpkg-sig -k ${GPG_KEY_ID} -v --sign builder "./${deb}" \
36+
--gpg-options="--batch --pinentry-mode loopback --no-tty --passphrase-file ./PRIVATE_GPG_PASS"; \
37+
done \
38+
; rm PRIVATE_GPG_PASS \
39+
; rm -rfv *.1
40+
41+
RUN apt-ftparchive --arch amd64 packages . > Packages \
42+
&& gzip -k -f Packages \
43+
&& apt-ftparchive release . > Release
44+
45+
RUN echo "${GPG_PASS}" | gpg --batch --pinentry-mode loopback --yes --default-key "${GPG_KEY_ID}"\
46+
--passphrase-fd 0 -abs -o Release.gpg Release \
47+
&& echo "${GPG_PASS}" | gpg --batch --pinentry-mode loopback --yes --default-key "${GPG_KEY_ID}"\
48+
--passphrase-fd 0 --clearsign -o InRelease Release
49+
50+
RUN chown -R www-data:www-data /var/repo && rm -rfv "/var/repo/${REPO_URL}" && ls -la /var/repo
51+
52+
COPY --chown=www-data:www-data nginx.conf /etc/nginx/nginx.conf
53+
54+
RUN mkdir -p /var/lib/nginx \
55+
&& chown -R www-data:www-data /var/lib/nginx
56+
57+
RUN touch /var/run/nginx.pid && \
58+
chown -R www-data:www-data /var/run/nginx.pid
59+
60+
USER www-data
61+
62+
ENV PORT=8080
63+
EXPOSE ${PORT}
64+
65+
CMD /bin/bash -c "envsubst '\$PORT' < /etc/nginx/nginx.conf > /tmp/nginx.conf; cat /tmp/nginx.conf > /etc/nginx/nginx.conf" && nginx -g 'daemon off;'

apt-repo/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Install the Heroku CLI
2+
3+
Download and install the Heroku CLI.
4+
5+
If you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key.
6+
7+
$ heroku login
8+
Create a new Git repository
9+
10+
Initialize a git repository in a new or existing directory
11+
12+
$ cd my-project/
13+
$ git init
14+
$ heroku git:remote -a mbp-ubuntu-kernel
15+
Deploy your application
16+
17+
Commit your code to the repository and deploy it to Heroku using Git.
18+
19+
$ git add .
20+
$ git commit -am "make it better"
21+
$ git push heroku master
22+
Existing Git repository
23+
24+
For existing repositories, simply add the heroku remote
25+
26+
$ heroku git:remote -a mbp-ubuntu-kernel

apt-repo/nginx.conf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#NGINX main config
2+
worker_processes 1;
3+
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
}
10+
11+
http {
12+
include /etc/nginx/mime.types;
13+
default_type application/octet-stream;
14+
15+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
16+
'$status $body_bytes_sent "$http_referer" '
17+
'"$http_user_agent" "$http_x_forwarded_for"';
18+
19+
sendfile on;
20+
keepalive_timeout 65;
21+
22+
server_names_hash_bucket_size 128;
23+
24+
resolver 8.8.8.8 8.8.4.4;
25+
26+
server {
27+
listen $PORT default_server;
28+
root /var/repo;
29+
location / {
30+
index index.php index.html index.htm;
31+
autoindex on; #enable listing of directory index
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)