1 From 4ee213d8c2afeab9a68f8530317260298b4b6b82 Mon Sep 17 00:00:00 2001
2 From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
3 Date: Wed, 19 Jun 2019 08:16:33 +0100
4 Subject: [PATCH] MIPS: fix build on non-linux hosts
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 calc_vmlinuz_load_addr.c requires SZ_64K to be defined for alignment
10 purposes. It included "../../../../include/linux/sizes.h" to define
11 that size, however "sizes.h" tries to include <linux/const.h> which
12 assumes linux system headers. These may not exist eg. the following
13 error was encountered when building Linux for OpenWrt under macOS:
15 In file included from arch/mips/boot/compressed/calc_vmlinuz_load_addr.c:16:
16 arch/mips/boot/compressed/../../../../include/linux/sizes.h:11:10: fatal error: 'linux/const.h' file not found
19 Change makefile to force building on local linux headers instead of
20 system headers. Also change eye-watering relative reference in include
23 Thanks to Jo-Philip Wich & Petr Štetiar for assistance in tracking this
26 Suggested-by: Jo-Philipp Wich <jo@mein.io>
27 Signed-off-by: Petr Štetiar <ynezz@true.cz>
28 Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
30 arch/mips/boot/compressed/Makefile | 2 ++
31 arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | 2 +-
32 2 files changed, 3 insertions(+), 1 deletion(-)
34 diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
35 index 3c453a1f1ff1..172801ed35b8 100644
36 --- a/arch/mips/boot/compressed/Makefile
37 +++ b/arch/mips/boot/compressed/Makefile
38 @@ -78,6 +78,8 @@ OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \
39 $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
40 $(call if_changed,objcopy)
42 +HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUXINCLUDE)
44 # Calculate the load address of the compressed kernel image
45 hostprogs-y := calc_vmlinuz_load_addr
47 diff --git a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
48 index 240f1d12df75..080b926d2623 100644
49 --- a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
50 +++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
55 -#include "../../../../include/linux/sizes.h"
56 +#include <linux/sizes.h>
58 int main(int argc, char *argv[])
61 2.20.1 (Apple Git-117)