build/boot/roms: split up main()

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

View File

@ -45,22 +45,23 @@ main()
shift shift
done done
handle_targets
display_targets
}
handle_targets()
{
[ -z ${opts+x} ] && opts="" [ -z ${opts+x} ] && opts=""
printf "Building %s ROM images\n" "${projectname}" printf "Building %s ROM images\n" "${projectname}"
[ "${first}" != "all" ] || boards="$(listitems config/coreboot)" || \ [ "${first}" != "all" ] || boards="$(listitems config/coreboot)" || \
err "Cannot get list of boards" err "handle_targets: Cannot get list of boards"
for board in ${boards}; do for board in ${boards}; do
buildrom "${board}" || err "build/roms: error" buildrom "${board}" || err "handle_targets: build error"
[ -d "bin/${board}" ] && targets="${board} ${targets}" [ -d "bin/${board}" ] && targets="${board} ${targets}"
done done
confirm_targets
[ -z "${targets}" ] && err "No ROM images were compiled."
printf "\n\nYour ROM images are available in these directories:\n"
for x in ${targets}; do
printf "* bin/%s\n" "${x}"
done
} }
# Build ROM images for supported boards # Build ROM images for supported boards
@ -70,6 +71,15 @@ buildrom() {
./build boot roms_helper ${1}${opts} || return 1 ./build boot roms_helper ${1}${opts} || return 1
} }
confirm_targets()
{
[ -z "${targets}" ] && err "No ROM images were compiled."
printf "\n\nYour ROM images are available in these directories:\n"
for x in ${targets}; do
printf "* bin/%s\n" "${x}"
done
}
usage() usage()
{ {
cat <<- EOF cat <<- EOF