Skip to content

wrsbin/efi-msvc-edk2

Repository files navigation

efi-msvc-edk2

UEFI application template for Visual Studio using edk2 and MSVC.

Build UEFI applications directly from Visual Studio without needing the edk2 build system for your own code.

Prerequisites

  • Visual Studio 2022 with C++ workload
  • edk2 compiled at C:\edk2 (RELEASE, X64, VS2022)
  • edk2 libraries copied to C:\edk2\build_lib
  • QEMU + OVMF for testing (optional)

For the full edk2 setup guide, refer to the original project.

Building

  1. Open efi-msvc-edk2.sln in Visual Studio.
  2. Set configuration to Release | x64.
  3. Build the solution.
  4. Output: x64\Release\efi-msvc-edk2.efi

Testing with QEMU

mkdir C:\uefi_disk\EFI\BOOT
copy x64\Release\efi-msvc-edk2.efi C:\uefi_disk\EFI\BOOT\
qemu-system-x86_64 -bios "C:\edk2\Build\OvmfX64\RELEASE_VS2022\FV\OVMF.fd" -net none -hda fat:rw:C:\uefi_disk

In the UEFI Shell:

fs0:
efi-msvc-edk2.efi

Adding libraries

To use additional edk2 libraries (e.g. UefiShellLib, UefiHiiServicesLib):

  1. Add the .lib to Linker > Additional Dependencies in project settings.
  2. Add the library constructor to ProcessLibraryConstructorList in efi/AutoGen.c.
  3. Add any missing PCD definitions and GUIDs to the AutoGen files.

Project structure

efi-msvc-edk2/
├── efi-msvc-edk2.sln
├── efi-msvc-edk2.vcxproj
├── efi-msvc-edk2.vcxproj.filters
├── efi-msvc-edk2.vcxproj.user
├── efi/
│   ├── AutoGen.c
│   ├── AutoGen.h
│   └── ShellStrDefs.h
└── src/
    └── main.c

Credits

Based on and inspired by edk2-visualstudio by 0xGREG, which itself was inspired by Alex Ionescu's VisualUefi.

License

MIT

About

UEFI application template for Visual Studio using edk2 and MSVC

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages