Creating a UEFI Bootable ISO with a 64-bit EFI File in Hyper-V
In this article, we will discuss the process of creating a UEFI bootable ISO image containing a 64-bit EFI file. This is a useful technique for testing UEFI-based bootloaders and operating systems in a virtualized environment using Hyper-V. We will cover the key concepts and provide detailed, step-by-step instructions for creating the ISO image.
Prerequisites
To follow along with this article, you will need the following:
- A 64-bit version of Windows 10 or Windows Server 2016 or later
- The Hyper-V role enabled on the host system
- A sample UEFI application with a bootx64.efi file
Creating the Bootable ISO
To create a UEFI bootable ISO image containing a 64-bit EFI file, you will need to use a tool such as oscdimg.exe, which is included with the Windows ADK. You can download the Windows ADK from the Microsoft website.
Once you have the ADK installed, you can use the following steps to create the ISO image:
- Create a new directory and copy the
bootx64.efifile into it. - Create a new file named
efi.cfgin the same directory with the following contents:# This is a sample configuration file for a UEFI bootable ISO image [default] bootx64.efiThis configuration file tells the UEFI firmware to load the
bootx64.efifile when the ISO image is booted. - Open an elevated command prompt and navigate to the directory containing the
bootx64.efifile and theefi.cfgfile. - Run the following command to create the ISO image:
oscdimg -n -m -bbootx64.efi -ufd efi.cfg -ul . isoimage.iso .This command creates an ISO image named
isoimage.isocontaining thebootx64.efifile and theefi.cfgfile. The-noption tellsoscdimg.exeto create a non-bootable ISO image, while the-moption tells it to include the Microsoft boot sector. The-boption specifies the boot file, and the-ufdoption specifies the configuration file. The-uloption tellsoscdimg.exeto include all files in the current directory.
Testing the ISO Image in Hyper-V
Once you have created the ISO image, you can test it in Hyper-V by following these steps:
- Create a new virtual machine in Hyper-V.
- In the "Firmware" section of the "New Virtual Machine" wizard, select "UEFI".
- In the "Optical Drive" section, select "ISO Image" and browse to the location of the ISO image you created.
- Complete the wizard and start the virtual machine. The virtual machine should boot from the ISO image and load the
bootx64.efifile.
In this article, we discussed the process of creating a UEFI bootable ISO image containing a 64-bit EFI file. We covered the key concepts and provided detailed, step-by-step instructions for creating the ISO image using the oscdimg.exe tool from the Windows ADK. We also showed how to test the ISO image in Hyper-V.