[ipxe-devel] [PATCH 0/4] Local UEFI disk boot support

Aaron Young Aaron.Young at oracle.com
Wed Jan 9 19:35:38 UTC 2019

This patch series adds support to boot a locally attached
UEFI disk. The disk must installed with a EFI System Partition
and filesystem.

This improves upon the current solution to boot a local UEFI
disk from iPXE - which requires one to exit out of iPXE to fallback
into the EFI boot manager. This solution allows iPXE to boot a
UEFI disk directly and stay in control when the booted OS returns/exits.

Example syntax to boot a local UEFI disk:

> sanboot --no-describe --drive 0 --filename \EFI\redhat\grubx64.efi

This syntax is very similar and consistent with the
syntax currently used to boot a local legacy HDD, i.e.:

> sanboot --no-describe --drive 0x80

The extra --filename argument is required for UEFI as the UEFI
spec allows the bootloader to be located in non-standard
locations on the disk. The --filename is optional and if omitted,
the standard spec defined default filepath will be used, e.g.
\EFI\BOOT\BOOTX64.efi on x86_64.

This patch series also includes a new efimap command which
displays a map of all locally attached UEFI filesystems.
Example output of the efimap command is as follows:

iPXE> efimap                             
Drive#	Path
------	----
0     	PciRoot(0x0)/Pci(0x3,0x0)/HD(2,MBR,0x2E0E0369,0xBBC,0x3708)
1     	PciRoot(0x0)/Pci(0x4,0x0)/HD(1,GPT,F82F29A0-...,0x800,0x64000)
2     	PciRoot(0x0)/Pci(0x5,0x0)/HD(1,GPT,F82F29A0-...,0x800,0x64000)
3     	PciRoot(0x0)/Pci(0x6,0x0)/HD(1,GPT,F82F29A0-...,0x800,0x64000)
4     	PciRoot(0x0)/Pci(0x7,0x0)/HD(1,GPT,F82F29A0-..,0x800,0x64000)

The mappings are:  drive# -> EFI device path.

The drive# can be passed as an argument to the sanboot command
--drive option to specify which disk/filesystem to boot.

Note that the mappings are sorted by device path which gives a
PCI BDF ordering as the device paths typically begin with
PciRoot()/Pci() nodes. This sorting will help to give a consistent
mapping between boots.

This patchset was testing in a virtual/cloud environment with QEMU
attached PV disks and also on a baremetal system.

NOTE: the first patch in the series corrects the implementation
of strcmp() and strncmp() to return the proper standard values
for unequal strings. strncmp() is used to sort the device paths
in the efimap command output/mappings. See the patch for more details.

Aaron Young (4):
  Fix strcmp()/strncmp() to return proper values
  Implement scaffolding for new efimap command
  Call efi_boot_local() from efi_block_boot()
  Complete implementation of efi_boot.c

 src/config/config_efi.c       |   9 +
 src/config/general.h          |   1 +
 src/core/string.c             |   6 +-
 src/hci/commands/efimap_cmd.c |  77 +++++++++
 src/include/usr/efiboot.h     |  15 ++
 src/interface/efi/efi_block.c |   8 +-
 src/interface/efi/efi_boot.c  | 375 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 487 insertions(+), 4 deletions(-)
 create mode 100644 src/hci/commands/efimap_cmd.c
 create mode 100644 src/include/usr/efiboot.h
 create mode 100644 src/interface/efi/efi_boot.c


More information about the ipxe-devel mailing list