build/seabios: simplify. stricter error handling

fsdg20230625
Leah Rowe 2023-05-14 21:20:20 +01:00
parent b74e407806
commit ddad8f00c6
1 changed files with 26 additions and 40 deletions

View File

@ -22,53 +22,39 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v [ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e set -u -e
# Build SeaBIOS
# ---------------------------------------------------------------------
printf "Building SeaBIOS payloads and SeaVGABIOS\n" printf "Building SeaBIOS payloads and SeaVGABIOS\n"
[ ! -d "payload/" ] && mkdir -p payload/ if [ ! -d "payload/seabios" ]; then
[ ! -d "payload/seabios" ] && mkdir -p payload/seabios/ mkdir -p payload/seabios/ || exit 1
rm -f payload/seabios/*
if [ ! -d "seabios/" ]; then
./download seabios
fi fi
cd seabios/ rm -f payload/seabios/* || exit 1
# for libgfxinit setup: if [ ! -d "seabios/" ]; then
[ -f Makefile ] && make distclean ./download seabios || exit 1
cp ../resources/seabios/config/libgfxinit .config fi
make silentoldconfig -j$(nproc)
make -j$(nproc)
mv out/bios.bin.elf ../payload/seabios/seabios_libgfxinit.elf
mv out/vgabios.bin ../payload/seabios/seavgabios.bin
rm .config
# for vgarom setup: for x in normal vgarom libgfxinit; do
[ -f Makefile ] && make distclean if [ ! -f seabios/Makefile ]; then
cp ../resources/seabios/config/vgarom .config printf "SeaBIOS not properly downloaded.\n"
make silentoldconfig -j$(nproc) exit 1
make -j$(nproc) fi
mv out/bios.bin.elf ../payload/seabios/seabios_vgarom.elf make distclean -BC seabios || exit 1
rm .config cp "resources/seabios/config/${x}" seabios/.config
make silentoldconfig -j$(nproc) -BC seabios || exit 1
# for normal setup: make -j$(nproc) -BC seabios || exit 1
[ -f Makefile ] && make distclean cp seabios/out/bios.bin.elf "payload/seabios/seabios_${x}.elf" \
cp ../resources/seabios/config/normal .config || exit 1
make silentoldconfig -j$(nproc) if [ "${x}" = "libgfxinit" ]; then
make -j$(nproc) cp seabios/out/vgabios.bin payload/seabios/seavgabios.bin \
mv out/bios.bin.elf ../payload/seabios/seabios_normal.elf || exit 1
rm .config fi
rm -f seabios/.config || exit 1
done
# clean it again. gotta keep it clean! # clean it again. gotta keep it clean!
[ -f Makefile ] && make distclean if [ -f seabios/Makefile ]; then
make distclean -BC seabios || exit 1
fi
printf "Done! SeaBIOS files are in payload/seabios/\n\n" printf "Done! SeaBIOS files are in payload/seabios/\n\n"
# done. go back to main directory
cd ../
# ------------------- DONE ----------------------