Files
lbmk/script/build/boot/roms
Leah Rowe 49b266eb42 build/boot/roms: only do 1 custom kbd/payload/mode
-k, -p and -d let you set keymap, payload and displaymode
respectively, but the handling for this is buggy when
passing multiple arguments.

Support only one argument, for simplicity. This is how
people use them anyway, and it makes lbmk less buggy.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30 16:14:27 +01:00

66 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env sh
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2014,2015,2016,2020,2021,2023 Leah Rowe <leah@libreboot.org>
# SPDX-FileCopyrightText: 2015 Klemens Nanni <contact@autoboot.org>
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# SPDX-FileCopyrightText: 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
. "include/err.sh"
. "include/option.sh"
. "include/boot.sh"
read projectname < projectname
targets=""
# main() is in include/boot.sh
handle_targets()
{
[ -z "${_displaymode}" ] || _displaymode="-d ${_displaymode}"
[ -z "${_payload}" ] || _payload="-p ${_payload}"
[ -z "${_keyboard_layout}" ] || \
_keyboard_layout="-k ${_keyboard_layout}"
printf "Building %s ROM images\n" "${projectname}"
[ "${first}" != "all" ] || boards="$(listitems config/coreboot)" || \
err "handle_targets: Cannot get list of boards"
check_targets
build_bootroms
confirm_targets
}
check_targets()
{
for x in ${boards}; do
[ -d "config/coreboot/${x}/" ] || \
err "check_targets: target not defined: ${x}"
done
}
build_bootroms()
{
opts="${_displaymode} ${_payload} ${_keyboard_layout}"
for x in ${boards}; do
./build boot roms_helper ${_displaymode} ${_payload} \
${_keyboard_layout} ${x} || \
err "handle_targets ${opts} ${x}: build error"
[ -d "bin/${x}" ] && targets="${x} ${targets}"
done
}
confirm_targets()
{
[ -z "${targets}" ] && err "No ROM images were compiled."
printf "\n\nYour ROM images are available in these directories:\n"
for x in ${targets}; do
printf "* bin/%s\n" "${x}"
done
}
main $@