From 3cc7db7faccd3da2aa7b8b49b379cb931d4bb9bd Mon Sep 17 00:00:00 2001 From: Andrey Arapov Date: Sun, 2 Feb 2020 19:38:41 +0100 Subject: [PATCH] add roadrunner2/macbook12-spi-driver --- .gitignore | 1 + Makefile | 15 ++++++++++++++- kernel.spec.in | 13 +++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 986d07a..1e3a236 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ WireGuard-*.tar.xz WireGuard-*.tar.asc kernel-*/ config-base-* +macbook12-spi-driver-*.tar.gz diff --git a/Makefile b/Makefile index c03a0f6..a10f2fa 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,13 @@ ifeq ($(DOWNLOAD_FROM_GIT),1) URL := https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-$(VERSION).tar.gz endif -get-sources: $(SRC_FILE) $(SIGN_FILE) $(WG_SRC_FILE) $(WG_SIG_FILE) +SPI_BASE_URL := https://github.com/roadrunner2/macbook12-spi-driver/archive +SPI_REVISION := 31cc060adcb431efdf9cf547d600bb45bb00a7f4 +SPI_SRC_URL := $(SPI_BASE_URL)/$(SPI_REVISION).tar.gz +SPI_SRC_FILE := macbook12-spi-driver-$(SPI_REVISION).tar.gz +SPI_HASH_SHA256 := 46da514227bb2694e571ec4fff746d1302f41cdea5fe7cb2e522349f96ac83c1 + +get-sources: $(SRC_FILE) $(SIGN_FILE) $(WG_SRC_FILE) $(WG_SIG_FILE) $(SPI_SRC_FILE) $(SRC_FILE): @wget -q -N $(URL) @@ -79,6 +85,9 @@ $(WG_SRC_FILE): $(WG_SIG_FILE): @wget -q -N $(WG_SIG_URL) +$(SPI_SRC_FILE): + @wget -q -N -O $(SPI_SRC_FILE) $(SPI_SRC_URL) + import-keys: @if [ -n "$$GNUPGHOME" ]; then rm -f "$$GNUPGHOME/linux-kernel-trustedkeys.gpg"; fi @gpg --no-auto-check-trustdb --no-default-keyring --keyring linux-kernel-trustedkeys.gpg -q --import kernel*-key.asc @@ -94,6 +103,7 @@ else # verify locally based on a signed git tag and commit hash file sha512sum --quiet -c $(HASH_FILE) endif + @gunzip -c $(SPI_SRC_FILE) | sha256sum | head -c64 | grep -q "^$(SPI_HASH_SHA256)$$" .PHONY: clean-sources clean-sources: @@ -103,6 +113,9 @@ endif ifneq ($(WG_SRC_FILE), None) -rm $(WG_SRC_FILE) $(WG_SIG_FILE) endif +ifneq ($(SPI_SRC_FILE), None) + -rm $(SPI_SRC_FILE) +endif #RPM := rpmbuild --buildroot=/dev/shm/buildroot/ diff --git a/kernel.spec.in b/kernel.spec.in index e90a487..2ed72c5 100644 --- a/kernel.spec.in +++ b/kernel.spec.in @@ -14,6 +14,7 @@ %define prerelease 0 %define rel %{plainrel}.%{variant} %endif +%define spi_revision 31cc060adcb431efdf9cf547d600bb45bb00a7f4 %define _buildshell /bin/bash %define build_xen 1 @@ -112,6 +113,7 @@ Source0: linux-%{upstream_version}.tar.xz Source0: linux-%{upstream_version}.tar.gz %endif Source5: WireGuard-0.0.20191219.tar.xz +Source6: macbook12-spi-driver-%spi_revision.tar.gz Source16: guards Source17: apply-patches Source18: mod-sign.sh @@ -210,6 +212,9 @@ rm -rf %_builddir/wireguard tar x -C %_builddir -Jpf %{SOURCE5} mv %_builddir/$(basename %{SOURCE5} .tar.xz) %_builddir/wireguard +rm -rf %_builddir/macbook12-spi-driver +tar -x -C %_builddir -zf %{SOURCE6} +mv %_builddir/$(basename %{SOURCE6} .tar.gz) %_builddir/macbook12-spi-driver %build @@ -247,6 +252,11 @@ fi %{__modsign_install_post} +# Build applespi, apple-ibridge, apple-ib-tb, apple-ib-als modules +if [ -d "%_builddir/macbook12-spi-driver" ]; then + make -C %kernel_build_dir M=%_builddir/macbook12-spi-driver modules +fi + %install # get rid of /usr/lib/rpm/brp-strip-debug @@ -286,6 +296,9 @@ fi if [ -d "%_builddir/wireguard" ]; then make modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot M=%_builddir/wireguard/src fi +if [ -d "%_builddir/macbook12-spi-driver" ]; then + make modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot M=%_builddir/macbook12-spi-driver +fi mkdir -p %buildroot/%src_install_dir