Home News How to Support Both Legacy BIOS and UEFI in PXE Boot?

How to Support Both Legacy BIOS and UEFI in PXE Boot?

Inspect DHCP Option 93 (Client System Architecture Type) to hand out undionly.kpxe to Legacy BIOS hosts and ipxe.efi to x86_64 UEFI hosts, then chainload a single HTTP iPXE script when the client identifies as iPXE. Pair that with firmware-aware disk partitioning and bootloaders in your unattended OS templates.

By TNTCloud Team Published 26 Nov 2026 Updated 26 Nov 2026 Guides

How to Support Both Legacy BIOS and UEFI in PXE Boot?

Why does a single PXE boot file fail across mixed servers?

Datacenters rarely run one firmware generation. Older servers and certain IPMI virtual media setups still boot in Legacy BIOS mode, while modern racks default to UEFI (often with IPv4/IPv6 PXE and Secure Boot considerations). A BIOS host cannot execute an EFI binary (ipxe.efi), and a UEFI host cannot execute a 16-bit PXE NBP (undionly.kpxe). In a TNTCloud PXE provisioning workflow, dual-mode support solves this at three layers: DHCP firmware detection, unified iPXE HTTP scripting, and firmware-aware OS templates.

1. Detect firmware mode with DHCP Option 93

Every PXE client sends its architecture code in DHCP Option 93 (Client System Architecture Type, RFC 4578) during the initial DHCPDISCOVER. Your DHCP server simply maps Option 93 plus the iPXE user-class to the right boot stage:

  • iPXE already running (Option 77 / user-class = "iPXE"): Return the HTTP boot script URL (for example, http://pxe.example.local/boot.ipxe) instead of looping back into TFTP.
  • Option 93 = 0x0000 (x86 Legacy BIOS): Serve undionly.kpxe over TFTP.
  • Option 93 = 0x0007 or 0x0009 (x86_64 UEFI): Serve ipxe.efi over TFTP.
  • Option 93 = 0x000b (ARM64 UEFI): Serve arm64-efi/ipxe.efi over TFTP.

Because the DHCP server inspects Option 93 dynamically per request, you never have to flip global server settings or maintain separate VLANs for BIOS and UEFI machines.

2. Unify boot scripts with iPXE ${platform}

Once undionly.kpxe or ipxe.efi loads, both environments speak HTTP and share one iPXE script format. Inside iPXE, the built-in variable ${platform} evaluates to pcbios on Legacy BIOS and efi on UEFI:

#!ipxe
echo Booting host ${mac} in ${platform} mode
iseq ${platform} efi && goto uefi || goto bios

:uefi
kernel http://pxe.example.local/vmlinuz initrd=initrd.img ip=dhcp
initrd http://pxe.example.local/initrd.img
boot

:bios
kernel http://pxe.example.local/vmlinuz initrd=initrd.img ip=dhcp
initrd http://pxe.example.local/initrd.img
boot

Notice an important UEFI rule for Linux: the kernel must be built with CONFIG_EFI_STUB=y, and iPXE must pass initrd=initrd.img on the kernel command line so the EFI stub locates the initramfs in memory.

3. Handle disk partitioning and bootloaders per firmware

Booting the installer in the right mode is only half the job—the OS installer must also lay down a matching partition table so the server boots from local disk after reboot:

  • Linux (Debian/Ubuntu/Rocky): UEFI requires a GPT disk with a FAT32 EFI System Partition (/boot/efi, typically 200–512 MB). Legacy BIOS on GPT requires a small bios_grub partition (1–2 MB, unformatted) for GRUB stage 1.5, or an MBR partition table. Many templates detect /sys/firmware/efi in a pre-install script and emit the matching partition layout automatically.
  • Windows (WinPE + Setup): In UEFI mode, DiskPart must initialize the disk as convert gpt with an EFI System Partition (format quick fs=fat32) and MSR partition; in Legacy BIOS mode, it uses MBR with an active system partition. Using wimboot with iPXE works in both pcbios and efi modes when the matching bootmgr / bootmgfw.efi is included.

4. Avoid common dual-mode PXE pitfalls

  1. Missing user-class check causes infinite TFTP loops: If DHCP serves undionly.kpxe or ipxe.efi even when iPXE sends the second DHCP request, the host will reload iPXE forever. Always match user-class == "iPXE" first.
  2. UEFI Secure Boot enabled on unsigned ipxe.efi: Standard upstream ipxe.efi is unsigned. Either disable Secure Boot on bare-metal nodes during provisioning or chainload a distro-signed shimx64.efi + GRUB2.
  3. ProxyDHCP conflicts: If an existing network DHCP server already sets next-server, a ProxyDHCP server can clash on UEFI clients unless Option 60/93 handling is tested on your switch/NIC firmware.

Tags: PXEUEFILegacy BIOSiPXEDHCP Option 93Bare metal

Questions worth asking first

Can one DHCP server serve both Legacy BIOS and UEFI PXE clients at the same time?

Yes. By matching DHCP Option 93 (0 for BIOS, 7 or 9 for x86_64 UEFI) alongside the iPXE user-class option, a single DHCP service dynamically sends the right NBP to each host.

Why does UEFI iPXE fail to boot a Linux kernel with 'VFS: Unable to mount root fs'?

In UEFI mode, iPXE boots the Linux kernel via its EFI stub, which requires initrd=<filename> explicitly on the kernel command line to find the initramfs loaded by the initrd command.

Should I format disks as MBR or GPT when supporting both modes?

Use GPT with an EFI System Partition (/boot/efi) for UEFI hosts, and either MBR or GPT with a 1–2 MB bios_grub partition for Legacy BIOS hosts. Detecting /sys/firmware/efi during install lets one template handle both.

Does wimboot work for Windows PXE installs in both Legacy BIOS and UEFI?

Yes. Modern wimboot supports both pcbios and efi platforms in iPXE as long as the WinPE image includes the corresponding BIOS and EFI boot files.

← All news