summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-09-25 03:06:43 +0100
committerLeah Rowe <leah@libreboot.org>2023-09-25 03:06:43 +0100
commit42c9d7d28c4b1988123fb29c7ebdf7f4893e46b1 (patch)
treec96f79b49139df9c33369bf2d76a9f466311c500
parente94ba1f7c0f83bfcd20d56795d788ad4b7c8d550 (diff)
build/grub/*: move common strings to variables
also general cleanup of these scripts Signed-off-by: Leah Rowe <leah@libreboot.org>
-rwxr-xr-xscript/build/grub/payload44
-rwxr-xr-xscript/build/grub/utils1
2 files changed, 22 insertions, 23 deletions
diff --git a/script/build/grub/payload b/script/build/grub/payload
index a21e8f68..6f4c421a 100755
--- a/script/build/grub/payload
+++ b/script/build/grub/payload
@@ -5,15 +5,15 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
+elfdir="elf/grub"
grubcfgsdir="config/grub"
+layoutdir="/boot/grub/layouts"
. "include/err.sh"
. "${grubcfgsdir}/modules.list"
main()
{
- printf "Creating GRUB payloads and configuration files\n"
-
handle_dependencies
build_keymap_configs
build_grub_payload
@@ -27,11 +27,11 @@ handle_dependencies()
[ -f "grub/grub-mkstandalone" ] || \
./build grub utils || \
err "handle_dependencies: cannot build grub utils"
- [ -d "elf/grub" ] || \
- mkdir -p elf/grub || \
- err "handle_dependencies: cannot mkdir elf/grub"
- rm -f elf/grub/* || \
- err "handle_dependencies: cannot rm inside: elf/grub/"
+ [ -d "${elfdir}" ] || \
+ mkdir -p "${elfdir}" || \
+ err "handle_dependencies: cannot mkdir ${elfdir}"
+ rm -f "${elfdir}/"* || \
+ err "handle_dependencies: cannot rm inside: ${elfdir}/"
}
build_keymap_configs()
@@ -41,8 +41,8 @@ build_keymap_configs()
keymap="${keylayoutfile##${grubcfgsdir}/keymap/}"
keymap="${keymap%.gkb}"
printf "keymap %s\n" "${keymap}" > \
- "elf/grub/keymap_${keymap}.cfg" || \
- err "make_keymapcfgs: cannot create elf/grub/keymap_${keymap}.cfg"
+ "${elfdir}/keymap_${keymap}.cfg" || \
+ err "mk_keymap: can't make ${elfdir}/keymap_${keymap}.cfg"
done
}
@@ -51,23 +51,23 @@ build_grub_payload()
grub/grub-mkstandalone \
--grub-mkimage="grub/grub-mkimage" \
-O i386-coreboot \
- -o "elf/grub/grub.elf" \
+ -o "${elfdir}/grub.elf" \
-d grub/grub-core/ \
--fonts= --themes= --locales= \
--modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \
- "/boot/grub/layouts/colemak.gkb=${grubcfgsdir}/keymap/colemak.gkb" \
- "/boot/grub/layouts/deqwertz.gkb=${grubcfgsdir}/keymap/deqwertz.gkb" \
- "/boot/grub/layouts/esqwerty.gkb=${grubcfgsdir}/keymap/esqwerty.gkb" \
- "/boot/grub/layouts/frazerty.gkb=${grubcfgsdir}/keymap/frazerty.gkb" \
- "/boot/grub/layouts/frdvbepo.gkb=${grubcfgsdir}/keymap/frdvbepo.gkb" \
- "/boot/grub/layouts/itqwerty.gkb=${grubcfgsdir}/keymap/itqwerty.gkb" \
- "/boot/grub/layouts/svenska.gkb=${grubcfgsdir}/keymap/svenska.gkb" \
- "/boot/grub/layouts/trqwerty.gkb=${grubcfgsdir}/keymap/trqwerty.gkb" \
- "/boot/grub/layouts/ukdvorak.gkb=${grubcfgsdir}/keymap/ukdvorak.gkb" \
- "/boot/grub/layouts/ukqwerty.gkb=${grubcfgsdir}/keymap/ukqwerty.gkb" \
- "/boot/grub/layouts/usdvorak.gkb=${grubcfgsdir}/keymap/usdvorak.gkb" \
- "/boot/grub/layouts/usqwerty.gkb=${grubcfgsdir}/keymap/usqwerty.gkb" \
+ "${layoutdir}/colemak.gkb=${grubcfgsdir}/keymap/colemak.gkb" \
+ "${layoutdir}/deqwertz.gkb=${grubcfgsdir}/keymap/deqwertz.gkb" \
+ "${layoutdir}/esqwerty.gkb=${grubcfgsdir}/keymap/esqwerty.gkb" \
+ "${layoutdir}/frazerty.gkb=${grubcfgsdir}/keymap/frazerty.gkb" \
+ "${layoutdir}/frdvbepo.gkb=${grubcfgsdir}/keymap/frdvbepo.gkb" \
+ "${layoutdir}/itqwerty.gkb=${grubcfgsdir}/keymap/itqwerty.gkb" \
+ "${layoutdir}/svenska.gkb=${grubcfgsdir}/keymap/svenska.gkb" \
+ "${layoutdir}/trqwerty.gkb=${grubcfgsdir}/keymap/trqwerty.gkb" \
+ "${layoutdir}/ukdvorak.gkb=${grubcfgsdir}/keymap/ukdvorak.gkb" \
+ "${layoutdir}/ukqwerty.gkb=${grubcfgsdir}/keymap/ukqwerty.gkb" \
+ "${layoutdir}/usdvorak.gkb=${grubcfgsdir}/keymap/usdvorak.gkb" \
+ "${layoutdir}/usqwerty.gkb=${grubcfgsdir}/keymap/usqwerty.gkb" \
"/boot/grub/grub.cfg=${grubcfgsdir}/config/grub_memdisk.cfg" \
"/boot/grub/grub_default.cfg=${grubcfgsdir}/config/grub.cfg" || \
err "build_grub_elf: cannot build grub payload (grub-mkstandalone)"
diff --git a/script/build/grub/utils b/script/build/grub/utils
index 631277d5..3c463e6d 100755
--- a/script/build/grub/utils
+++ b/script/build/grub/utils
@@ -10,7 +10,6 @@ set -u -e
main()
{
- printf "Building GRUB\n"
[ -d "grub/" ] || ./update project repo grub || err "cannot fetch grub"
build_grub
}