How do I create an EFI-bootable ISO of a customized version of Ubuntu?

You need to make a dual boot catalog ISO so that it will boot EFI and MBR. The standard Ubuntu 14.04 x64 ISO file works this way but there are no instructions available to make a new 14.04 bootable ISO for EFI systems. I was able to piece together the right steps to create an ISO like this.

These instructions will let you create a custom Ubuntu 14.04 Server ISO that can boot EFI and MBR. When EFI booting on a system with a blank, uninitialized disk (for example on a new Generation 2 VM in Hyper-V), setup will start automatically, then automatically wipe the disk and install the base ubuntu-server packages and OpenSSH. This is designed for automatically provisioning new systems with Ubuntu 14.04 using LVM and auto-partitioning. If you use this ISO on an existing Linux system then the installer will stop when it detects existing disks and wait for input. If you use this ISO on a non-EFI system (for example a Generation 1 Hyper-V VM) then it will wait at the graphical installer startup screen and require input before continuing to the auto installer.

The result is a base Ubuntu Server installation with ubuntu-server and openssh-server only.

Here are the steps to create an EFI-bootable ISO:

Get the 14.04 ISO:

wget http://releases.ubuntu.com/14.04/ubuntu-14.04-server-amd64.iso

Mount it and extract its contents to a new folder:

sudo mkdir -p ~/iso
sudo mount -o loop ubuntu-14.04-server-amd64.iso.iso ~/iso
sudo mkdir ~/ubuntu
sudo cp -rT ~/iso ~/ubuntu

Change into the directory where we will be doing our work:

cd ~/ubuntu

Set the language to English:

sudo -i
echo en >/home/user/ubuntu/isolinux/lang
exit

Create a preseed file that will use LVM to auto-partition the disk using all available space:

sudo nano ~/ubuntu/ks.preseed

Replace the file contents with this:

d-i partman-auto/method string lvm
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/confirm_write_new_label     boolean true
d-i partman/choose_partition            select  finish
d-i partman/confirm_nooverwrite         boolean true
d-i partman/confirm                     boolean true
d-i partman-auto/purge_lvm_from_device  boolean true
d-i partman-lvm/device_remove_lvm       boolean true
d-i partman-lvm/confirm                 boolean true
d-i partman-lvm/confirm_nooverwrite     boolean true
d-i partman-auto/init_automatically_partition       select      Guided - use entire disk and set up LVM
d-i partman/choose_partition                select      Finish partitioning and write changes to disk
d-i partman-auto-lvm/no_boot            boolean true
d-i partman-md/device_remove_md         boolean true
d-i partman-md/confirm                  boolean true
d-i partman-md/confirm_nooverwrite      boolean true

Create a kickstart file that will configure Ubuntu during the installation: (make sure you change the username part, and you should use encrypted passwords)

sudo nano ~/ubuntu/ks.cfg

Replace the file contents with this:

lang en_US
langsupport en_US
keyboard us
mouse
timezone America/Los_Angeles
rootpw --disabled
user USERNAME --fullname "USERNAME" --password "PASSWORD"
reboot
text
install
cdrom
auth  --useshadow  --enablemd5 
network --bootproto=dhcp --device=eth0
firewall --disabled 
skipx
%packages
@ ubuntu-server
openssh-server

Edit the grub configuration file so when the ISO performs an EFI boot the bootloader uses the right options to use our preseed and configuration files:

sudo nano ~/ubuntu/boot/grub/grub.cfg

Replace the file contents with this:

if loadfont /boot/grub/font.pf2 ; then
    set gfxmode=auto
    insmod efi_gop
    insmod efi_uga
    insmod gfxterm
    terminal_output gfxterm
fi

set menu_color_normal=white/light-blue
set menu_color_highlight=light-blue/light-gray
set timeout=10
set default=0

menuentry "Automatically Install Ubuntu Server with Custom Config" {
    set gfxpayload=keep
    linux   /install/vmlinuz  file=/cdrom/preseed/ubuntu-server.seed quiet ks=cdrom:/ks.cfg preseed/file=/cdrom/ks.preseed --
    initrd  /install/initrd.gz
}
menuentry "OEM install (for manufacturers)" {
    set gfxpayload=keep
    linux   /install/vmlinuz  file=/cdrom/preseed/ubuntu-server.seed quiet oem-config/enable=true --
    initrd  /install/initrd.gz
}
menuentry "Multiple server install with MAAS" {
    set gfxpayload=keep
    linux   /install/vmlinuz  modules=maas-enlist-udeb vga=788 initrd=/install/initrd.gz quiet --
    initrd  /install/initrd.gz
}
menuentry "Check disc for defects" {
    set gfxpayload=keep
    linux   /install/vmlinuz  MENU=/bin/cdrom-checker-menu quiet --
    initrd  /install/initrd.gz
}
menuentry "Rescue a broken system" {
    set gfxpayload=keep
    linux   /install/vmlinuz  rescue/enable=true --
    initrd  /install/initrd.gz
}

