Poncho

Ⓐ&♥

Standalone BootX64.efi by GRUB2

GRUB2 can create a standalone UEFI application, with the menu included in the binary.<br/> This can be copied around.

The binary can be built and installed by:

echo "sys-boot/grub:2" >> /etc/portage/package.accept_keywords
echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf
emerge -avt sys-boot/grub:2

Create a simple grub.cfg

mkdir -p /tmp/grub.temp/boot/grub
cat > /tmp/grub.temp/boot/grub/grub.cfg <<EOF
timeout=5
menuentry 'Pentoo' {
    insmod efi_gop
    insmod efi_uga
    insmod part_msdos
    root=hd0,1
    linux /boot/pentoo root=/dev/ram0 init=/linuxrc aufs max_loop=256 dokeymap looptype=squashfs loop=/image.squashfs cdroot video=uvesafb:mtrr:3,ywrap,1024x768-16 usbcore.autosuspend=1 console=tty0
    initrd /boot/pentoo.igz
}
EOF

Create the standalone BootX64.efi: The relative path to "boot/grub/grub.cfg" is important!

cd /tmp/grub.temp/
mkdir -p /mnt/cdrom/EFI/BOOT
grub2-mkstandalone  --directory="/usr/lib/grub/x86_64-efi/" \
--format="x86_64-efi" --compression="xz" \
--output=/mnt/cdrom/EFI/BOOT/BOOTX64.EFI \
boot/grub/grub.cfg

Source: https://code.google.com/p/pentoo/wiki/UEFI#UEFI_Standalone_EFI_image_by_GRUB2