From f1768eddd0222e46735ddb2388eda8712b5f1b1d Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Sun, 27 Aug 2017 23:12:37 -0400 Subject: Rewrite GRUB 'build' action, integrating grub-helper The previous build function definition only allowed for a one-size-fits-all build process for any given target. The function was rewritten to allow for different build processes based on the target passed to it (e.g. building GRUB keylayouts is very different from building GRUB images). --- projects/grub/grub | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'projects/grub') diff --git a/projects/grub/grub b/projects/grub/grub index 547c770d..e77deb6d 100755 --- a/projects/grub/grub +++ b/projects/grub/grub @@ -57,6 +57,7 @@ update_check() { } build() { + local target="$1" local repository="${project}" project_sources_directory_missing_empty_error "${project}" "${repository}" "$@" @@ -68,37 +69,32 @@ build() { local project_path="$(project_path "${project}")" local sources_path="$(project_sources_path "${project}" "${repository}" "$@")" local build_path="$(project_build_path "${project}" "$@")" - - mapfile -t grub_install_modules < "${project_path}/${CONFIGS}/modules-install" - mapfile -t grub_load_modules < "${project_path}/${CONFIGS}/modules-preload" + local rawmap_path="${project_path}/${CONFIGS}/${target}/original" mkdir -p "${build_path}" + grub_build_utils + + case "${target}" in + bios) + grub_build_floppy_image + grub_copy_modules + ;; + keymap) + for rawmap in "${rawmap_path}"/*; do + grub_build_layout "${rawmap}" + done + ;; + *) + grub_build_standalone_image + grub_copy_modules + ;; + esac + + # Temporary until the function project_make_distclean is written ( - cd "${sources_path}" - - # Compile GRUB first - ./autogen.sh - ./configure --with-platform=coreboot - make -j"${TASKS}" - - # Now compile GRUB ELF executable - ./grub-mkstandalone \ - --grub-mkimage=./grub-mkimage \ - --fonts='' \ - --themes='' \ - --locales='' \ - --modules="${grub_load_modules[*]}" \ - --install-modules="${grub_install_modules[*]}" \ - --directory=grub-core \ - -O i386-coreboot \ - -o grub.elf \ - /boot/grub/grub.cfg="${project_path}/${CONFIGS}/grub.cfg" - - # Copy the ELF to its build directory - cp grub.elf "${build_path}" - - # Tidy up + cd "${sources_path}" || return + make distclean ) } -- cgit v1.2.3-70-g09d2