File s390-tools-sles15sp2-05-zipl-Fix-dependency-generation-in-zipl-boot.patch of Package s390-tools.18705

Subject: [PATCH] [FEAT VS1804] zipl: Fix dependency generation in zipl/boot
From: Marc Hartmayer <mhartmay@linux.ibm.com>

Summary:     genprotimg: Introduce new tool for the creation of PV images
Description: genprotimg takes a kernel, host-key documents, optionally an
             initrd, optionally a file with the kernel command line, and it
             generates a single, loadable image file. The image consists of a
             concatenation of a plain text boot loader, the encrypted
             components for kernel, initrd, and cmdline, and the
             integrity-protected PV header, containing metadata necessary for
             running the guest in PV mode. It's possible to use this image file
             as a kernel for zIPL or for a direct kernel boot using QEMU.
Upstream-ID: 121d5d80137f270e4828f457f717e9ab365f303b
Problem-ID:  VS1804

Upstream-Description:

             zipl: Fix dependency generation in zipl/boot

             When adding new header from zipl/include to a .c file within zipl/boot
             a compiler error appears

             	stage3.c:16:10: fatal error: zipl.h: No such file or directory
             	 #include "zipl.h"
             	          ^~~~~~~~
             	compilation terminated.
             	  CC      zipl/boot/stage3.o

             This is because the rule to generate dependencies (*.o.d) does not use
             the CFLAGS_BOOT. Thus it cannot find the header and fails. Note this
             only applies to the dependency generation, the actual build succeeds.

             To fix this rename the CFLAGS_BOOT to ALL_CFLAGS. Using ALL_CFLAGS
             instead of e.g. ALL_CPPFLAGS is important to also overwrite flags given
             on the commandline via OPT_FLAGS, e.g.

             	make V=1 OPT_FLAGS="-D__FOO__"

             While at it also remove the unused and wrong '-D__ASSEMBLY__'.

             Fixes: 5a6605fe ("zipl: Ensure that boot loader CFLAGS are not overwritten")
             Fixes: aa913b1e ("build process: Add automatic dependency generation")
             Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
             Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
             Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>


Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 zipl/boot/Makefile |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/zipl/boot/Makefile
+++ b/zipl/boot/Makefile
@@ -1,7 +1,7 @@
 # Common definitions
 include ../../common.mak
 
-CFLAGS_BOOT = $(NO_PIE_CFLAGS) -Os -g -I../include -D__ASSEMBLY__ \
+ALL_CFLAGS = $(NO_PIE_CFLAGS) -Os -g -I $(rootdir)/zipl/include \
 	  -DS390_TOOLS_RELEASE=$(S390_TOOLS_RELEASE) \
 	  -fno-builtin -ffreestanding -fno-asynchronous-unwind-tables \
 	  -fno-delete-null-pointer-checks \
@@ -21,10 +21,10 @@ all: data.o data.h tape0.bin stage3.bin
 %:	%.S
 
 %.o:	%.S
-	$(CC) $(CFLAGS_BOOT) -c -o $@ $<
+	$(CC) $(ALL_CFLAGS) -c -o $@ $<
 
 %.o:	%.c
-	$(CC) $(CFLAGS_BOOT) -c -o $@ $<
+	$(CC) $(ALL_CFLAGS) -c -o $@ $<
 
 eckd2dump_sv.exec: \
 	head.o stage2dump.o cio.o eckd2dump.o eckd2dump_sv.o \
openSUSE Build Service is sponsored by