build/boot/roms: simplify buildrom() handling

Only one for loop is required.

Signed-off-by: Leah Rowe <leah@libreboot.org>
btrfsvols
Leah Rowe 2023-09-30 12:57:53 +01:00
parent df7305a5d9
commit 895073d765
1 changed files with 13 additions and 16 deletions

View File

@ -14,16 +14,16 @@ set -u -e
read projectname < projectname read projectname < projectname
opts="" opts=""
boards= boards=
firstoption="" first=""
targets="" targets=""
main() main()
{ {
[ $# -lt 1 ] && usage && err "target not specified" [ $# -lt 1 ] && usage && err "target not specified"
firstoption="${1}" first="${1}"
[ "${firstoption}" = "help" ] && usage && exit 0 [ "${first}" = "help" ] && usage && exit 0
[ "${firstoption}" = "list" ] && \ [ "${first}" = "list" ] && \
listitems config/coreboot && exit 0 listitems config/coreboot && exit 0
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
@ -38,7 +38,7 @@ main()
opts="${opts} -k ${2}" opts="${opts} -k ${2}"
shift ;; shift ;;
all) all)
firstoption="all" ;; first="all" ;;
*) *)
boards="${boards} ${1} " ;; boards="${boards} ${1} " ;;
esac esac
@ -48,17 +48,14 @@ main()
[ -z ${opts+x} ] && opts="" [ -z ${opts+x} ] && opts=""
printf "Building %s ROM images\n" "${projectname}" printf "Building %s ROM images\n" "${projectname}"
if [ "${firstoption}" = "all" ]; then [ "${first}" != "all" ] || boards="$(listitems config/coreboot)" || \
for target in $(listitems config/coreboot); do err "Cannot get list of boards"
buildrom "${target}" || err "build/roms (1): error"
[ -d "bin/${target}" ] && targets="${target} ${targets}"
done
else
for board in ${boards}; do for board in ${boards}; do
buildrom "${board}" || err "build/roms (2): error" buildrom "${board}" || err "build/roms: error"
[ -d "bin/${board}" ] && targets="${board} ${targets}" [ -d "bin/${board}" ] && targets="${board} ${targets}"
done done
fi
[ -z "${targets}" ] && err "No ROM images were compiled." [ -z "${targets}" ] && err "No ROM images were compiled."
printf "\n\nYour ROM images are available in these directories:\n" printf "\n\nYour ROM images are available in these directories:\n"
for x in ${targets}; do for x in ${targets}; do