A FOB STORY: some notes on bootable flash drives

Chainloading other bootloaders

There are times when having grub2 hand off to another bootloader is useful: when the target program & bootloader can’t be separated for direct booting from grub2 or when using the flash drive to boot an OS already installed on the system’s hard drive.

Chainloading looks different in UEFI and legacy mode.  Chainloading windows on HDD in legacy mode:

menuentry "Windows legacy chainload" {
    set root=(hd0,1)
    chainloader +1
}

In UEFI mode:

menuentry "Windows UEFI chainload" {
    insmod ntfs
    set root=(hd1,gpt2)
    chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
    boot
}

And an EFI shell on the flash drive:

menuentry "EFI Shell UEFI chainload" {
    chainloader /bootable/EFI_Shell/BootX64.efi
}

Memtest is available in a UEFI-bootable version from Passmark:  MemTest86 V5.1.0 Free Edition.  The UEFI bootloader+application can be extracted from the ISO in the zip file, and booted as below:

[Update 2018.04.14]  Newer versions of Memtest86 (linked above) include a tool to build a UEFI + legacy bootable flash drive.  Run that and copy the files from the created flash drive as an alternative to extracting them from the ISO.

menuentry "Memtest UEFI chainload" {
    chainloader /bootable/memtest_5.1.0/EFI/BOOT/BOOTX64.EFI
}

Again, the path to the EFI shell and UEFI Memtest is due to the way I’ve laid out the flash drive, and the root partition locations (root=…) are specific to the target machines I’m using for testing.  They will almost certainly be different when booting on other computers.  For Windows legacy the target will be the boot partition of there is one (the C: partition if there isn’t) and for Windows UEFI it will be the EFI partition.

Remember that you can edit the boot stanzas “on the fly” at boot time.  More on that in the grub.cfg example page.

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to A FOB STORY: some notes on bootable flash drives

  1. Pingback: FOB Story II | GeezBlog

Leave a Reply

Your email address will not be published. Required fields are marked *