diff options
author | Leah Rowe <leah@libreboot.org> | 2024-05-05 05:09:23 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2024-05-05 05:16:51 +0100 |
commit | 2fcbff68fc79112a06a76933c1d5fdb167c259b3 (patch) | |
tree | 9186e1edc9f017de08c58ca6c708d58c6502209a | |
parent | d13d930804a8854b3b170a06f891ecb0e3cc136d (diff) |
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>
-rwxr-xr-x | script/build/roms | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/script/build/roms b/script/build/roms index 0e292243..3d5a3f5c 100755 --- a/script/build/roms +++ b/script/build/roms @@ -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 |