From ed94cf9839bb3b15825879ffc9816e76ee75a88d Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Wed, 5 Jul 2023 12:29:05 +0000 Subject: [PATCH] genprotimg/boot: compile the bootloaders only if HOST_ARCH is s390x The genprotimg bootloaders are s390x specific, so only build them if the `HOST_ARCH' is set to s390x. On x86 one can cross-compile and install the bootloaders as follows: $ make -C genprotimg/boot HOST_ARCH=s390x CROSS_COMPILE=s390x-linux-gnu- $ make -C genprotimg/boot install HOST_ARCH=s390x CROSS_COMPILE=s390x-linux-gnu- Reviewed-by: Steffen Eiden Signed-off-by: Marc Hartmayer Signed-off-by: Steffen Eiden --- genprotimg/boot/Makefile | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/genprotimg/boot/Makefile b/genprotimg/boot/Makefile index cb5706b1..2d44d279 100644 --- a/genprotimg/boot/Makefile +++ b/genprotimg/boot/Makefile @@ -1,6 +1,9 @@ # Common definitions include ../../common.mak +FILES := stage3a.bin stage3b.bin stage3b_reloc.bin + +ifeq ($(HOST_ARCH),s390x) ZIPL_DIR := $(rootdir)/zipl ZIPL_BOOT_DIR := $(ZIPL_DIR)/boot PKGDATADIR := $(DESTDIR)$(TOOLS_DATADIR)/genprotimg @@ -19,8 +22,6 @@ ALL_CFLAGS := $(NO_PIE_CFLAGS) -Os -g \ -Wall -Wformat-security -Wextra \ -Wno-array-bounds -FILES := stage3a.bin stage3b.bin stage3b_reloc.bin - ZIPL_SRCS_C := libc.c ebcdic.c ebcdic_conv.c sclp.c ZIPL_SRCS_ASM := entry.S @@ -28,9 +29,6 @@ ZIPL_OBJS_C := $(ZIPL_SRCS_C:%.c=%.o) ZIPL_OBJS_ASM := $(ZIPL_SRCS_ASM:%.S=%.o) ZIPL_OBJS := $(ZIPL_OBJS_C) $(ZIPL_OBJS_ASM) - -all: $(FILES) - # Prevent make from using some default rules... %: %.S @@ -86,6 +84,21 @@ install: stage3a.bin stage3b_reloc.bin $(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 stage3a.bin "$(PKGDATADIR)" $(INSTALL) -g $(GROUP) -o $(OWNER) -m 644 stage3b_reloc.bin "$(PKGDATADIR)" +else +# Don't generate the dependency files (see `common.mak` for the +# `-include $(dependencies_c)` statement). +.PHONY: $(dependencies_c) + +$(FILES): + echo " SKIP $@ due to HOST_ARCH != s390x" + +install: + echo " SKIP Bootloader installation due to HOST_ARCH != s390x" +endif + +.DEFAULT_GOAL := all +all: $(FILES) + clean: rm -f *.o *.elf *.bin *.map .*.d *.lds