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>
btrfsvols
Leah Rowe 2023-09-30 16:14:27 +01:00
parent d268f5eb28
commit 49b266eb42
3 changed files with 24 additions and 31 deletions

View File

@ -3,11 +3,12 @@
# SPDX-FileCopyrightText: 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com> # SPDX-FileCopyrightText: 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org> # SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
first=""
board="" board=""
boards="" boards=""
displaymodes="" _displaymode=""
payloads="" _payload=""
keyboard_layouts="" _keyboard_layout=""
main() main()
{ {
@ -21,13 +22,13 @@ main()
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case ${1} in case ${1} in
-d) -d)
displaymodes="${2} ${displaymodes}" _displaymode="${2}"
shift ;; shift ;;
-p) -p)
payloads="${2} ${payloads}" _payload="${2}"
shift ;; shift ;;
-k) -k)
keyboard_layouts="${2} ${keyboard_layouts}" _keyboard_layout="${2}"
shift ;; shift ;;
all) all)
first="all" ;; first="all" ;;

View File

@ -13,18 +13,16 @@ set -u -e
. "include/boot.sh" . "include/boot.sh"
read projectname < projectname read projectname < projectname
opts=""
first=""
targets="" targets=""
# main() is in include/boot.sh # main() is in include/boot.sh
handle_targets() handle_targets()
{ {
[ -z "${displaymodes}" ] || opts="-d \"${displaymodes}\" ${opts}" [ -z "${_displaymode}" ] || _displaymode="-d ${_displaymode}"
[ -z "${payloads}" ] || opts="-p \"${payloads}\" ${opts}" [ -z "${_payload}" ] || _payload="-p ${_payload}"
[ -z "${keyboard_layouts}" ] || \ [ -z "${_keyboard_layout}" ] || \
opts="-k \"${keyboard_layouts}\" ${opts}" _keyboard_layout="-k ${_keyboard_layout}"
printf "Building %s ROM images\n" "${projectname}" printf "Building %s ROM images\n" "${projectname}"
@ -46,8 +44,10 @@ check_targets()
build_bootroms() build_bootroms()
{ {
opts="${_displaymode} ${_payload} ${_keyboard_layout}"
for x in ${boards}; do for x in ${boards}; do
./build boot roms_helper ${opts} ${x} || \ ./build boot roms_helper ${_displaymode} ${_payload} \
${_keyboard_layout} ${x} || \
err "handle_targets ${opts} ${x}: build error" err "handle_targets ${opts} ${x}: build error"
[ -d "bin/${x}" ] && targets="${x} ${targets}" [ -d "bin/${x}" ] && targets="${x} ${targets}"
done done

View File

@ -63,9 +63,6 @@ handle_targets()
configure_target() configure_target()
{ {
printf "\n\nboard %s, kb %s, displaymode %s, payloads %s\n" \
"${board}" "${keyboard_layouts}" "${displaymodes}" "${payloads}"
targetdir="${cfgsdir}/${board}" targetdir="${cfgsdir}/${board}"
[ -d "${targetdir}" ] || \ [ -d "${targetdir}" ] || \
@ -121,8 +118,8 @@ configure_target()
blobs_required="y" blobs_required="y"
# Override all payload directives with cmdline args # Override all payload directives with cmdline args
if [ ! -z ${payloads} ]; then if [ ! -z ${_payload} ]; then
printf "setting payloads %s\n" "$payloads" printf "setting payload to: %s\n" "${_payload}"
payload_grub="n" payload_grub="n"
payload_grub_withseabios="n" # seabios chainloaded from grub payload_grub_withseabios="n" # seabios chainloaded from grub
payload_seabios="n" payload_seabios="n"
@ -130,9 +127,7 @@ configure_target()
payload_uboot="n" payload_uboot="n"
payload_memtest="n" payload_memtest="n"
for payload in ${payloads} ; do eval "payload_${_payload}=y"
eval "payload_${payload}=y"
done
fi fi
} }
@ -217,7 +212,7 @@ build_target()
hmode="vesafb" hmode="vesafb"
[ "${initmode}" = "vgarom" ] || hmode="corebootfb" [ "${initmode}" = "vgarom" ] || hmode="corebootfb"
modes="${hmode} txtmode" modes="${hmode} txtmode"
[ -z ${displaymodes} ] || modes="${displaymodes}" [ -z ${_displaymode} ] || modes="${_displaymode}"
for y in ${modes}; do for y in ${modes}; do
displaymode="${y}" displaymode="${y}"
[ "${initmode}" = "normal" ] && \ [ "${initmode}" = "normal" ] && \
@ -356,15 +351,12 @@ build_grub_roms() {
rm -f "${tmpcfg}" || err "cannot delete tmpcfg" rm -f "${tmpcfg}" || err "cannot delete tmpcfg"
keymaps="" keymaps=""
if [ -z ${keyboard_layouts} ]; then
for kmapfile in "${kmapdir}"/*; do for kmapfile in "${kmapdir}"/*; do
keymaps="${keymaps} ${kmapfile}" keymaps="${keymaps} ${kmapfile}"
done done
else [ -z ${_keyboard_layout} ] || \
for keymapname in ${keyboard_layouts}; do keymaps="${kmapdir}/${_keyboard_layout}.gkb"
keymaps="${keymaps} ${kmapdir}/${keymapname}.gkb"
done
fi
for keymapfile in ${keymaps}; do for keymapfile in ${keymaps}; do
printf "keymaps is %s, keymapfile is %s\n" \ printf "keymaps is %s, keymapfile is %s\n" \
"${keymaps}" "${keymapfile}" "${keymaps}" "${keymapfile}"