One of the most fun pastimes coming out of the hacker/hobbyist scene is the Will It Run DOOM? meme.  If you're not familiar with it, this is the informal challenge where people try to get DOOM (the original, ©1993) to run on all manner of computing devices, microcontrollers, etc.  Pretty much the sky is the limit.  There's a great subreddit Will it run DOOM? where people document all the various compute devices, kitchen appliances, and electronic gadgets that have been made to run DOOM.  The craziest is probably this one.

Lucky for us BIOS engineers, GitHub user Cacodemon345 created a DOOM that runs in the UEFI Shell!  In this article, I'll try to get that to work and document the steps I took to get there.  Fun times ahead!

Building DOOM

The GitHub page has instructions for building, but they are imprecise and leave some details out.  I've put together the following list of things you need to do in order to build DOOM, and tried to be as explicit as possible.

  1. install VisualStudio 2015
    • I installed VS2015 Enterprise
    • I only selected "Visual C++" at install; I unchecked all the other components
  2. git clone EDK2
    • git@github.com:tianocore/edk2.git
    • I checked out the latest stable tag, edk2-stable202302
  3. git clone EDK2 LibC
    • git@github.com:tianocore/edk2-libc.git
    • copy the directories (AppPkg, StdLib, etc.) into the edk2 source tree
  4. git clone the UEFI DOOM project
    • git@github.com:Cacodemon345/uefidoom.git
    • I checked out tag 1.4
  5. install NASM
    • https://www.nasm.us/
    • must use the latest, otherwise you risk errors
    • set NASM_PREFIX env variable to point to path to nasm.exe, including a trailing slash
  6. edit the AppPkg.dsc (AppPkg came from step #3 above)
    • add the following line at the end of the [LibraryClasses] list: SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
    • add the path to the .inf file of the DOOM project in the [Components] list like this: AppPkg/Applications/uefidoom/doom.inf
  7. move the "uefidoom" directory from step #4 to AppPkg\Applications
  8. edit Conf/target.txt like:
    • ACTIVE_PLATFORM       = AppPkg/AppPkg.dsc
    • TARGET                = DEBUG
    • TARGET_ARCH           = X64
    • TOOL_CHAIN_TAG        = VS2015x86
  9. open a cmd.exe prompt
  10. run edksetup.bat Rebuild
  11. run build.exe
    • if successful, you'll find doom.efi in edk2\Build\AppPkg\DEBUG_VS2015x86\X64

Running DOOM

If building the file wasn't tricky enough, now there's the issue of getting it to run...

get the DOOM WAD file

I'm not 100% sure which DOOM WAD files will work, and which won't work, but I can tell you I tried the one that I play all the time, and it didn't work.  I found this DOOM 1.9 WAD on archive.org, tried it, and it worked great.

Environments

To run, you launch a UEFI shell, making sure to have doom.efi and doom.wad in the same directory.  I didn't attempt to get audio working.  Cacodemon345's GitHub repo mentions a possible way to get audio, but that will have to wait for another article.  Anyway, simply run doom.efi to start your battle against evil!

This was my experience:
  • UEFI shell run from VMWare Workstation 17 — FAIL
    • got error message launching DOOM.efi
  • UEFI shell run from a Dell Precision workstation — PASS
  • UEFI shell run from QEMU emulator — PASS

So, there we have it!  The UEFI Shell also runs DOOM.  In fact, we could probably add DOOM direct to the boot menu — boot to DOOM!  Anyway, I hope you enjoyed this demonstration of getting DOOM up and running in the UEFI Shell.

Post a Comment

Be sure to select an account profile (e.g. Google, OpenID, etc.) before typing your comment!