zen2818
zen2818

Reputation: 49

GRUB2 not loading grub.cfg in CREATING Buildroot hybrid ISO (BIOS/EFI)

I'm trying to create a hybrid ISO using Buildroot that boots via both BIOS and EFI. However, GRUB2 enters the rescue shell in both boot modes instead of loading the configuration.

Environment:

My configuration:

In Buildroot defconfig:

BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_I386_PC=y
BR2_TARGET_GRUB2_X86_64_EFI=y
BR2_TARGET_GRUB2_BOOT_PARTITION="cd0"
BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat squash4 part_msdos part_gpt normal biosdisk iso9660 search search_fs_file search_fs_uuid search_label"
BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC=""
BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal efi_gop iso9660 search search_fs_file search_fs_uuid search_label"
BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI=""
BR2_TARGET_ROOTFS_ISO9660=y
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="$(BR2_EXTERNAL_PPPWN_LIVE_PATH)/board/pppwn/grub.cfg"

My post-build script creates this grub.cfg:

set default="0"
set timeout="5"

if [ "${grub_platform}" = "efi" ]; then
    set prefix=(cd0)/boot/grub
    menuentry "PPPwnLive" {
        linux (cd0)/boot/bzImage root=/dev/ram0 console=tty1
        initrd (cd0)/boot/initrd
    }
else
    set prefix=(cd)/boot/grub
    menuentry "PPPwnLive" {
        linux (cd)/boot/bzImage root=/dev/ram0 console=tty1
        initrd (cd)/boot/initrd
    }
fi

What I've tried:

Expected behavior: GRUB should load the configuration and show the boot menu in both BIOS and EFI modes.

Actual behavior:

Question: Why isn't GRUB finding/loading the configuration in either mode? I suspect it's related to either:

How can I properly configure GRUB2 to find and load its config in both boot modes?

Upvotes: 1

Views: 40

Answers (0)

Related Questions