[coreboot-gerrit] Change in coreboot[master]: payloads/external/GRUB2: Sanitize Makefile

Nico Huber (Code Review) gerrit at coreboot.org
Mon Aug 14 02:08:35 CEST 2017


Nico Huber has uploaded this change for review. ( https://review.coreboot.org/20990


Change subject: payloads/external/GRUB2: Sanitize Makefile
......................................................................

payloads/external/GRUB2: Sanitize Makefile

We were explicitly passing CC and TARGET_CC to configure but overwrote
that decision later by passing CC (with the value of TARGET_CC) directly
to a recursive make call. The latter overwrite was introduced because
`unexport` alone doesn't work on variables that were specified on a make
command line (they are added to MAKEOVERRIDES and passed to further re-
cursive make calls).

Instead of unexporting random variables, unexport those that were actu-
ally passed from payloads/external/Makefile.inc and clear MAKEOVERRIDES.
Do not pass OBJDUMP as that is nowhere to be found in the GRUB sources.
And, last but not least, add --disable-werror because building GRUB is
very susceptible to changes in the flex version.

Change-Id: Iaff2c72e89a5a540fe365eacb84811d5cff9d4d4
Signed-off-by: Nico Huber <nico.h at gmx.de>
---
M payloads/external/GRUB2/Makefile
M payloads/external/Makefile.inc
2 files changed, 9 insertions(+), 22 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/20990/1

diff --git a/payloads/external/GRUB2/Makefile b/payloads/external/GRUB2/Makefile
index 7cac6a3..dee7f69 100644
--- a/payloads/external/GRUB2/Makefile
+++ b/payloads/external/GRUB2/Makefile
@@ -6,21 +6,8 @@
 project_git_repo=git://git.sv.gnu.org/grub.git
 project_dir=grub2
 
-unexport KCONFIG_AUTOCONFIG
-unexport CFLAGS
-unexport CPPFLAGS
-unexport CCASFLAGS
-unexport CC
-unexport BUILD_CC
-unexport TARGET_CC
-unexport TARGET_CFLAGS
-unexport TARGET_CPPFLAGS
-unexport TARGET_STRIP
-unexport TARGET_OBJCOPY
-unexport HOST_CFLAGS
-unexport HOST_CPPFLAGS
-unexport HOST_CC
-
+unexport HOSTCC CC LD OBJCOPY STRIP
+MAKEOVERRIDES :=
 
 all: grub2
 
@@ -40,19 +27,19 @@
 	rm -rf grub2/build
 	mkdir grub2/build
 	cd grub2 && ./autogen.sh
-	cd grub2/build && ../configure BUILD_CC="$(HOSTCC)" CC="$(HOSTCC)" \
-	TARGET_CC="$(CC)" \
-	TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" CFLAGS=-O2 TARGET_CFLAGS=-Os --with-platform=coreboot \
-	--enable-boot-time
+	cd grub2/build && ../configure CC="$(HOSTCC)" LD="$(LD)" \
+	TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" \
+	CFLAGS=-O2 TARGET_CFLAGS=-Os \
+	--with-platform=coreboot --enable-boot-time --disable-werror
 
 grub2: config
 	echo "    MAKE       GRUB2 $(NAME-y)"
-	$(MAKE) -C grub2/build CC="$(HOSTCC)"
+	$(MAKE) -C grub2/build
 	$(MAKE) -C grub2/build default_payload.elf \
 		EXTRA_PAYLOAD_MODULES="$(CONFIG_GRUB2_EXTRA_MODULES)"
 
 clean:
-	test -d grub2 && $(MAKE) -C grub2 clean || exit 0
+	test -f grub2/build/Makefile && $(MAKE) -C grub2/build clean || exit 0
 
 distclean:
 	rm -rf grub2
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc
index 344fe9f..fb50604 100644
--- a/payloads/external/Makefile.inc
+++ b/payloads/external/Makefile.inc
@@ -155,7 +155,7 @@
 grub2:
 	$(MAKE) -C payloads/external/GRUB2 \
 			HOSTCC="$(HOSTCC)" \
-			CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \
+			CC="$(CC_x86_32)" LD="$(LD_x86_32)" \
 			OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
 			CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER) \
 			CONFIG_GRUB2_REVISION=$(CONFIG_GRUB2_REVISION) \

-- 
To view, visit https://review.coreboot.org/20990
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaff2c72e89a5a540fe365eacb84811d5cff9d4d4
Gerrit-Change-Number: 20990
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h at gmx.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170814/a5394e03/attachment.html>


More information about the coreboot-gerrit mailing list