A guide for building UEFI application to interact with TPM 2.0.
- Prerequisites
- References
- Create USB Bootable with UEFI Shell (64-bit)
- Build UEFI Applications
- Build Custom UEFI Application
- References
- License
- A Ubuntu machine (Ubuntu 20.04.2 LTS) for cross-compilation
- A 64-bit PC with TPM 2.0 and UEFI
- Format your media as FAT32
- Create directory structure
/efi/boot
in your media - Download the UEFI shell binary ([2]) and rename the it to
Bootx64.efi
- Copy the binary to
/efi/boot
- Insert the media to your PC and configure the UEFI to boot from it
- Eventually, you will see the UEFI shell
$ sudo apt install build-essential uuid-dev iasl git nasm python-is-python3
$ git clone -b edk2-stable202202 https://github.com/tianocore/edk2 ~/edk2
$ cd ~/edk2
$ git submodule update --init
# Compile build tools
$ cd ~/edk2
$ make -C BaseTools
$ . edksetup.sh BaseTools
# Setup build shell environment
$ cd ~/edk2
$ export EDK_TOOLS_PATH=~/edk2/BaseTools
$ . edksetup.sh BaseTools
Build Hello World:
$ cd ~/edk2
$ build -p MdeModulePkg/MdeModulePkg.dsc -t GCC5 -a X64 -n $(nproc)
$ ls Build/MdeModule/DEBUG_*/*/HelloWorld.efi
Copy the HelloWorld.efi
to the media you created and execute it in the UEFI shell.
For demonstration purpose, reuse the HelloWorld example and apply this patch.
[1] https://github.com/tianocore/edk2/
[2] https://github.com/tianocore/edk2/blob/UDK2018/ShellBinPkg/UefiShell/X64/Shell.efi
This project is licensed under the MIT License - see the LICENSE file for details.