build/roms: split up main()

it's starting to get a big big, so break it up

Signed-off-by: Leah Rowe <leah@libreboot.org>
20240612_branch
Leah Rowe 2024-05-05 05:09:23 +01:00
parent d13d930804
commit 2fcbff68fc
1 changed files with 46 additions and 35 deletions

View File

@ -62,41 +62,7 @@ main()
$err "Cannot generate list of boards for building"
for x in ${boards}; do
eval "$(setvars "n" ${pv}) $(setvars "" ${v})"
grub_background="background1280x800.png"
board="${x}"
status="unknown"
configure_target
[ "$board" = "$tree" ] && \
continue
if [ "$listboards" = "y" ]; then
[ -z "$list_type" ] && printf "%s\n" "$board"
for _list_type in $list_type; do
if [ "${_list_type#_}" = "$_list_type" ]; then
[ "$status" != "$_list_type" ] && \
continue
printf "%s\n" "$board"
else
[ "$status" = "${_list_type#_}" ] && \
continue
printf "%s\n" "$board"
break
fi
done; continue
fi
# exclude certain targets from the release
skip_board && \
printf "Skip target %s(%s)\n" "$board" "$status" && \
skipped="* $board($status)\n$skipped" && continue
build_payloads
build_target_mainboard
[ -d "bin/${board}" ] || continue
targets="* bin/${board}\n${targets}"
handle_target
done
[ "$listboards" = "y" ] && return 0
@ -115,6 +81,31 @@ main()
printf "DO NOT flash images from elf/ - please use bin/ instead.\n"
}
handle_target()
{
eval "$(setvars "n" ${pv}) $(setvars "" ${v})"
grub_background="background1280x800.png"
board="${x}"
status="unknown"
configure_target
[ "$board" = "$tree" ] && \
return 0
print_target_name && return 0
# exclude certain targets from the release
skip_board && \
printf "Skip target %s(%s)\n" "$board" "$status" && \
skipped="* $board($status)\n$skipped" && return 0
build_payloads
build_target_mainboard
[ -d "bin/${board}" ] || return 0
targets="* bin/${board}\n${targets}"
}
configure_target()
{
targetdir="${cfgsdir}/${board}"
@ -163,6 +154,26 @@ configure_target()
eval "payload_${_payload}=y"
}
print_target_name()
{
[ "$listboards" = "y" ] || return 1
[ -z "$list_type" ] && printf "%s\n" "$board"
for _list_type in $list_type; do
if [ "${_list_type#_}" = "$_list_type" ]; then
[ "$status" != "$_list_type" ] && \
continue
printf "%s\n" "$board"
break
elif [ "$status" != "${_list_type#_}" ]; then
printf "%s\n" "$board"
break
fi
done
return 0
}
skip_board()
{
if [ "$listboards" != "y" ] && [ "$status" != "stable" ]; then