In case you are not familiar with EFI/UEFI, it is very much possible to run EFI even on legacy (i.e. non EFI) hardware, through a process called DUET, which provides a complete EFI emulation layer using the underlying BIOS. This is great for testing, without having to modify your hardware in any way.
It is all provided by the DuetPkg of the EDK2. However, the main issue with EDK2 is that it may be a difficult to get working, unless you used the same development tools as the EDK2 developers, which, on Windows would default to Visual Studio 2008, which is not free.
Isn't there simple way to use freely available tools on Windows, to easily compile a DUET USB bootstick?
Glad you asked. There is now, and here is the complete process that goes with it:
- Download and install the Windows Server 2003 WinDDK, v3790.1830, using this direct link (230 MB ISO download). This is of course not the latest DDK but unless you want to waste time in extra configuration, you might as well go with the supported version. If I find the time to fix EDK2 for the latest, I may send another patch to the EDK2 team, but for now, this will have to do.
- (Optional) If you plan to use ASL to compile ACPI, which isn't needed for DUET, create a
C:\ASLdirectory, download the Microsoft ASL Assembler/Compiler archive from here, open the .exe with 7-zip. Then open the .msi from the .exe (Open Inside), find the file_C6C6461BF87C49D66033009609D53FA5, extract it to yourC:\ASLdirectory and rename itasl.exe(count on Microsoft to provide an installer... for a mere 55 KB exe). Also note that the ASL compiler is for 32 bit only. If you're running 64 bit, tough luck. - Mount or burn the ISO and install the WinDDK, to the default
C:\WINDDK\3790.1830directory. - If needed, download and install TortoiseSVN, or any other SVN client.
- Fetch the latest EDK2 from SVN, using https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2 as the SVN repository.
- Open a DDK console ("Development Kits" → "Win2k3 Free x64 Build Environment" or "Win2k3 Free x86 Build Environment") and navigate to your
edk2direcvtory - Run the command:
edksetup.bat
This will initialize your environment by creating the required files in theConf\directory. You can safely ignore the warning about cygwin. - Open the file
Conf\target.txtand edit theTOOL_CHAIN_TAGline to have:
TOOL_CHAIN_TAG = DDK3790xASL
You also may want to changeMAX_CONCURRENT_THREAD_NUMBERand make sureTARGET_ARCHis properly set to eitherIA32orX64according to your needs, as it avoids having to provide extra arch parameter when invoking the commands below). - In the console, run (32 bit):
build -p DuetPkg\DuetPkgIA32.dsc
or (64 bit)
build -p DuetPkg\DuetPkgX64.dsc
It may take a while but it should complete successfully. - cd to
DuetPkg\and run:
PostBuild.bat - Plug in your USB key and check its drive letter. In the following I will assume it is
F:, and run:
CreateBootDisk.bat usb F: FAT16 - Unplug and replug the key as requested, and run:
CreateBootDisk.bat usb F: FAT16 step2
Note that if you rebuild any of the packages, you only have to perform the last step to update the key.