From 71f0333480f1640de62a83ef577ec50dfa9fa24f Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Tue, 18 Jun 2019 19:44:35 +0100 Subject: [PATCH] kernel: generic: fix MIPS build on non-linux hosts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit calc_vmlinuz_load_addr.c requires SZ_64K to be defined for alignment purposes. It included "../../../../include/linux/sizes.h" to define that size, however "sizes.h" tries to include which assumes linux system headers. These may not exist eg. the following error was encountered when building Linux for OpenWrt under macOS: In file included from arch/mips/boot/compressed/calc_vmlinuz_load_addr.c:16: arch/mips/boot/compressed/../../../../include/linux/sizes.h:11:10: fatal error: 'linux/const.h' file not found Change makefile to force building on local linux headers instead of system headers. Also change eye-watering relative reference in include file spec. Thanks to Jo-Philip Wich & Petr Å tetiar for assistance in tracking this down & fixing. Signed-off-by: Kevin Darbyshire-Bryant --- ...00-MIPS-fix-build-on-non-linux-hosts.patch | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 target/linux/generic/pending-4.19/100-MIPS-fix-build-on-non-linux-hosts.patch diff --git a/target/linux/generic/pending-4.19/100-MIPS-fix-build-on-non-linux-hosts.patch b/target/linux/generic/pending-4.19/100-MIPS-fix-build-on-non-linux-hosts.patch new file mode 100644 index 000000000000..7204a7176c28 --- /dev/null +++ b/target/linux/generic/pending-4.19/100-MIPS-fix-build-on-non-linux-hosts.patch @@ -0,0 +1,62 @@ +From 4ee213d8c2afeab9a68f8530317260298b4b6b82 Mon Sep 17 00:00:00 2001 +From: Kevin Darbyshire-Bryant +Date: Wed, 19 Jun 2019 08:16:33 +0100 +Subject: [PATCH] MIPS: fix build on non-linux hosts +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +calc_vmlinuz_load_addr.c requires SZ_64K to be defined for alignment +purposes. It included "../../../../include/linux/sizes.h" to define +that size, however "sizes.h" tries to include which +assumes linux system headers. These may not exist eg. the following +error was encountered when building Linux for OpenWrt under macOS: + +In file included from arch/mips/boot/compressed/calc_vmlinuz_load_addr.c:16: +arch/mips/boot/compressed/../../../../include/linux/sizes.h:11:10: fatal error: 'linux/const.h' file not found + ^~~~~~~~~~ + +Change makefile to force building on local linux headers instead of +system headers. Also change eye-watering relative reference in include +file spec. + +Thanks to Jo-Philip Wich & Petr Å tetiar for assistance in tracking this +down & fixing. + +Suggested-by: Jo-Philipp Wich +Signed-off-by: Petr Å tetiar +Signed-off-by: Kevin Darbyshire-Bryant +--- + arch/mips/boot/compressed/Makefile | 2 ++ + arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile +index 3c453a1f1ff1..172801ed35b8 100644 +--- a/arch/mips/boot/compressed/Makefile ++++ b/arch/mips/boot/compressed/Makefile +@@ -78,6 +78,8 @@ OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \ + $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE + $(call if_changed,objcopy) + ++HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUXINCLUDE) ++ + # Calculate the load address of the compressed kernel image + hostprogs-y := calc_vmlinuz_load_addr + +diff --git a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c +index 240f1d12df75..080b926d2623 100644 +--- a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c ++++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c +@@ -9,7 +9,7 @@ + #include + #include + #include +-#include "../../../../include/linux/sizes.h" ++#include + + int main(int argc, char *argv[]) + { +-- +2.20.1 (Apple Git-117) + -- 2.30.2