diff --git a/local/recipes/core/grub/grub.cfg b/local/recipes/core/grub/grub.cfg index 5a547b7b..61508e9a 100644 --- a/local/recipes/core/grub/grub.cfg +++ b/local/recipes/core/grub/grub.cfg @@ -6,9 +6,9 @@ # Place this file at EFI/BOOT/grub.cfg on the ESP. # The install-grub.sh script handles this automatically. # -# To customize: edit this file before running install-grub.sh, -# or modify the ESP directly with mtools: -# mcopy -i harddrive.img@@1048576 grub.cfg ::EFI/BOOT/grub.cfg +# To customize: edit this file before building GRUB (make r.grub), +# or modify the ESP directly with fat_tool.py: +# python3 local/scripts/fat_tool.py cp-in harddrive.img 1048576 grub.cfg EFI/BOOT/grub.cfg set default=0 set timeout=5 diff --git a/local/recipes/core/grub/recipe.toml b/local/recipes/core/grub/recipe.toml index 41c5f36c..d8ace826 100644 --- a/local/recipes/core/grub/recipe.toml +++ b/local/recipes/core/grub/recipe.toml @@ -26,12 +26,20 @@ script = """ unset CC CXX CPP LD AR NM RANLIB OBJCOPY STRIP PKG_CONFIG unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS +# Verify host tools are available before starting the build. +for tool in gcc make bison flex; do + if ! command -v "${tool}" &>/dev/null; then + echo "ERROR: Required host tool '${tool}' not found" >&2 + exit 1 + fi +done + # Out-of-tree build (GRUB requires this for some configurations) -mkdir -p "${COOKBOOK_BUILD}/grub-build" -cd "${COOKBOOK_BUILD}/grub-build" +mkdir -p "${COOKBOOK_BUILD}/grub-build" || exit 1 +cd "${COOKBOOK_BUILD}/grub-build" || exit 1 # GRUB release tarballs miss extra_deps.lst (normally generated by autogen.sh) -touch "${COOKBOOK_SOURCE}/grub-core/extra_deps.lst" +touch "${COOKBOOK_SOURCE}/grub-core/extra_deps.lst" || exit 1 # Configure for host, targeting x86_64 EFI platform output. # --target=x86_64 means "produce boot images for x86_64" @@ -48,10 +56,10 @@ echo "Configuring GRUB for x86_64 EFI..." --disable-grub-mount \ --disable-device-mapper \ --disable-libzfs \ - --prefix="${COOKBOOK_STAGE}/usr" + --prefix="${COOKBOOK_STAGE}/usr" || exit 1 echo "Building GRUB..." -make -j "${COOKBOOK_MAKE_JOBS}" +make -j "${COOKBOOK_MAKE_JOBS}" || exit 1 # Create output directory mkdir -p "${COOKBOOK_STAGE}/usr/lib/boot" @@ -101,7 +109,7 @@ echo "Creating standalone GRUB EFI image..." ls \ cat \ halt \ - reboot + reboot || exit 1 # Verify output if [ ! -f "${COOKBOOK_STAGE}/usr/lib/boot/grub.efi" ]; then