Skip to content

Commit

Permalink
Fedora Linux v5.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeeq committed Jan 6, 2020
2 parents aedd4e1 + 9d90a9a commit 8ea6da9
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 21 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,20 @@ Travis kernel publish status - <http://fedora-mbp-repo.herokuapp.com/> :

> Tested on: Macbook Pro 15,2 13" 2019 i5 TouchBar Z0WQ000AR MV972ZE/A/R1
```
Boot ROM Version: 220.270.99.0.0 (iBridge: 16.16.6571.0.0,0)
MacOS Mojave: 10.14.6 (18G103)
```

### Known issues

- 5.2<= kernel random kernel panics - just disable thunderbolt driver

```
➜ cat /etc/modprobe.d/blacklist.conf
blacklist applesmc
blacklist thunderbolt
```

- it's working on 5.1, because 5.1 is failing to load thunderbolt firmware
- Microphone (it's recognised with new apple t2 sound driver, but there is a low mic volume amp)
- Dynamic audio outputs change (on connecting/disconnecting headphones jack)
Expand Down
19 changes: 14 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/sh

## Update fedora docker image tag, because kernel build is using `uname -r` when defining package version variable
FEDORA_KERNEL_VERSION=5.4
FEDORA_KERNEL_BRANCH_NAME=master
FEDORA_KERNEL_COMMIT_HASH=aa92e83bbbe79026d32233778371a7fb1ed6c5d1 # Linux v5.4 - https://src.fedoraproject.org/rpms/kernel/commits/master
FEDORA_KERNEL_GIT_URL=https://src.fedoraproject.org/rpms/kernel.git
FEDORA_KERNEL_VERSION=5.4.7
FEDORA_KERNEL_BRANCH_NAME=f31
FEDORA_KERNEL_COMMIT_HASH=b787ad1672064b496bf250645a9d3e2403e40795 # Linux v5.4.7 - https://src.fedoraproject.org/rpms/kernel/commits/f31

### Debug commands
echo "FEDORA_KERNEL_VERSION=$FEDORA_KERNEL_VERSION"
Expand All @@ -16,10 +17,10 @@ cat /proc/cpuinfo | grep 'model name' | uniq
# git clone --depth 1 --single-branch --branch v5.1.19 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

### Dependencies
dnf install -y fedpkg fedora-packager rpmdevtools ncurses-devel pesign git libkcapi libkcapi-devel libkcapi-static libkcapi-tools
dnf install -y fedpkg fedora-packager rpmdevtools ncurses-devel pesign git libkcapi libkcapi-devel libkcapi-static libkcapi-tools zip curl

### Clone Fedora Kernel git repo
git clone --single-branch --branch $FEDORA_KERNEL_BRANCH_NAME https://src.fedoraproject.org/rpms/kernel.git
git clone --single-branch --branch $FEDORA_KERNEL_BRANCH_NAME ${FEDORA_KERNEL_GIT_URL}
cd kernel
## Cleanup
rm -rfv *.rpm
Expand Down Expand Up @@ -60,4 +61,12 @@ rpmbuild_exitcode=$?
find ~/rpmbuild/ | grep '\.rpm'
cp -rfv ~/rpmbuild/RPMS/x86_64/*.rpm /tmp/artifacts/

### Calculate sha256 sums of built RPMs
sha256sum ~/rpmbuild/RPMS/x86_64/*.rpm > /tmp/artifacts/sha256

### Add patches to artifacts
cd ..
zip -r patches.zip patches/
cp -rfv patches.zip /tmp/artifacts/

exit $rpmbuild_exitcode
15 changes: 15 additions & 0 deletions build_in_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

DOCKER_IMAGE=fedora:31
RPMBUILD_HOST_PATH=/opt/rpmbuild

mkdir -p ${RPMBUILD_HOST_PATH}

docker pull ${DOCKER_IMAGE}
docker run \
-t \
--rm \
-v $(pwd):/repo \
-v ${RPMBUILD_HOST_PATH}:/root/rpmbuild \
${DOCKER_IMAGE} \
/bin/bash -c 'cd /repo && ./build.sh'
27 changes: 22 additions & 5 deletions patch_driver.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/sh

### Apple T2 drivers commit hashes
BCE_DRIVER_GIT_URL=https://github.com/MCMrARM/mbp2018-bridge-drv.git
BCE_DRIVER_BRANCH_NAME=master
BCE_DRIVER_COMMIT_HASH=7330e638b9a32b4ae9ea97857f33838b5613cad3
APPLE_IB_DRIVER_GIT_URL=https://github.com/roadrunner2/macbook12-spi-driver.git
APPLE_IB_DRIVER_BRANCH_NAME=mbp15
APPLE_IB_DRIVER_COMMIT_HASH=90cea3e8e32db60147df8d39836bd1d2a5161871
APPLE_SMC_DRIVER_GIT_URL=https://github.com/MCMrARM/mbp2018-etc
APPLE_SMC_DRIVER_BRANCH_NAME=master
APPLE_SMC_DRIVER_COMMIT_HASH=cf42289ad637d3073e2fd348af71ad43dd31b8b4

Expand All @@ -14,42 +17,56 @@ echo -e "From: fedora kernel <fedora@kernel.org>\nSubject: patch custom drivers\
mkdir -p /root/temp
cd /root/temp

git clone --single-branch --branch ${APPLE_SMC_DRIVER_BRANCH_NAME} https://github.com/MCMrARM/mbp2018-etc
git clone --single-branch --branch ${APPLE_SMC_DRIVER_BRANCH_NAME} ${APPLE_SMC_DRIVER_GIT_URL}
cp -rfv mbp2018-etc/applesmc/patches/* ${REPO_PWD}/../patches/

git clone --depth 1 --single-branch --branch v${FEDORA_KERNEL_VERSION} git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd ./linux-stable/drivers

### bce
git clone --depth 1 --single-branch --branch ${BCE_DRIVER_BRANCH_NAME} https://github.com/MCMrARM/mbp2018-bridge-drv.git ./bce
git clone --depth 1 --single-branch --branch ${BCE_DRIVER_BRANCH_NAME} ${BCE_DRIVER_GIT_URL} ./bce
cd bce
git checkout ${BCE_DRIVER_COMMIT_HASH}

rm -rf .git
cd ..
cp -rfv ${REPO_PWD}/../templates/Kconfig bce/Kconfig
sed -i "s/TEST_DRIVER/BCE_DRIVER/g" bce/Kconfig
sed -i 's/obj-m/obj-$(CONFIG_BCE)/g' bce/Makefile

### apple-ib
git clone --single-branch --branch ${APPLE_IB_DRIVER_BRANCH_NAME} https://github.com/roadrunner2/macbook12-spi-driver.git touchbar
git clone --single-branch --branch ${APPLE_IB_DRIVER_BRANCH_NAME} ${APPLE_IB_DRIVER_GIT_URL} touchbar
cd touchbar
git checkout ${APPLE_IB_DRIVER_COMMIT_HASH}
rm -rf .git
cd ..
cp -rfv ${REPO_PWD}/../templates/Kconfig touchbar/Kconfig
sed -i "s/TEST_DRIVER/TOUCHBAR_DRIVER/g" touchbar/Kconfig
sed -i 's/obj-m/obj-$(CONFIG_TOUCHBAR)/g' touchbar/Makefile

echo 'obj-$(CONFIG_BCE) += bce/' >> ./Makefile
echo 'obj-$(CONFIG_TOUCHBAR) += touchbar/' >> ./Makefile
sed -i "\$i source \"drivers/bce/Kconfig\"\n" Kconfig
sed -i "\$i source \"drivers/touchbar/Kconfig\"\n" Kconfig

### Prepare patch
git add .
git diff HEAD >> ${REPO_PWD}/../patches/custom-drivers.patch

### back to fedora kernel repo
cd $REPO_PWD
for config_file in $(ls | grep kernel | grep '.config')
do
echo 'CONFIG_BCE_DRIVER=y' >> $config_file
echo 'CONFIG_TOUCHBAR_DRIVER=y' >> $config_file
echo 'CONFIG_BCE_DRIVER=m' >> $config_file
echo 'CONFIG_TOUCHBAR_DRIVER=m' >> $config_file
done

echo 'CONFIG_BCE_DRIVER=m' > configs/fedora/generic/CONFIG_BCE_DRIVER
echo 'CONFIG_TOUCHBAR_DRIVER=m' >> configs/fedora/generic/CONFIG_TOUCHBAR_DRIVER

echo -e "bce.ko\napple-ib-als.ko\napple-ib-tb.ko\napple-ibridge.ko" >> mod-extra.list
echo 'inputdrvs="gameport tablet touchscreen bce touchbar"' >> filter-x86_64.sh

### Remove thunderbolt driver
sed -i "s/CONFIG_THUNDERBOLT=m/CONFIG_THUNDERBOLT=n/g" kernel-x86_64*
sed -i "s/CONFIG_THUNDERBOLT=m/CONFIG_THUNDERBOLT=n/g" configs/fedora/generic/x86/x86_64/CONFIG_THUNDERBOLT
6 changes: 3 additions & 3 deletions templates/Kconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config TEST_DRIVER
menuconfig TEST_DRIVER
tristate "TEST_DRIVER"
default y

depends on X86 || COMPILE_TEST
default m
19 changes: 12 additions & 7 deletions yum-repo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ RUN dnf -y install \
gettext \
&& dnf clean all

RUN wget -A xml.gz -r http://fedora-mbp-repo.herokuapp.com/ \
&& wget -A xml -r http://fedora-mbp-repo.herokuapp.com/ \
&& wget -A rpm -r http://fedora-mbp-repo.herokuapp.com/ \
&& chown -R nginx:nginx /var/repo
RUN wget -A rpm -r http://fedora-mbp-repo.herokuapp.com/ \
# && wget -A xml -r http://fedora-mbp-repo.herokuapp.com/ \
# && wget -A xml.gz -r http://fedora-mbp-repo.herokuapp.com/ \
&& mv -f ./fedora-mbp-repo.herokuapp.com/*.rpm ./ \
# && mv -f ./fedora-mbp-repo.herokuapp.com/repodata ./ \
&& rm -rfv fedora-mbp-repo.herokuapp.com \
; rm -rfv *.1 \
; chown -R nginx:nginx /var/repo

RUN for rpm in $(curl -s https://github.com/mikeeq/mbp-fedora-kernel/releases/latest -L | grep rpm | grep span | cut -d'>' -f2 | cut -d'<' -f1); do \
wget https://github.com/mikeeq/mbp-fedora-kernel/releases/download/v${RELEASE_VERSION}/$rpm; \
done && \
chown -R nginx:nginx /var/repo
wget --backups=1 https://github.com/mikeeq/mbp-fedora-kernel/releases/download/v${RELEASE_VERSION}/$rpm; \
done \
; rm -rfv *.1 \
; chown -R nginx:nginx /var/repo

RUN createrepo /var/repo

Expand Down

0 comments on commit 8ea6da9

Please sign in to comment.