roms: merge serprog build into one function

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit6
Leah Rowe 2024-06-18 01:20:40 +01:00
parent f7e28964ac
commit 1881d34dbc
1 changed files with 17 additions and 18 deletions

View File

@ -64,34 +64,33 @@ mkserprog()
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
[ "$2" = "list" ] && serlist "$serprog_boards_dir" && return 0 [ "$2" = "list" ] && serlist "$serprog_boards_dir" && return 0
[ "$2" = "list" ] || build_${1}_rom "$2" [ "$2" = "list" ] || mkserprogfw "$1" "$2"
else else
serlist "$serprog_boards_dir" | \ serlist "$serprog_boards_dir" | \
while read -r board; do while read -r board; do
build_${1}_rom "$board" mkserprogfw "$1" "$board"
done done
fi fi
[ "$xbmk_release" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0 [ "$xbmk_release" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0
} }
build_rp2040_rom() mkserprogfw()
{ {
x_ cmake -DPICO_BOARD="$1" -DPICO_SDK_PATH="$picosdk" \ if [ "$1" = "rp2040" ]; then
x_ cmake -DPICO_BOARD="$2" -DPICO_SDK_PATH="$picosdk" \
-B "$picosrc/build" "$picosrc" -B "$picosrc/build" "$picosrc"
x_ cmake --build "$picosrc/build" x_ cmake --build "$picosrc/build"
x_ mv "$picosrc/build/pico_serprog.uf2" \ x_ mv "$picosrc/build/pico_serprog.uf2" \
"bin/serprog_rp2040/serprog_$1.uf2" "bin/serprog_rp2040/serprog_$2.uf2"
printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "$1" printf "output to bin/serprog_rp2040/serprog_%s.uf2\n" "$2"
} else
x_ make -C "$stm32src" libopencm3-just-make BOARD=$2
build_stm32_rom() x_ make -C "$stm32src" BOARD=$2
{
x_ make -C "$stm32src" libopencm3-just-make BOARD=$1
x_ make -C "$stm32src" BOARD=$1
x_ mv "$stm32src/stm32-vserprog.hex" \ x_ mv "$stm32src/stm32-vserprog.hex" \
"bin/serprog_stm32/serprog_$1.hex" "bin/serprog_stm32/serprog_$2.hex"
printf "output to bin/serprog_stm32/serprog_%s.hex\n" "$1" printf "output to bin/serprog_stm32/serprog_%s.hex\n" "$2"
fi
} }
serlist() serlist()