From 5494ffb3d10b66de8723d1c841a25e404d4885bd Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Fri, 6 Oct 2023 03:03:31 +0100
Subject: build/firmware/coreboot: confirm compiled roms

return with error status if no images were compiled

if a rom image fails to compile, then it will also
exit with error status, but sometimes you can pass
argument "cros" or "default", and it would not give
you rom images due to no target.cfg files, but these
are also ignored because of that.

this restores the same behaviour that existed before,
for this final error check.

Signed-off-by: Leah Rowe <leah@libreboot.org>
---
 script/build/firmware/coreboot | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'script/build/firmware/coreboot')

diff --git a/script/build/firmware/coreboot b/script/build/firmware/coreboot
index bfc059a5..15430255 100755
--- a/script/build/firmware/coreboot
+++ b/script/build/firmware/coreboot
@@ -28,7 +28,7 @@ v="romdir cbdir cbfstool cbrom initmode displaymode cbcfg targetdir tree arch"
 v="${v} grub_timeout ubdir blobs_required board grub_scan_disk uboot_config"
 eval "$(setvars "n" ${pv})"
 eval "$(setvars "" ${v})"
-eval "$(setvars "" boards _displaymode _payload _keyboard all)"
+eval "$(setvars "" boards _displaymode _payload _keyboard all targets)"
 
 main()
 {
@@ -56,8 +56,13 @@ main()
 		eval "$(setvars "" ${v})"
 		board="${x}"
 		check_target
-		prepare_target	
+		prepare_target
+		[ -f "bin/${x}" ] || continue
+		targets="bin/${x}\n${targets}"
 	done
+
+	[ -z ${targets} ] && err "No ROM images were compiled"
+	printf "ROM images available in these directories:\n${targets%, }\n"
 }
 
 check_target()
-- 
cgit v1.2.1