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
#
# 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
# it under the terms of the GNU General Public License as published by
@ -21,8 +21,9 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
# This is where GRUB is expected to be (outside of the grub-assemble, instead in main checkout)
. "resources/grub/modules.list" # source
grubcfgsdir="resources/grub"
. "${grubcfgsdir}/modules.list"
printf "Creating GRUB payloads and configuration files\n"
@ -39,37 +40,44 @@ fi
rm -f payload/grub/*
# Separate GRUB payload per keymap. This saves space in the ROM, otherwise
# a lot of space would be used if every keymap was stored in a single image
# Separate GRUB payload per keymap to save space in ROM.
for keylayoutfile in resources/grub/keymap/*.gkb; do
for keylayoutfile in ${grubcfgsdir}/keymap/*.gkb; do
if [ ! -f "${keylayoutfile}" ]; then
continue
fi
keymap="${keylayoutfile##resources/grub/keymap/}"
keymap="${keylayoutfile##${grubcfgsdir}/keymap/}"
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-mkimage="grub/grub-mkimage" \
-O i386-coreboot \
-o payload/grub/grub_${keymap}.elf \
-d grub/grub-core/ \
--fonts= --themes= --locales= \
--modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \
/boot/grub/grub.cfg=resources/grub/config/grub_memdisk.cfg \
/boot/grub/layouts/${keymap}.gkb=${keylayoutfile}
--grub-mkimage="grub/grub-mkimage" \
-O i386-coreboot \
-o payload/grub/grub_${keymap}.elf \
-d grub/grub-core/ \
--fonts= --themes= --locales= \
--modules="${grub_modules}" \
--install-modules="${grub_install_modules}" \
${gcfg} ${grubk}
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
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
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
printf "Done! Check payload/grub/ to see the files.\n\n"