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

Commit a5feadb

Browse files
committed
Remove extra drivers
1 parent b2a02a5 commit a5feadb

11 files changed

Lines changed: 224 additions & 213 deletions

README.md

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# mbp-ubuntu-kernel
22

3+
This repo is still a work in progress.
4+
35
Ubuntu/Mint/Debian kernel 5.6 with Apple T2 patches built-in (Macbooks produced >= 2018).
46

57
Drivers:
@@ -20,74 +22,6 @@ Drone kernel build status:
2022
Travis kernel publish status - <http://mbp-ubuntu-kernel.herokuapp.com/> :
2123
[![Build Status](https://travis-ci.com/marcosfad/mbp-ubuntu-kernel.svg?branch=master)](https://travis-ci.com/marcosfad/mbp-ubuntu-kernel)
2224

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-
9125
## Docs
9226

9327
- Discord: <https://discord.gg/Uw56rqW>

patches/5001-brcmfmac-move-brcmf_mp_device-into-its-own-header.patch.patch renamed to back/5001-brcmfmac-move-brcmf_mp_device-into-its-own-header.patch.patch

File renamed without changes.

patches/5002-brcmfmac-Add-ability-to-manually-specify-FW-rambase.patch renamed to back/5002-brcmfmac-Add-ability-to-manually-specify-FW-rambase.patch

File renamed without changes.
File renamed without changes.
File renamed without changes.

build.sh

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ set -eu -o pipefail
44

55
## Update docker image tag, because kernel build is using `uname -r` when defining package version variable
66
# KERNEL_VERSION=$(curl -s https://www.kernel.org | grep '<strong>' | head -3 | tail -1 | cut -d'>' -f3 | cut -d'<' -f1)
7-
KERNEL_VERSION=5.6.5
7+
KERNEL_VERSION=5.6.7
88
REPO_PATH=$(pwd)
99
WORKING_PATH=/root/work
1010
KERNEL_PATH="${WORKING_PATH}/linux-kernel"
11-
GIT_USERNAME="Ubuntu MBP"
12-
GIT_EMAIL="turkos+ubuntu-mbp@gmail.com"
1311

1412
### Debug commands
1513
echo "KERNEL_VERSION=$KERNEL_VERSION"
@@ -30,14 +28,12 @@ export DEBIAN_FRONTEND=noninteractive
3028
apt update
3129
apt install -y build-essential fakeroot libncurses-dev bison flex libssl-dev libelf-dev \
3230
openssl dkms libudev-dev libpci-dev libiberty-dev autoconf wget xz-utils git \
33-
bc rsync cpio dh-modaliases debhelper kernel-wedge
31+
bc rsync cpio dh-modaliases debhelper kernel-wedge curl
3432

3533
### get Kernel
3634
git clone --depth 1 --single-branch --branch v"${KERNEL_VERSION}" \
3735
git://kernel.ubuntu.com/virgin/linux-stable.git "${KERNEL_PATH}"
3836
cd ./linux-kernel || exit
39-
git config user.name "${GIT_USERNAME}"
40-
git config user.email "${GIT_EMAIL}"
4137

4238
#### Create patch file with custom drivers
4339
echo >&2 "===]> Info: Creating patch file... "
@@ -56,6 +52,7 @@ while IFS= read -r file; do
5652
patch -p1 <"$file"
5753
done < <(find "${WORKING_PATH}/patches" -type f -name "*.patch" | sort)
5854

55+
echo >&2 "===]> Info: Add drivers default configuration... "
5956
### Add new drivers. This config files comes on the one of the patches...
6057
echo "CONFIG_APPLE_BCE_DRIVER=m" >>"${KERNEL_PATH}/debian.master/config/amd64/config.common.ubuntu"
6158
echo "CONFIG_APPLE_TOUCHBAR_DRIVER=m" >>"${KERNEL_PATH}/debian.master/config/amd64/config.common.ubuntu"
@@ -67,27 +64,25 @@ chmod a+x "${KERNEL_PATH}"/debian/rules
6764
chmod a+x "${KERNEL_PATH}"/debian/scripts/*
6865
chmod a+x "${KERNEL_PATH}"/debian/scripts/misc/*
6966

70-
# Get rid of the dirty tag
71-
72-
### Copy configuration
73-
fakeroot debian/rules clean
74-
yes '' | fakeroot /bin/bash -c "export DROOT=debian; export ARCH=amd64; \
75-
${KERNEL_PATH}/debian/scripts/misc/kernelconfig updateconfigs amd64" || true
76-
77-
cp "${KERNEL_PATH}/debian.master/config/amd64/config.flavour.generic" ".config"
67+
echo >&2 "===]> Info: Bulding src... "
7868

69+
cd "${KERNEL_PATH}"
70+
make clean
71+
cp "${WORKING_PATH}/templates/default-config" .config
7972
make olddefconfig
8073

81-
#### Change buildid to mbp
82-
echo >&2 "===]> Info: Bulding src... "
83-
make clean
84-
cd "${KERNEL_PATH}"
85-
git add .
86-
git commit -s -a -m "getting rid of -dirty"
74+
# Get rid of the dirty tag
75+
#LASTEST_BUILD=$(curl -s https://mbp-ubuntu-kernel.herokuapp.com/ -L |
76+
# grep linux-image-${KERNEL_VERSION} | grep a | cut -d'>' -f2 | cut -d'<' -f1 |
77+
# sort -r | head -n 1 | cut -d'-' -f6 | cut -d'_' -f1)
78+
#NEXT_BUILD=$(expr ${LASTEST_BUILD} + 1)
79+
echo "" >${KERNEL_PATH}/.scmversion
80+
8781
make -j "$(getconf _NPROCESSORS_ONLN)" deb-pkg LOCALVERSION=-mbp
8882

8983
#### Copy artifacts to shared volume
9084
echo >&2 "===]> Info: Copying debs and calculating SHA256 ... "
9185
#cp -rfv ../*.deb "${REPO_PATH}/"
86+
#cp -rfv "${KERNEL_PATH}/.config" "${REPO_PATH}/kernel_config"
9287
cp -rfv ../*.deb /tmp/artifacts/
9388
sha256sum ../*.deb >/tmp/artifacts/sha256

patch_driver.sh

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
set -eu -o pipefail
44

5-
#KERNEL_VERSION="${KERNEL_VERSION}"
6-
#WORKING_PATH="${WORKING_PATH}"
75
BUILD_PATH=/tmp/build-kernel
86

97
### Apple T2 drivers commit hashes
10-
APPLE_BCE_DRIVER_GIT_URL=https://github.com/aunali1/mbp2018-bridge-drv.git
11-
APPLE_BCE_DRIVER_BRANCH_NAME=aur
12-
APPLE_BCE_DRIVER_COMMIT_HASH=c884d9ca731f2118a58c28bb78202a0007935998
13-
APPLE_IB_DRIVER_GIT_URL=https://github.com/roadrunner2/macbook12-spi-driver.git
14-
APPLE_IB_DRIVER_BRANCH_NAME=mbp15
15-
APPLE_IB_DRIVER_COMMIT_HASH=90cea3e8e32db60147df8d39836bd1d2a5161871
8+
# Patches
169
APPLE_SMC_DRIVER_GIT_URL=https://github.com/aunali1/linux-mbp-arch
1710
APPLE_SMC_DRIVER_BRANCH_NAME=master
18-
APPLE_SMC_DRIVER_COMMIT_HASH=4c19bf4009a9ee0bf4d9f3406e9d030fe3b85101
11+
APPLE_SMC_DRIVER_COMMIT_HASH=8cca9c0e0411708ee15eb77c00cc93297d1cd4ce
12+
## BCE
13+
#APPLE_BCE_DRIVER_GIT_URL=https://github.com/aunali1/mbp2018-bridge-drv.git
14+
#APPLE_BCE_DRIVER_BRANCH_NAME=aur
15+
#APPLE_BCE_DRIVER_COMMIT_HASH=c884d9ca731f2118a58c28bb78202a0007935998
16+
## SPI
17+
#APPLE_IB_DRIVER_GIT_URL=https://github.com/roadrunner2/macbook12-spi-driver.git
18+
#APPLE_IB_DRIVER_BRANCH_NAME=mbp15
19+
#APPLE_IB_DRIVER_COMMIT_HASH=90cea3e8e32db60147df8d39836bd1d2a5161871
1920

2021
rm -rf "${BUILD_PATH}"
2122
mkdir -p "${BUILD_PATH}"
@@ -30,46 +31,45 @@ git checkout ${APPLE_SMC_DRIVER_COMMIT_HASH}
3031
while IFS= read -r file; do
3132
echo "adding ${file}"
3233
cp -rfv "${file}" "${WORKING_PATH}"/patches/"${file##*/}"
33-
done < <(find "${BUILD_PATH}/linux-mbp-arch" -type f -name "*applesmc*" | sort)
34+
done < <(find "${BUILD_PATH}/linux-mbp-arch" -type f -name "*.patch" | sort)
3435

35-
### Add custom drivers to kernel
36-
echo -e "From: \"Kernel Builder (sita)\" <ubuntu-kernel-bot@canonical.com>\nSubject: patch custom drivers\n" >"${WORKING_PATH}/patches/custom-drivers.patch"
37-
38-
git clone --depth 1 --single-branch --branch v"${KERNEL_VERSION}" \
39-
git://kernel.ubuntu.com/virgin/linux-stable.git "${BUILD_PATH}/linux-stable"
40-
cd "${BUILD_PATH}/linux-stable/drivers" || exit
41-
42-
### apple-bce
43-
git clone --depth 1 --single-branch --branch "${APPLE_BCE_DRIVER_BRANCH_NAME}" \
44-
"${APPLE_BCE_DRIVER_GIT_URL}" "${BUILD_PATH}/linux-stable/drivers/apple-bce"
45-
cd "${BUILD_PATH}/linux-stable/drivers/apple-bce" || exit
46-
git checkout "${APPLE_BCE_DRIVER_COMMIT_HASH}" && rm -rf .git
47-
48-
cd "${BUILD_PATH}/linux-stable/drivers"
49-
cp -rfv "${WORKING_PATH}/templates/Kconfig" "${BUILD_PATH}/linux-stable/drivers/apple-bce/Kconfig"
50-
sed -i "s/TEST_DRIVER/APPLE_BCE_DRIVER/g" "${BUILD_PATH}/linux-stable/drivers/apple-bce/Kconfig"
51-
# shellcheck disable=SC2016
52-
sed -i 's/obj-m/obj-$(CONFIG_APPLE_BCE)/g' "${BUILD_PATH}/linux-stable/drivers/apple-bce/Makefile"
53-
54-
# ### apple-ib
55-
git clone --single-branch --branch "${APPLE_IB_DRIVER_BRANCH_NAME}" \
56-
"${APPLE_IB_DRIVER_GIT_URL}" "${BUILD_PATH}/linux-stable/drivers/apple-touchbar"
57-
cd "${BUILD_PATH}/linux-stable/drivers/apple-touchbar" || exit
58-
git checkout "${APPLE_IB_DRIVER_COMMIT_HASH}" && rm -rf .git
59-
60-
cd "${BUILD_PATH}/linux-stable/drivers"
61-
cp -rfv "${WORKING_PATH}/templates/Kconfig" "${BUILD_PATH}/linux-stable/drivers/apple-touchbar/Kconfig"
62-
sed -i "s/TEST_DRIVER/APPLE_TOUCHBAR_DRIVER/g" "${BUILD_PATH}/linux-stable/drivers/apple-touchbar/Kconfig"
63-
# shellcheck disable=SC2016
64-
sed -i 's/obj-m/obj-$(CONFIG_APPLE_TOUCHBAR)/g' "${BUILD_PATH}/linux-stable/drivers/apple-touchbar/Makefile"
65-
66-
# shellcheck disable=SC2016
67-
echo 'obj-$(CONFIG_APPLE_BCE) += apple-bce/' >>"${BUILD_PATH}/linux-stable/drivers/Makefile"
68-
# shellcheck disable=SC2016
69-
echo 'obj-$(CONFIG_APPLE_TOUCHBAR) += apple-touchbar/' >>"${BUILD_PATH}/linux-stable/drivers/Makefile"
70-
sed -i "\$i source \"drivers/apple-bce/Kconfig\"\n" "${BUILD_PATH}/linux-stable/drivers/Kconfig"
71-
sed -i "\$i source \"drivers/apple-touchbar/Kconfig\"\n" "${BUILD_PATH}/linux-stable/drivers/Kconfig"
72-
73-
## Prepare patch
74-
git add .
75-
git diff HEAD >> "${WORKING_PATH}/patches/custom-drivers.patch"
36+
#### Add custom drivers to kernel
37+
#echo -e "From: \"Kernel Builder (sita)\" <ubuntu-kernel-bot@canonical.com>\nSubject: patch custom drivers\n" >"${WORKING_PATH}/patches/custom-drivers.patch"
38+
#
39+
#git clone --depth 1 --single-branch --branch v"${KERNEL_VERSION}" \
40+
# git://kernel.ubuntu.com/virgin/linux-stable.git "${BUILD_PATH}/linux-stable"
41+
#cd "${BUILD_PATH}/linux-stable/drivers" || exit
42+
#
43+
#### apple-bce
44+
#git clone --depth 1 --single-branch --branch "${APPLE_BCE_DRIVER_BRANCH_NAME}" \
45+
# "${APPLE_BCE_DRIVER_GIT_URL}" "${BUILD_PATH}/linux-stable/drivers/apple-bce"
46+
#cd "${BUILD_PATH}/linux-stable/drivers/apple-bce" || exit
47+
#git checkout "${APPLE_BCE_DRIVER_COMMIT_HASH}" && rm -rf .git
48+
#
49+
#cd "${BUILD_PATH}/linux-stable/drivers"
50+
#cp -rfv "${WORKING_PATH}/templates/Kconfig" "${BUILD_PATH}/linux-stable/drivers/apple-bce/Kconfig"
51+
#sed -i "s/TEST_DRIVER/APPLE_BCE_DRIVER/g" "${BUILD_PATH}/linux-stable/drivers/apple-bce/Kconfig"
52+
## shellcheck disable=SC2016
53+
#sed -i 's/obj-m/obj-$(CONFIG_APPLE_BCE)/g' "${BUILD_PATH}/linux-stable/drivers/apple-bce/Makefile"
54+
## shellcheck disable=SC2016
55+
#echo 'obj-$(CONFIG_APPLE_BCE) += apple-bce/' >>"${BUILD_PATH}/linux-stable/drivers/Makefile"
56+
#sed -i "\$i source \"drivers/apple-bce/Kconfig\"\n" "${BUILD_PATH}/linux-stable/drivers/Kconfig"
57+
#
58+
#### apple-ib
59+
#git clone --single-branch --branch "${APPLE_IB_DRIVER_BRANCH_NAME}" \
60+
# "${APPLE_IB_DRIVER_GIT_URL}" "${BUILD_PATH}/linux-stable/drivers/apple-touchbar"
61+
#cd "${BUILD_PATH}/linux-stable/drivers/apple-touchbar" || exit
62+
#git checkout "${APPLE_IB_DRIVER_COMMIT_HASH}" && rm -rf .git
63+
#
64+
#cd "${BUILD_PATH}/linux-stable/drivers"
65+
#cp -rfv "${WORKING_PATH}/templates/Kconfig" "${BUILD_PATH}/linux-stable/drivers/apple-touchbar/Kconfig"
66+
#sed -i "s/TEST_DRIVER/APPLE_TOUCHBAR_DRIVER/g" "${BUILD_PATH}/linux-stable/drivers/apple-touchbar/Kconfig"
67+
## shellcheck disable=SC2016
68+
#sed -i 's/obj-m/obj-$(CONFIG_APPLE_TOUCHBAR)/g' "${BUILD_PATH}/linux-stable/drivers/apple-touchbar/Makefile"
69+
## shellcheck disable=SC2016
70+
#echo 'obj-$(CONFIG_APPLE_TOUCHBAR) += apple-touchbar/' >>"${BUILD_PATH}/linux-stable/drivers/Makefile"
71+
#sed -i "\$i source \"drivers/apple-touchbar/Kconfig\"\n" "${BUILD_PATH}/linux-stable/drivers/Kconfig"
72+
#
73+
### Prepare patch
74+
#git add .
75+
#git diff HEAD >> "${WORKING_PATH}/patches/custom-drivers.patch"

0 commit comments

Comments
 (0)