From 895073d765d05c7292e2fc047cc4e3d893ed7165 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 30 Sep 2023 12:57:53 +0100 Subject: build/boot/roms: simplify buildrom() handling Only one for loop is required. Signed-off-by: Leah Rowe --- script/build/boot/roms | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'script/build') diff --git a/script/build/boot/roms b/script/build/boot/roms index 7ea64f66..e31c68e6 100755 --- a/script/build/boot/roms +++ b/script/build/boot/roms @@ -14,16 +14,16 @@ set -u -e read projectname < projectname opts="" boards= -firstoption="" +first="" targets="" main() { [ $# -lt 1 ] && usage && err "target not specified" - firstoption="${1}" - [ "${firstoption}" = "help" ] && usage && exit 0 - [ "${firstoption}" = "list" ] && \ + first="${1}" + [ "${first}" = "help" ] && usage && exit 0 + [ "${first}" = "list" ] && \ listitems config/coreboot && exit 0 while [ $# -gt 0 ]; do @@ -38,7 +38,7 @@ main() opts="${opts} -k ${2}" shift ;; all) - firstoption="all" ;; + first="all" ;; *) boards="${boards} ${1} " ;; esac @@ -48,17 +48,14 @@ main() [ -z ${opts+x} ] && opts="" printf "Building %s ROM images\n" "${projectname}" - if [ "${firstoption}" = "all" ]; then - for target in $(listitems config/coreboot); do - buildrom "${target}" || err "build/roms (1): error" - [ -d "bin/${target}" ] && targets="${target} ${targets}" - done - else - for board in ${boards}; do - buildrom "${board}" || err "build/roms (2): error" - [ -d "bin/${board}" ] && targets="${board} ${targets}" - done - fi + [ "${first}" != "all" ] || boards="$(listitems config/coreboot)" || \ + err "Cannot get list of boards" + + for board in ${boards}; do + buildrom "${board}" || err "build/roms: error" + [ -d "bin/${board}" ] && targets="${board} ${targets}" + done + [ -z "${targets}" ] && err "No ROM images were compiled." printf "\n\nYour ROM images are available in these directories:\n" for x in ${targets}; do -- cgit v1.2.1