payloads/tianocore: Add a proper target for the Boot Splash

edk2's default is to show a Boot Splash with their own logo which
looks like it's from the 1960's. Therefore, we replace this image
with coreboot's logo, taken from https://coreboot.org unless a
custom one is specified.

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: I1b133e2a2cfd45a6650e4523b267f7508974137b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65881
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Reviewed-by: Martin L Roth <gaumless@tutanota.com>
diff --git a/payloads/external/tianocore/Kconfig b/payloads/external/tianocore/Kconfig
index 1de7c71..9323666 100644
--- a/payloads/external/tianocore/Kconfig
+++ b/payloads/external/tianocore/Kconfig
@@ -94,17 +94,25 @@
 
 config TIANOCORE_BOOTSPLASH_FILE
 	string "Tianocore Bootsplash path and filename"
-	default "bootsplash.bmp"
+	default "Documentation/coreboot_logo.svg"
 	help
-	  Select this option if you have a bootsplash image that you would
-	  like to be used. If this option is not selected, the default
+	  The path and filename of the file to use as graphical bootsplash
+	  image. If this option is not configured, the default
 	  coreboot logo (European Brown Hare) will used.
 
-	  The path and filename of the file to use as graphical bootsplash
-	  image. The file must be an uncompressed BMP, in BMP 3 format.
+	  You can use any image format supported by imagemagick, a list of which
+	  can be found [here](https://imagemagick.org/script/formats.php).
 
-	  Linux can create these with the below command:
-	      `convert splosh.bmp BMP3:splash.bmp`
+	  The build process will automatically convert this to the format that
+	  EDK2 requires, which is an uncompressed BMP, in BMP3 format. It does
+	  this using imagemagick (`convert splosh.bmp BMP3:splash.bmp`).
+
+	  The newly formatted file will be the dimensions size as the original
+	  one.
+
+	  The build process will automatically do this conversion, so it can
+	  be supplied with any format that imagemagick can process (which is
+	  pretty much any!).
 
 	  This image will also be used as the BGRT boot image, which may
 	  persist through your OS boot process.
diff --git a/payloads/external/tianocore/Makefile b/payloads/external/tianocore/Makefile
index 49e49dd..ad7887b 100644
--- a/payloads/external/tianocore/Makefile
+++ b/payloads/external/tianocore/Makefile
@@ -136,18 +136,36 @@
 		fi; \
 		git submodule update --init --checkout
 
+logo: $(project_dir)/edk2
+	case "$(CONFIG_TIANOCORE_BOOTSPLASH_FILE)" in \
+		/*) convert -background None $(CONFIG_TIANOCORE_BOOTSPLASH_FILE) \
+			BMP3:$(project_dir)/MdeModulePkg/Logo/Logo.bmp;; \
+		*) convert -background None $(top)/$(CONFIG_TIANOCORE_BOOTSPLASH_FILE) \
+			BMP3:$(project_dir)/MdeModulePkg/Logo/Logo.bmp;; \
+	esac \
+
 checktools:
-	echo "Checking uuid-dev..."
+	echo -n "EDK2: Checking uuid-dev:"
 	echo "#include <uuid/uuid.h>" > libtest.c
 	echo "int main(int argc, char **argv) { (void) argc; (void) argv; return 0; }" >> libtest.c
-	$(HOSTCC) $(HOSTCCFLAGS) libtest.c -o libtest >/dev/null 2>&1 && echo " found uuid-dev." || \
-		( echo " Not found."; echo "ERROR: please_install uuid-dev (libuuid-devel)"; exit 1 )
+	$(HOSTCC) $(HOSTCCFLAGS) libtest.c -o libtest >/dev/null 2>&1 && echo "    Found!" || \
+		( echo "    Not found!"; \
+			echo "ERROR: please_install uuid-dev (libuuid-devel)"; exit 1 )
 	rm -rf libtest.c libtest
-	echo "Checking nasm..."
-	type nasm > /dev/null 2>&1 && echo " found nasm." || \
-		( echo " Not found."; echo "Error: Please install nasm."; exit 1 )
+	echo -n "EDK2: Checking nasm:"
+	type nasm > /dev/null 2>&1 && echo "        Found!" || \
+		( echo "        Not found!"; echo "ERROR: Please install nasm."; exit 1 )
+	echo -n "EDK2: Checking imagemagick:"
+	-convert -size 1x1 xc: test.png &> /dev/null;
+	if [ -f test.png ]; then \
+		rm test.png && echo " Found!"; \
+	else \
+		echo " Not found!"; \
+		echo "ERROR: Please install imagemagick"; \
+		exit 1; \
+	fi
 
-build: update checktools
+build: update logo checktools
 	echo "   ##### $(project_name) Build Summary #####"
 	echo "   Repository:     $(CONFIG_TIANOCORE_REPOSITORY)"
 	echo "   Branch:         $(CONFIG_TIANOCORE_TAG_OR_REV)"
@@ -160,15 +178,6 @@
 		-e 's/q /Build:          Quiet/' \
 		-e 's/t /Toolchain:      /'
 	unset CC; $(MAKE) -C $(project_dir)/BaseTools 2>&1
-	if [ -n "$(CONFIG_TIANOCORE_BOOTSPLASH_FILE)" ]; then \
-		echo "    Copying custom bootsplash image"; \
-		case "$(CONFIG_TIANOCORE_BOOTSPLASH_FILE)" in \
-			/*) convert $(CONFIG_TIANOCORE_BOOTSPLASH_FILE) \
-				BMP3:$(project_dir)/MdeModulePkg/Logo/Logo.bmp;; \
-			*) convert $(top)/$(CONFIG_TIANOCORE_BOOTSPLASH_FILE) \
-				BMP3:$(project_dir)/MdeModulePkg/Logo/Logo.bmp;; \
-		esac \
-	fi; \
 	cd $(project_dir); \
 		export EDK_TOOLS_PATH=$(project_dir)/BaseTools; \
 		export WORKSPACE=$(project_dir); \
@@ -188,4 +197,4 @@
 distclean:
 	rm -rf */
 
-.PHONY: all update checktools config build clean distclean
+.PHONY: all update checktools config build clean distclean logo