Edit the isolinux boot menu for non-EFI booting (MBR booting) to use the custom config and custom preseed:

sudo nano ~/ubuntu/isolinux/txt.cfg

Replace the file contents with this:

default install
label install
  menu label ^Install Ubuntu Server with Custom Config
  kernel /install/vmlinuz
  append file=/cdrom/preseed/ubuntu-server.seed initrd=/install/initrd.gz ks=cdrom:/ks.cfg preseed/file=/cdrom/ks.preseed --
label cloud
  menu label ^Multiple server install with MAAS
  kernel /install/vmlinuz
  append   modules=maas-enlist-udeb vga=788 initrd=/install/initrd.gz quiet --
label check
  menu label ^Check disc for defects
  kernel /install/vmlinuz
  append   MENU=/bin/cdrom-checker-menu vga=788 initrd=/install/initrd.gz quiet --
label memtest
  menu label Test ^memory
  kernel /install/mt86plus
label hd
  menu label ^Boot from first hard disk
  localboot 0x80

Create the ISO:

This command is a modified version of the command shown at http://petersmithphotog.no-ip.biz/wiki/index.php/Unattended_Install. Those instructions do not work for Ubuntu 14.04 because they point to the wrong locations for the file efi.img. (should be in ./boot/grub/ on the ISO)

sudo mkisofs -U -A "Custom1404" -V "Custom1404" -volset "Custom1404" -J -joliet-long -r -v -T -o ../Custom1404.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot .

Verify the ISO has the correct style boot catalogs:

The original ISO you downloaded from Ubuntu:

dumpet -i ~/ubuntu-14.04-server-amd64.iso 

Output:

Validation Entry:
    Header Indicator: 0x01 (Validation Entry)
    PlatformId: 0x00 (80x86)
    ID: ""
    Checksum: 0x55aa
    Key bytes: 0x55aa
Boot Catalog Default Entry:
    Entry is bootable
    Boot Media emulation type: no emulation
    Media load segment: 0x0 (0000:7c00)
    System type: 0 (0x00)
    Load Sectors: 4 (0x0004)
    Load LBA: 8446 (0x000020fe)
Section Header Entry:
    Header Indicator: 0x91 (Final Section Header Entry)
    PlatformId: 0xef (EFI)
    Section Entries: 1
    ID: ""
Boot Catalog Section Entry:
    Entry is bootable
    Boot Media emulation type: no emulation
    Media load address: 0 (0x0000)
    System type: 0 (0x00)
    Load Sectors: 4672 (0x1240)
    Load LBA: 24754 (0x000060b2)

The new ISO you created:

dumpet -i ~/Custom1404.iso 

Output:

Validation Entry:
    Header Indicator: 0x01 (Validation Entry)
    PlatformId: 0x00 (80x86)
    ID: ""
    Checksum: 0x55aa
    Key bytes: 0x55aa
Boot Catalog Default Entry:
    Entry is bootable
    Boot Media emulation type: no emulation
    Media load segment: 0x0 (0000:7c00)
    System type: 0 (0x00)
    Load Sectors: 4 (0x0004)
    Load LBA: 3100 (0x00000c1c)
Section Header Entry:
    Header Indicator: 0x91 (Final Section Header Entry)
    PlatformId: 0xef (EFI)
    Section Entries: 1
    ID: ""
Boot Catalog Section Entry:
    Entry is bootable
    Boot Media emulation type: no emulation
    Media load address: 0 (0x0000)
    System type: 0 (0x00)
    Load Sectors: 4672 (0x1240)
    Load LBA: 1932 (0x0000078c)

You can compare this output to the output you get from an ISO constructed using the instructions at How do I create a completely unattended install of Ubuntu?: (they create an MBR only ISO, not an dual boot catalog ISO)

sudo mkisofs -D -r -V "non-efi-ubuntu" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../non-efi-ubuntu.iso .

Get ISO info:

dumpet -i ~/non-efi-ubuntu.iso 

Output:

Validation Entry:
    Header Indicator: 0x01 (Validation Entry)
    PlatformId: 0x00 (80x86)
    ID: ""
    Checksum: 0x55aa
    Key bytes: 0x55aa
Boot Catalog Default Entry:
    Entry is bootable
    Boot Media emulation type: no emulation
    Media load segment: 0x0 (0000:7c00)
    System type: 0 (0x00)
    Load Sectors: 4 (0x0004)
    Load LBA: 1925 (0x00000785)

UEFI enabled USB Drive

If you want an Installation from USB Medium, you don't need to create a customized ISO first.

Creating UEFI-only booting USB live media is pretty straight forward. Just copy the files to your FAT32-formatted USB drive. That's it! It will be detected as a valid UEFI Boot Medium.

Then you can modify the files directly on the USB Drive.

Source and Details: How to create UEFI-only bootable USB live media?