From: Greg Kroah-Hartman Date: Thu, 4 Apr 2019 10:41:22 +0000 (+0200) Subject: 5.0-stable patches X-Git-Tag: v4.9.168~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50862b42d46971dca74cb2c83a2c579c477b2b85;p=thirdparty%2Fkernel%2Fstable-queue.git 5.0-stable patches added patches: kbuild-add-workaround-for-debian-make-kpkg.patch kbuild-skip-sub-make-for-in-tree-build-with-gnu-make-4.x.patch --- diff --git a/queue-5.0/kbuild-add-workaround-for-debian-make-kpkg.patch b/queue-5.0/kbuild-add-workaround-for-debian-make-kpkg.patch new file mode 100644 index 00000000000..5e7ecaf66cf --- /dev/null +++ b/queue-5.0/kbuild-add-workaround-for-debian-make-kpkg.patch @@ -0,0 +1,79 @@ +From 2b50f7ab63685cd247e32ad321f7338ed130d3d5 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Fri, 8 Mar 2019 18:13:39 +0900 +Subject: kbuild: add workaround for Debian make-kpkg + +From: Masahiro Yamada + +commit 2b50f7ab63685cd247e32ad321f7338ed130d3d5 upstream. + +Since commit 3812b8c5c5d5 ("kbuild: make -r/-R effective in top +Makefile for old Make versions"), make-kpkg is not working. + +make-kpkg directly includes the top Makefile of Linux kernel, and +appends some debian_* targets. + + /usr/share/kernel-package/ruleset/kernel_version.mk: + + # Include the kernel makefile + override dot-config := 1 + include Makefile + dot-config := 1 + +I did not know the kernel Makefile was used in that way, and it is +hard to guarantee the behavior when the kernel Makefile is included +by another Makefile from a different project. + +It looks like Debian Stretch stopped providing make-kpkg. Maybe it is +obsolete and being replaced with 'make deb-pkg' etc. but still widely +used. + +This commit adds a workaround; if the top Makefile is included by +another Makefile, skip sub-make in order to make the main part visible. +'MAKEFLAGS += -rR' does not become effective for GNU Make < 4.0, but +Debian/Ubuntu is already using newer versions. + +The effect of this commit: + + Debian 8 (Jessie) : Fixed + Debian 9 (Stretch) : make-kpkg (kernel-package) is not provided + Ubuntu 14.04 LTS : NOT Fixed + Ubuntu 16.04 LTS : Fixed + Ubuntu 18.04 LTS : Fixed + +This commit cannot fix Ubuntu 14.04 because it installs GNU Make 3.81, +but its support will end in Apr 2019, which is before the Linux v5.1 +release. + +I added warning so that nobody would try to include the top Makefile. + +Fixes: 3812b8c5c5d5 ("kbuild: make -r/-R effective in top Makefile for old Make versions") +Reported-by: Liz Zhang +Signed-off-by: Masahiro Yamada +Tested-by: Lili Deng +Cc: Manoj Srivastava +Signed-off-by: Greg Kroah-Hartman + +--- + Makefile | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/Makefile ++++ b/Makefile +@@ -31,6 +31,16 @@ _all: + # descending is started. They are now explicitly listed as the + # prepare rule. + ++# Ugly workaround for Debian make-kpkg: ++# make-kpkg directly includes the top Makefile of Linux kernel. In such a case, ++# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but ++# displays warning to discourage such abusage. ++ifneq ($(word 2, $(MAKEFILE_LIST)),) ++$(warning Do not include top Makefile of Linux Kernel) ++sub-make-done := 1 ++MAKEFLAGS += -rR ++endif ++ + ifneq ($(sub-make-done),1) + + # Do not use make's built-in rules and variables diff --git a/queue-5.0/kbuild-skip-sub-make-for-in-tree-build-with-gnu-make-4.x.patch b/queue-5.0/kbuild-skip-sub-make-for-in-tree-build-with-gnu-make-4.x.patch new file mode 100644 index 00000000000..92314d3e44b --- /dev/null +++ b/queue-5.0/kbuild-skip-sub-make-for-in-tree-build-with-gnu-make-4.x.patch @@ -0,0 +1,98 @@ +From 688931a5ad4e55ba0c215248ba510cd67bc3afb4 Mon Sep 17 00:00:00 2001 +From: Masahiro Yamada +Date: Tue, 19 Mar 2019 13:02:36 +0900 +Subject: kbuild: skip sub-make for in-tree build with GNU Make 4.x + +From: Masahiro Yamada + +commit 688931a5ad4e55ba0c215248ba510cd67bc3afb4 upstream. + +Commit 2b50f7ab6368 ("kbuild: add workaround for Debian make-kpkg") +annoyed people who want to wrap the top Makefile with GNUmakefile +to customize it for their use. + +On second thought, we do not need to run the sub-make for in-tree +build with Make 4.x because the 'MAKEFLAGS += -rR' issue only happens +on GNU Make 3.x. + +With this commit, people will get back their workflow, and the Debian +make-kpkg will still work. + +Fixes: 2b50f7ab6368 ("kbuild: add workaround for Debian make-kpkg") +Reported-by: Andreas Schwab +Reported-by: David Howells +Signed-off-by: Masahiro Yamada +Tested-by: Andreas Schwab +Tested-by: David Howells +Signed-off-by: Greg Kroah-Hartman + +--- + Makefile | 28 ++++++++++++++++------------ + 1 file changed, 16 insertions(+), 12 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -31,16 +31,6 @@ _all: + # descending is started. They are now explicitly listed as the + # prepare rule. + +-# Ugly workaround for Debian make-kpkg: +-# make-kpkg directly includes the top Makefile of Linux kernel. In such a case, +-# skip sub-make to support debian_* targets in ruleset/kernel_version.mk, but +-# displays warning to discourage such abusage. +-ifneq ($(word 2, $(MAKEFILE_LIST)),) +-$(warning Do not include top Makefile of Linux Kernel) +-sub-make-done := 1 +-MAKEFLAGS += -rR +-endif +- + ifneq ($(sub-make-done),1) + + # Do not use make's built-in rules and variables +@@ -153,6 +143,7 @@ $(if $(KBUILD_OUTPUT),, \ + # 'sub-make' below. + MAKEFLAGS += --include-dir=$(CURDIR) + ++need-sub-make := 1 + else + + # Do not print "Entering directory ..." at all for in-tree build. +@@ -160,6 +151,16 @@ MAKEFLAGS += --no-print-directory + + endif # ifneq ($(KBUILD_OUTPUT),) + ++ifneq ($(filter 3.%,$(MAKE_VERSION)),) ++# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x ++# We need to invoke sub-make to avoid implicit rules in the top Makefile. ++need-sub-make := 1 ++# Cancel implicit rules for this Makefile. ++$(lastword $(MAKEFILE_LIST)): ; ++endif ++ ++ifeq ($(need-sub-make),1) ++ + PHONY += $(MAKECMDGOALS) sub-make + + $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make +@@ -171,8 +172,11 @@ sub-make: + $(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \ + -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) + +-else # sub-make-done ++endif # need-sub-make ++endif # sub-make-done ++ + # We process the rest of the Makefile if this is the final invocation of make ++ifeq ($(need-sub-make),) + + # Do not print "Entering directory ...", + # but we want to display it when entering to the output directory +@@ -1773,7 +1777,7 @@ $(cmd_files): ; # Do not try to update i + + endif # ifeq ($(config-targets),1) + endif # ifeq ($(mixed-targets),1) +-endif # sub-make-done ++endif # need-sub-make + + PHONY += FORCE + FORCE: diff --git a/queue-5.0/series b/queue-5.0/series index 9c23201e474..15ac7f4928d 100644 --- a/queue-5.0/series +++ b/queue-5.0/series @@ -244,3 +244,5 @@ appletalk-fix-compile-regression.patch gpio-of-restrict-enable-gpio-quirk-to-regulator-gpio.patch acpi-video-extend-chassis-type-detection-with-a-lunc.patch bcache-fix-potential-div-zero-error-of-writeback_rat.patch-17972 +kbuild-add-workaround-for-debian-make-kpkg.patch +kbuild-skip-sub-make-for-in-tree-build-with-gnu-make-4.x.patch