aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Chancellor <natechancellor@gmail.com>2020-06-02 14:46:50 -0700
committerNathan Chancellor <natechancellor@gmail.com>2020-06-02 14:46:50 -0700
commit4e217ddb576884a70fa3cdc08dc96da02dcddb37 (patch)
tree7207556bbec255c5f63d3d130bcc40c1eaab2ef3
parentJune update (diff)
downloadandroid-wireguard-module-builder-4e217ddb576884a70fa3cdc08dc96da02dcddb37.tar.xz
android-wireguard-module-builder-4e217ddb576884a70fa3cdc08dc96da02dcddb37.zip
kernels: wahoo: apply a patch to fix the build
We need this patch after upstream stable commit 78d19b437554 ("kbuild: fix single target build for external module") was merged via 4.4.210 in the June security update. prepare is now called when building an external module, which calls vdso_prepare, which then calls prepare0, which is only defined when KBUILD_EXTMOD is set. This is not a problem for upstream stable because commit a66649dab350 ("arm64: fix vdso-offsets.h dependency") is not applied there; it is only applied in the Wahoo tree as part of a series of vDSO commits they added. Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
-rw-r--r--kernels/wahoo/0001-BACKPORT-arm64-makefile-fix-build-of-.i-file-in-exte.patch56
-rw-r--r--kernels/wahoo/do.bash2
2 files changed, 58 insertions, 0 deletions
diff --git a/kernels/wahoo/0001-BACKPORT-arm64-makefile-fix-build-of-.i-file-in-exte.patch b/kernels/wahoo/0001-BACKPORT-arm64-makefile-fix-build-of-.i-file-in-exte.patch
new file mode 100644
index 0000000..2d9dbd8
--- /dev/null
+++ b/kernels/wahoo/0001-BACKPORT-arm64-makefile-fix-build-of-.i-file-in-exte.patch
@@ -0,0 +1,56 @@
+From 43727ef63928891e14c8b02d518d353130092edc Mon Sep 17 00:00:00 2001
+From: Victor Kamensky <kamensky@cisco.com>
+Date: Tue, 30 Oct 2018 16:37:10 -0700
+Subject: [PATCH android-msm-wahoo-4.4] BACKPORT: arm64: makefile fix build of
+ .i file in external module case
+
+commit 98356eb0ae499c63e78073ccedd9a5fc5c563288 upstream.
+
+After 'a66649dab350 arm64: fix vdso-offsets.h dependency' if
+one will try to build .i file in case of external kernel module,
+build fails complaining that prepare0 target is missing. This
+issue came up with SystemTap when it tries to build variety
+of .i files for its own generated kernel modules trying to
+figure given kernel features/capabilities.
+
+The issue is that prepare0 is defined in top level Makefile
+only if KBUILD_EXTMOD is not defined. .i file rule depends
+on prepare and in case KBUILD_EXTMOD defined top level Makefile
+contains empty rule for prepare. But after mentioned commit
+arch/arm64/Makefile would introduce dependency on prepare0
+through its own prepare target.
+
+Fix it to put proper ifdef KBUILD_EXTMOD around code introduced
+by mentioned commit. It matches what top level Makefile does.
+
+Acked-by: Kevin Brodsky <kevin.brodsky@arm.com>
+Signed-off-by: Victor Kamensky <kamensky@cisco.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+---
+ arch/arm64/Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
+index 186101b7b4a5..3af819e41caa 100644
+--- a/arch/arm64/Makefile
++++ b/arch/arm64/Makefile
+@@ -203,6 +203,7 @@ archclean:
+ CLEAN_FILES += $(boot)/Image $(boot)/Image-dtb $(boot)/Image.* $(boot)/dtbo.img $(boot)/*.dtbc
+ MRPROPER_FILES += $(boot)/Image $(boot)/Image-dtb $(boot)/Image.* $(boot)/dtbo.img $(boot)/*.dtbc
+
++ifeq ($(KBUILD_EXTMOD),)
+ # We need to generate vdso-offsets.h before compiling certain files in kernel/.
+ # In order to do that, we should use the archprepare target, but we can't since
+ # asm-offsets.h is included in some files used to generate vdso-offsets.h, and
+@@ -214,6 +215,7 @@ vdso_prepare: prepare0
+ $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h
+ $(if $(CONFIG_VDSO32),$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 \
+ include/generated/vdso32-offsets.h)
++endif
+
+ define archhelp
+ echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
+--
+2.27.0.rc2
+
diff --git a/kernels/wahoo/do.bash b/kernels/wahoo/do.bash
index b09a829..4ad8259 100644
--- a/kernels/wahoo/do.bash
+++ b/kernels/wahoo/do.bash
@@ -1,5 +1,7 @@
#!/bin/bash
set -ex
+BASE="$(readlink -f "$(dirname "$(readlink -f "$0")")")"
+patch -d private/msm-google -p1 < "$BASE/0001-BACKPORT-arm64-makefile-fix-build-of-.i-file-in-exte.patch"
echo 'EXT_MODULES="${EXT_MODULES} wireguard"' >> private/msm-google/build.config
./build/build.sh
readlink -f out/android-msm-wahoo-4.4/dist/wireguard.ko >&7