build/payload/grub: 79 chars or less per line

Signed-off-by: Leah Rowe <leah@libreboot.org>
fsdg20230625
Leah Rowe 2023-05-20 19:55:11 +01:00
parent 92bd18c45a
commit db7e81612a
1 changed files with 28 additions and 20 deletions

View File

@ -2,7 +2,7 @@
# generate GRUB ELF files (coreboot payload) and configuration files # generate GRUB ELF files (coreboot payload) and configuration files
# #
# Copyright (C) 2014, 2015, 2020, 2021 Leah Rowe <info@minifree.org> # Copyright (C) 2014,2015,2020,2021,2023 Leah Rowe <info@minifree.org>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -21,8 +21,9 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v [ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e set -u -e
# This is where GRUB is expected to be (outside of the grub-assemble, instead in main checkout) grubcfgsdir="resources/grub"
. "resources/grub/modules.list" # source
. "${grubcfgsdir}/modules.list"
printf "Creating GRUB payloads and configuration files\n" printf "Creating GRUB payloads and configuration files\n"
@ -39,16 +40,18 @@ fi
rm -f payload/grub/* rm -f payload/grub/*
# Separate GRUB payload per keymap. This saves space in the ROM, otherwise # Separate GRUB payload per keymap to save space in ROM.
# a lot of space would be used if every keymap was stored in a single image
for keylayoutfile in resources/grub/keymap/*.gkb; do for keylayoutfile in ${grubcfgsdir}/keymap/*.gkb; do
if [ ! -f "${keylayoutfile}" ]; then if [ ! -f "${keylayoutfile}" ]; then
continue continue
fi fi
keymap="${keylayoutfile##resources/grub/keymap/}" keymap="${keylayoutfile##${grubcfgsdir}/keymap/}"
keymap="${keymap%.gkb}" keymap="${keymap%.gkb}"
gcfg="/boot/grub/grub.cfg=${grubcfgsdir}"
gcfg="${gcfg}/config/grub_memdisk.cfg"
grubk="/boot/grub/layouts/${keymap}.gkb=${keylayoutfile}"
grub/grub-mkstandalone \ grub/grub-mkstandalone \
--grub-mkimage="grub/grub-mkimage" \ --grub-mkimage="grub/grub-mkimage" \
-O i386-coreboot \ -O i386-coreboot \
@ -57,19 +60,24 @@ for keylayoutfile in resources/grub/keymap/*.gkb; do
--fonts= --themes= --locales= \ --fonts= --themes= --locales= \
--modules="${grub_modules}" \ --modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \ --install-modules="${grub_install_modules}" \
/boot/grub/grub.cfg=resources/grub/config/grub_memdisk.cfg \ ${gcfg} ${grubk}
/boot/grub/layouts/${keymap}.gkb=${keylayoutfile}
if [ "${keymap}" = "usqwerty" ]; then if [ "${keymap}" = "usqwerty" ]; then
cp resources/grub/config/grub.cfg payload/grub/grub_usqwerty.cfg cp ${grubcfgsdir}/config/grub.cfg \
payload/grub/grub_usqwerty.cfg
else else
sed "s/usqwerty/${keymap}/" < resources/grub/config/grub.cfg > payload/grub/grub_${keymap}.cfg sed "s/usqwerty/${keymap}/" \
< ${grubcfgsdir}/config/grub.cfg \
> payload/grub/grub_${keymap}.cfg
fi fi
sed "s/grubtest.cfg/grub.cfg/" < payload/grub/grub_${keymap}.cfg > payload/grub/grub_${keymap}_test.cfg sed "s/grubtest.cfg/grub.cfg/" \
< payload/grub/grub_${keymap}.cfg \
> payload/grub/grub_${keymap}_test.cfg
printf "Generated: 'payload/grub/grub_%s.elf' and configs.'\n" "${keymap}" printf "Created 'payload/grub/grub_%s.elf' and configs.'\n" \
"${keymap}"
done done
printf "Done! Check payload/grub/ to see the files.\n\n" printf "Done! Check payload/grub/ to see the files.\n\n"