Getting Started Writing Simple Application - jljusten/tianocore GitHub Wiki
How to Write a Simple EDK II UEFI Application
e.g. mkdir edk2
- Latest EDK II source from following Instructions on Step by step instructions
- i.e. example >git clone https://github.com/tianocore/edk2.git
Run edksetup --nt32 script from the command line prompt at the Work Space directory
- Windows Comand Prompt: C:\edk2> edksetup --nt32
- Linux like: bash$ . edksetup.sh BaseTools
Modify TARGET_ARCH and TOOL_CHAIN_TAG as required.
- TOOL_CHAIN_TAG see:
- Windows Windows systems ToolChain Matrix
- Newer versions of LinuxUsing EDK II with Native GCC
- Older Linux distributions Unix-like systems
- Mac OS X Xcode
- TARGET_ARCH - Optional can also use "-a" on the BUILD command line
- Both IA32 and X64 : TARGET_ARCH = IA32 X64
- Just X64 : TARGET_ARCH = X64
- On the commnad line overriding the target.txt: BUILD -a X64
- Create a new directory. Can be a directory anywhere within the Work Space Directory (e.g. C:\edk2\MyHelloWorld or ~/src/edk2/MyHelloWorld)
- Create a .c file in the project directory (see example: MyHelloWorld.c)
- Create a .inf file in the project directory (see examle: MyHelloWorld.inf)
- Update an existing platform .DSC file with your project .inf file. The following list some examples.
- Edit the DuetPkg/DuetPkgX64.dsc and add your new application to the the [Components] section and before the [BuildOptions] section. (e.g. MyHelloWorld/MyHelloWorld.inf )
- Invoke the Build
- At the command prompt > Build -a X64 -p DuetPkg/DuetPkgX64.dsc
- Final Output .efi file will be in the directory WorkSpace/Build/DuetPkg/DEBUG_$(TOOL_CHAIN_TAG)/X64
- Since this is the default as per the target.txt Update the Nt32Pkg/Nt32Pkg.dsc file.
- Edit the Nt32Pkg/Nt32Pkg.dsc and add your new application to the the [Components] section and before the [BuildOptions] section. (e.g. MyHelloWorld/MyHelloWorld.inf )
- Invoke the Build
- At the command prompt > Build
- Final Output .efi file will be in the directory WorkSpace/Build/NT32/DEBUG_$(TOOL_CHAIN_TAG)/IA32
- Test with Windows NT 32 emulation: command prompt > Build Run