From 1c2de7f962115a96668aa1f66b1cc1fee3be6922 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 6 Oct 2023 01:34:14 +0100 Subject: unify build/grub/* to build/coreboot/grub Signed-off-by: Leah Rowe --- script/build/boot/roms | 2 +- script/build/coreboot/grub | 80 ++++++++++++++++++++++++++++++++++++++++++++++ script/build/grub/payload | 68 --------------------------------------- script/build/grub/utils | 29 ----------------- 4 files changed, 81 insertions(+), 98 deletions(-) create mode 100755 script/build/coreboot/grub delete mode 100755 script/build/grub/payload delete mode 100755 script/build/grub/utils (limited to 'script/build') diff --git a/script/build/boot/roms b/script/build/boot/roms index 9736ee7f..e111fdb0 100755 --- a/script/build/boot/roms +++ b/script/build/boot/roms @@ -166,7 +166,7 @@ build_dependency_grub() rebuild_grub="y" && break done [ "${rebuild_grub}" = "y" ] || return 0 - x_ ./build grub payload + x_ ./build coreboot grub } build_dependency_uboot() diff --git a/script/build/coreboot/grub b/script/build/coreboot/grub new file mode 100755 index 00000000..7f448e24 --- /dev/null +++ b/script/build/coreboot/grub @@ -0,0 +1,80 @@ +#!/usr/bin/env sh +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileCopyrightText: 2014,2015,2020,2021,2023 Leah Rowe + +[ "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() +{ + handle_dependencies + build_keymap_configs + build_grub_payload +} + +handle_dependencies() +{ + [ -d "grub/" ] || x_ ./update project repo grub + [ -f "grub/grub-mkstandalone" ] || build_grub_utils + [ -d "${elfdir}" ] || x_ mkdir -p "${elfdir}" + x_ rm -f "${elfdir}/"* +} + +build_grub_utils() +{ + ( + x_ cd grub/ + [ ! -d Makefile ] || x_ make distclean + x_ ./bootstrap --gnulib-srcdir=gnulib/ --no-git + x_ ./autogen.sh + x_ ./configure --with-platform=coreboot + x_ make -j$(nproc) FS_PAYLOAD_MODULES="" + ) +} + +build_keymap_configs() +{ + for keylayoutfile in "${grubcfgsdir}/keymap/"*.gkb; do + [ -f "${keylayoutfile}" ] || continue + keymap="${keylayoutfile##${grubcfgsdir}/keymap/}" + keymap="${keymap%.gkb}" + x_ printf "keymap %s\n" "${keymap}" > \ + "${elfdir}/keymap_${keymap}.cfg" + done +} + +build_grub_payload() +{ + grub/grub-mkstandalone \ + --grub-mkimage="grub/grub-mkimage" \ + -O i386-coreboot \ + -o "${elfdir}/grub.elf" \ + -d grub/grub-core/ \ + --fonts= --themes= --locales= \ + --modules="${grub_modules}" \ + --install-modules="${grub_install_modules}" \ + "${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)" +} + +main $@ diff --git a/script/build/grub/payload b/script/build/grub/payload deleted file mode 100755 index 03549ef6..00000000 --- a/script/build/grub/payload +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env sh -# SPDX-License-Identifier: GPL-3.0-or-later -# SPDX-FileCopyrightText: 2014,2015,2020,2021,2023 Leah Rowe - -[ "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() -{ - handle_dependencies - build_keymap_configs - build_grub_payload -} - -handle_dependencies() -{ - [ -d "grub/" ] || x_ ./update project repo grub - [ -f "grub/grub-mkstandalone" ] || x_ ./build grub utils - [ -d "${elfdir}" ] || x_ mkdir -p "${elfdir}" - x_ rm -f "${elfdir}/"* -} - -build_keymap_configs() -{ - for keylayoutfile in "${grubcfgsdir}/keymap/"*.gkb; do - [ -f "${keylayoutfile}" ] || continue - keymap="${keylayoutfile##${grubcfgsdir}/keymap/}" - keymap="${keymap%.gkb}" - x_ printf "keymap %s\n" "${keymap}" > \ - "${elfdir}/keymap_${keymap}.cfg" - done -} - -build_grub_payload() -{ - grub/grub-mkstandalone \ - --grub-mkimage="grub/grub-mkimage" \ - -O i386-coreboot \ - -o "${elfdir}/grub.elf" \ - -d grub/grub-core/ \ - --fonts= --themes= --locales= \ - --modules="${grub_modules}" \ - --install-modules="${grub_install_modules}" \ - "${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)" -} - -main $@ diff --git a/script/build/grub/utils b/script/build/grub/utils deleted file mode 100755 index edb78bb1..00000000 --- a/script/build/grub/utils +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env sh -# SPDX-License-Identifier: GPL-3.0-or-later -# SPDX-FileCopyrightText: 2014, 2015, 2020, 2023 Leah Rowe -# SPDX-FileCopyrightText: 2015, 2016 Klemens Nanni - -[ "x${DEBUG+set}" = 'xset' ] && set -v -set -u -e - -. "include/err.sh" - -main() -{ - [ -d "grub/" ] || x_ ./update project repo grub - build_grub -} - -build_grub() -{ - ( - x_ cd grub/ - [ ! -d Makefile ] || x_ make distclean - x_ ./bootstrap --gnulib-srcdir=gnulib/ --no-git - x_ ./autogen.sh - x_ ./configure --with-platform=coreboot - x_ make -j$(nproc) FS_PAYLOAD_MODULES="" - ) -} - -main $@ -- cgit v1.2.1