mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-22 05:00:08 +02:00
build/boot/roms: top-down function order
This commit is contained in:
@@ -31,65 +31,14 @@ set -u -e
|
|||||||
|
|
||||||
projectname="$(cat projectname)"
|
projectname="$(cat projectname)"
|
||||||
opts=""
|
opts=""
|
||||||
|
|
||||||
listboards() {
|
|
||||||
for boarddir in resources/coreboot/*; do
|
|
||||||
if [ ! -d "${boarddir}" ]; then continue; fi
|
|
||||||
board="${boarddir##resources/coreboot/}"
|
|
||||||
board="${board%/}"
|
|
||||||
printf '%s\n' "${board##*/}"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
help() {
|
|
||||||
cat <<- EOF
|
|
||||||
USAGE: ./build boot roms boardname
|
|
||||||
To build *all* boards, do this: ./build boot roms all
|
|
||||||
To list *all* boards, do this: ./build boot roms list
|
|
||||||
|
|
||||||
Optional Flags:
|
|
||||||
-d: displaymode
|
|
||||||
-p: payload
|
|
||||||
-k: keyboard layout
|
|
||||||
|
|
||||||
Example commands:
|
|
||||||
./build boot roms x60
|
|
||||||
./build boot roms x200_8mb x60
|
|
||||||
./build boot roms x60 -p grub -d corebootfb -k usqwerty
|
|
||||||
|
|
||||||
possible values for 'boardname':
|
|
||||||
$(listboards)
|
|
||||||
|
|
||||||
Refer to the ${projectname} documentation for more information.
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
die() {
|
|
||||||
printf 'Error: %s\n' "${@}" 1>&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Build ROM images for supported boards
|
|
||||||
buildrom() {
|
|
||||||
board="$1"
|
|
||||||
|
|
||||||
# Start by building blobs and placing them in the
|
|
||||||
# coreboot tree only for boards that need them
|
|
||||||
./blobutil download ${board} || exit 1
|
|
||||||
|
|
||||||
if [ -d "resources/coreboot/${board}/" ]; then
|
|
||||||
./build boot roms_helper "${board}${opts}"
|
|
||||||
else
|
|
||||||
printf "\nbuild/roms: target not defined: %s\n" ${board}
|
|
||||||
die "Run: ./build boot roms list"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
|
||||||
boards=
|
boards=
|
||||||
firstoption="${1}"
|
firstoption="${1}"
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
if [ "${firstoption}" = "help" ]; then
|
if [ "${firstoption}" = "help" ]; then
|
||||||
help
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if [ "${firstoption}" = "list" ]; then
|
if [ "${firstoption}" = "list" ]; then
|
||||||
@@ -122,16 +71,78 @@ fi
|
|||||||
|
|
||||||
if [ "${firstoption}" = "all" ]; then
|
if [ "${firstoption}" = "all" ]; then
|
||||||
for boardname in $(listboards); do
|
for boardname in $(listboards); do
|
||||||
buildrom "${boardname}" || die "build/roms: error"
|
buildrom "${boardname}" \
|
||||||
|
|| die "build/roms: error"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
for board in ${boards}; do
|
for board in ${boards}; do
|
||||||
buildrom "${board}" || die "build/roms: error"
|
buildrom "${board}" \
|
||||||
|
|| die "build/roms: error"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
help
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\n\nDone! Your ROMs are in bin/\n\n"
|
printf "\n\nDone! Your ROMs are in bin/\n\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
cat <<- EOF
|
||||||
|
USAGE: ./build boot roms boardname
|
||||||
|
To build *all* boards, do this: ./build boot roms all
|
||||||
|
To list *all* boards, do this: ./build boot roms list
|
||||||
|
|
||||||
|
Optional Flags:
|
||||||
|
-d: displaymode
|
||||||
|
-p: payload
|
||||||
|
-k: keyboard layout
|
||||||
|
|
||||||
|
Example commands:
|
||||||
|
./build boot roms x60
|
||||||
|
./build boot roms x200_8mb x60
|
||||||
|
./build boot roms x60 -p grub -d corebootfb -k usqwerty
|
||||||
|
|
||||||
|
possible values for 'boardname':
|
||||||
|
$(listboards)
|
||||||
|
|
||||||
|
Refer to the ${projectname} documentation for more information.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
listboards()
|
||||||
|
{
|
||||||
|
for boarddir in resources/coreboot/*; do
|
||||||
|
if [ ! -d "${boarddir}" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
board="${boarddir##resources/coreboot/}"
|
||||||
|
board="${board%/}"
|
||||||
|
printf '%s\n' "${board##*/}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build ROM images for supported boards
|
||||||
|
buildrom() {
|
||||||
|
board="$1"
|
||||||
|
|
||||||
|
# Start by building blobs and placing them in the
|
||||||
|
# coreboot tree only for boards that need them
|
||||||
|
./blobutil download ${board} || exit 1
|
||||||
|
|
||||||
|
if [ -d "resources/coreboot/${board}/" ]; then
|
||||||
|
./build boot roms_helper "${board}${opts}"
|
||||||
|
else
|
||||||
|
printf "\nbuild/roms: target not defined: %s\n" ${board}
|
||||||
|
die "Run: ./build boot roms list"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf 'Error: %s\n' "${@}" 1>&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
main $@
|
||||||
|
|||||||
Reference in New Issue
Block a user