payloads/edk2: Add an option for verbose builds

Add EDK2_VERBOSE_BUILD which removes the `-q` and `-s` switches
so the build log becomes verbose.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: Iaf1e96657f43edddfa4de0d3e00f3b24e7eb855b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/67677
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc
index 3ca3fc9..70096f5 100644
--- a/payloads/external/Makefile.inc
+++ b/payloads/external/Makefile.inc
@@ -167,6 +167,7 @@
 		CONFIG_EDK2_CUSTOM_BUILD_PARAMS=$(CONFIG_EDK2_CUSTOM_BUILD_PARAMS) \
 		CONFIG_EDK2_DEBUG=$(CONFIG_EDK2_DEBUG) \
 		CONFIG_EDK2_RELEASE=$(CONFIG_EDK2_RELEASE) \
+		CONFIG_EDK2_VERBOSE_BUILD=$(CONFIG_EDK2_VERBOSE_BUILD) \
 		CONFIG_EDK2_ABOVE_4G_MEMORY=$(CONFIG_EDK2_ABOVE_4G_MEMORY) \
 		CONFIG_EDK2_BOOTSPLASH_FILE=$(CONFIG_EDK2_BOOTSPLASH_FILE) \
 		CONFIG_EDK2_BOOT_MANAGER_ESCAPE=$(CONFIG_EDK2_BOOT_MANAGER_ESCAPE) \
diff --git a/payloads/external/edk2/Kconfig b/payloads/external/edk2/Kconfig
index d2a589b..f753ad9 100644
--- a/payloads/external/edk2/Kconfig
+++ b/payloads/external/edk2/Kconfig
@@ -78,6 +78,13 @@
 
 endchoice
 
+config EDK2_VERBOSE_BUILD
+	bool "Output verbose build log for troubleshooting build failures"
+	help
+	  Switch off the `-q` (quiet) and `-s` (silent) build arguments which makes the
+	  build log extremely verbose. This can be used to troubleshoot failed builds
+	  which are usually down to missing tools or toolchain.
+
 config EDK2_ABOVE_4G_MEMORY
 	bool "Enable above 4G memory"
 	default n
diff --git a/payloads/external/edk2/Makefile b/payloads/external/edk2/Makefile
index 045ef09..4a854c9 100644
--- a/payloads/external/edk2/Makefile
+++ b/payloads/external/edk2/Makefile
@@ -11,7 +11,9 @@
 BUILD_STR = -p UefiPayloadPkg/UefiPayloadPkg.dsc
 BUILD_STR += -t COREBOOT
 BUILD_STR += -D BOOTLOADER=COREBOOT
+ifneq ($(CONFIG_EDK2_VERBOSE_BUILD),y)
 BUILD_STR += -q -s
+endif
 
 #
 # EDK II has the following build options relevant to coreboot: