summaryrefslogtreecommitdiff
path: root/resources/scripts/build/grub
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-08-21 19:41:49 +0100
committerLeah Rowe <leah@libreboot.org>2023-08-21 22:38:00 +0100
commit62f23123cb2a5ef594f405053d0b111c6e01de87 (patch)
tree74d57d43b7e3cf107c183d273d10dcd5278ab138 /resources/scripts/build/grub
parent7be4706552845824888b58054120dfac99bfdf63 (diff)
general code cleanup on lbmk shell scripts
in update/blobs/download, i saw instances where appdir was being deleted with rm -r, but the more appropriate command would rm -Rf. this is now fixed. other than that, i've mostly just simplified a bunch of if statements and consolidated some duplicated logic (e.g. if/else block for dependencies in build_dependencies() of update/blobs/download one or two functions and/or variables have been renamed, for greater clarity in the code, also removed a few messages that were redundant used printf instead of echo, in a few places, also fixed up the indentation in a few places Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'resources/scripts/build/grub')
-rwxr-xr-xresources/scripts/build/grub/payload33
-rwxr-xr-xresources/scripts/build/grub/utils15
2 files changed, 16 insertions, 32 deletions
diff --git a/resources/scripts/build/grub/payload b/resources/scripts/build/grub/payload
index bf52d2a1..4886a874 100755
--- a/resources/scripts/build/grub/payload
+++ b/resources/scripts/build/grub/payload
@@ -53,18 +53,15 @@ main()
build_grub_payloads()
{
keylayoutfile=${1}
+ [ -f "${keylayoutfile}" ] || continue
- if [ ! -f "${keylayoutfile}" ]; then
- continue
- fi
keymap="${keylayoutfile##${grubcfgsdir}/keymap/}"
keymap="${keymap%.gkb}"
build_grub_elf "${keylayoutfile}"
create_grub_config
- printf "Created 'elf/grub/grub_%s.elf' and configs.'\n" \
- "${keymap}"
+ printf "Created 'elf/grub/grub_%s.elf' and configs.'\n" "${keymap}"
}
build_grub_elf()
@@ -75,24 +72,22 @@ build_grub_elf()
gcfg="${gcfg}/config/grub_memdisk.cfg"
grubk="/boot/grub/layouts/${keymap}.gkb=${keylayoutfile}"
grub/grub-mkstandalone \
- --grub-mkimage="grub/grub-mkimage" \
- -O i386-coreboot \
- -o elf/grub/grub_${keymap}.elf \
- -d grub/grub-core/ \
- --fonts= --themes= --locales= \
- --modules="${grub_modules}" \
- --install-modules="${grub_install_modules}" \
- ${gcfg} ${grubk}
+ --grub-mkimage="grub/grub-mkimage" \
+ -O i386-coreboot \
+ -o elf/grub/grub_${keymap}.elf \
+ -d grub/grub-core/ \
+ --fonts= --themes= --locales= \
+ --modules="${grub_modules}" \
+ --install-modules="${grub_install_modules}" \
+ ${gcfg} ${grubk}
}
create_grub_config()
{
- sed "s/usqwerty/${keymap}/" \
- < ${grubcfgsdir}/config/grub.cfg \
- > elf/grub/grub_${keymap}.cfg
- sed "s/grubtest.cfg/grub.cfg/" \
- < elf/grub/grub_${keymap}.cfg \
- > elf/grub/grub_${keymap}_test.cfg
+ sed "s/usqwerty/${keymap}/" < ${grubcfgsdir}/config/grub.cfg \
+ > elf/grub/grub_${keymap}.cfg
+ sed "s/grubtest.cfg/grub.cfg/" < elf/grub/grub_${keymap}.cfg \
+ > elf/grub/grub_${keymap}_test.cfg
}
main $@
diff --git a/resources/scripts/build/grub/utils b/resources/scripts/build/grub/utils
index edad6b2a..3e379472 100755
--- a/resources/scripts/build/grub/utils
+++ b/resources/scripts/build/grub/utils
@@ -25,11 +25,7 @@ set -u -e
main()
{
printf "Building GRUB\n"
-
- if [ ! -d "grub/" ]; then
- ./fetch grub || exit 1
- fi
-
+ [ -d "grub/" ] || ./fetch grub || exit 1
build_grub
}
@@ -37,15 +33,8 @@ build_grub()
{
(
cd grub/ || err "cd"
-
- # clean up first
- if [ -d Makefile ]; then
- make distclean || err "make-distclean"
- fi
-
+ [ ! -d Makefile ] || make distclean || err "make-distclean"
./bootstrap --gnulib-srcdir=gnulib/ --no-git || err "bootstrap"
-
- # build
./autogen.sh || err "autogen"
./configure --with-platform=coreboot || err "configure"
make -j$(nproc) || err "make"