-
Notifications
You must be signed in to change notification settings - Fork 80
Adding a driver to a UEFI firmware
The content of this page describes how you an add a new file system EFI driver, such as the ones produced by EfiFs, to an existing UEFI firmware image.
This can be useful for instance if you want to add native NTFS support to an existing UEFI firmware, so that you can boot from NTFS removable media directly.
For this example, we'll be using the NTFS x64 EFI driver ntfs_x64.efi
along VMWare's x64 UEFI firmware, which we'll then run with VMWare Player in 64-bit mode on Windows.
Note however that, if you are planning to modify an actual desktop UEFI firmware, it is possible that your firmware image is signed by the motherboard manufacturer, in which case you might not be able to reflash it. I also take NO RESPONSIBILITY for any damage resulting from trying to modify and reflash a modified UEFI firmware — USE THIS GUIDE AT YOUR OWN RISK!!
- Download and extract the latest
.7z
release of FFS, which is a convenient repackaging of the EDK2'sGenSec
andGenFfs
base tools. - In the directory where you extracted the FFS files, also copy the
ntfs_x64.efi
binary (a version of which can be downloaded here) and then either.
- Call the
GenMod
script provided. This will take care of everything and create a new GUID for you if you don't pass one as parameter:
GenMod ntfs_x64.efi
- Or, if you want to issue the commands manually, and after having generated your own GUID, issue something like:
GenSec -o pe32.sec ntfs_x64.efi -S EFI_SECTION_PE32
GenSec -o name.sec -S EFI_SECTION_USER_INTERFACE -n "Ntfs"
GenSec -o ver.sec -S EFI_SECTION_VERSION -n "1.0"
GenFfs -g "4319CBBA-0980-4245-B511-D1CEFC1FFBEA" -o ntfs_x64.ffs -i pe32.sec -i name.sec -i ver.sec -t EFI_FV_FILETYPE_DRIVER
Either of these should result in a new ntfs_x64.ffs
module having been created in your directory. This .ffs
is a module that you are now able to import in your UEFI firmware.
Note: If you want to know exactly how an ffs driver module is structure, please have a look at the readme from the FFS project.
As detailed in this blog post, if you have VMWare Player 64-bit installed, you should first navigate to C:\Program Files (x86)\VMware\VMware Workstation\x64
and open vmware-vmx.exe
in 7-zip.
There, in .rsrc\1042\BINRES
you will find two 2MB binary resources, the second of which being the X64 UEFI firmware that is of interest to us:
Simply extract this file somewhere as efi64.rom
.
- Download LongSoft's UEFITool (UEFI BIOS Updater) 0.21.5 from here (or any UEFI BIOS editor you prefer). Be mindful that the more recent "NE" versions of UEFITool do not allow editing of a firmware image (issue #67), so make sure you use version 0.21.5.
- Launch the BIOS editing application and open the
efi64.rom
file you previously extracted. - Locate the
Fat
module in the firmware. In the case of the current VMWare application, it should be underUEFI Image
→8C8CE578-8A3D-4F1C-9935-896185C32DD3
→20BC8AC9-94D1-4208-AB28-5D673FD73486
→EE4E5898-3914-4259-9D6E-DC7BD79403CF
→Volume Image Section
→8C8CE578-8A3D-4F1C-9935-896185C32DD3
, with GUID961578FE-B6B7-44C3-AF35-6BC705CD2B1F
.
4. Select Insert After and select the ntfs_x64.ffs
module we previously created.
- Save the firmware back (File → Save Image File) as
efi64_ntfs.rom
.
- Create a new Virtual Machine, or locate an existing one
- Copy
efi64_ntfs.rom
in your Virtual Machine directory - Edit the
.vmx
so that it contains the lines:
firmware = "efi"
efi64.filename = "efi64_ntfs.rom"
- Run the VM (make sure it's running in 64-bit mode, else an unmodified 32-bit EFI firmware will be used!) and try to launch the embedded EFI Shell (by pressing
F2
orDel
until you get into the BIOS):
If you issue drivers
you should be able to see that the NTFS driver was natively loaded:
And if you issue map
and navigate to a volume, you should find that you can access NTFS content: