Ubuntu – Booting linux from usb using EFI

bootlinux-mintlive-usbrefitUbuntu

I need to use a USB drive as an installation media for my Mint and Ubuntu.
For that I have unetbootin to make the usb bootable.

But my PC only supports EFI boot (while adding the boot device, I need to provide an .efi file path etc).

My question is how can I make my Linux distribution by copying some files (.efi file)?

I have heard of a boot loader called elilo, but don't know how to use. And I tried rEFInd, rEFIt etc., they are booting from usb,
but I don't know how to configure it to boot the Linux distribution in my usb drive.

Best Answer

You need to install an EFI bootloader to the USB drive; elilo is what I've used before, but you could potentially use GRUB2. The Ubuntu amd64 elilo package installs the 64bit binary to /usr/lib/elilo/elilo.efi and the 32bit binary to /usr/lib32/elilo/elilo.efi.

EFI firmware will search removable media for a FAT32 filesystem containing the file /EFI/BOOT/BOOTX64.efi (for both 32bit and 64bit systems). Make sure that you're using a FAT32 filesystem on the USB drive, and copy elilo.efi to that path.

Some EFI systems may also need a startup script, in which case put the following in /EFI/BOOT/startup.nsh:

BOOTX64

You then probably want to create a config file for elilo to specify how to boot the kernel. Create /EFI/BOOT/elilo.conf and configure it as appropriate for the distro you want to boot. My configuration to boot RIPLinux looks like this:

image=/riplinux/kernel64
        label=rip64
        initrd=/riplinux/rootfs.cgz
        append="root=/dev/ram0 rw"

And that should be it. There is no "install to MBR" type operation in EFI.

By the way, Rod Smith's Managing EFI Boot Loaders for Linux site is very useful for understanding how EFI works.

Related Question