diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2017-08-27 23:12:37 -0400 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2017-08-29 14:53:22 -0400 |
commit | f1768eddd0222e46735ddb2388eda8712b5f1b1d (patch) | |
tree | 50238e5b8f409a0ca363051d32b4a3c5a77f0a1d /projects/grub | |
parent | f4bbd9b7c237f6ceb5adaffe8d8bd4734f84c5ed (diff) | |
download | librebootfr-f1768eddd0222e46735ddb2388eda8712b5f1b1d.tar.gz librebootfr-f1768eddd0222e46735ddb2388eda8712b5f1b1d.zip |
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).
Diffstat (limited to 'projects/grub')
-rwxr-xr-x | projects/grub/grub | 50 |
1 files changed, 23 insertions, 27 deletions
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 ) } |