If you want to use C library in your program such as: printf, scanf....... You should use EADK library in EDK2.
1.Decompress EADK_A2_Release. There are 3 directories. Put them to your EDK2 source directory. In fact you should make sure your EDK2 can build and run NT32 well.
2.Run edksetup.bat in your EDK directory.
3.You can build EADK_A2_Release by using
build -a IA32 -p AppPkg\AppPkg.dsc
3.You well get the first error message.(AppPkg.dsc error 000E)
4.You should modify AppPkg.dsc as below as we just want to test program under NT32:
[LibraryClasses.IA32]
# TimerLib|PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf
## Comment out the above line and un-comment the line below for running under Nt32 emulation.
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
5.Build again and your will get the second error message (time.h Error C2220)
6.The solution is simple. Use the Notepad to open the time.h and save again.
7.At last all the demos can be build. You can get main.efi hello.efi and Enquire.efi. They can be run in NT32 emulation environment.
They will be placed at "\Build\AppPkg\DEBUG_VS2008\IA32" after compiling. And you can copy them to "\Build\NT32\DEBUG_VS2008\IA32". After that they can be seen under fsnt0:
8.You can use printf in your program now. Ex.
int
EFIAPI
main (
IN int Argc,
IN char **Argv
)
{
puts("Hello there fellow Programmer.");
puts("Welcome to the world of EDK II.");
printf("lab-z.com %x\n",8212);
return 0;
}
<2016> I find it seems to be hard to download an EADK package from internet, and I put one here EadkPkg_A2
reference:
1.http://www.lab-z.com/step-to-uefi-shell-6-shell-%E4%B8%AD%E4%BD%BF%E7%94%A8-float/
2.http://biosren.com/viewthread.php?tid=5651&fromuid=6339]http://biosren.com/viewthread.php?tid=5651&fromuid=6339 .UEFI 实战(1) 配置开发环境
分享一下,如果沒有錢買VSS2008, 可以去Download 完全free 的 "Visual Studio Ultimate 2013 with Update 4",然後更改以下之設定 (我的OS 是Win8.1)
1. Conf\target.txt
ACTIVE_PLATFORM = AppPkg/AppPkg.dsc
TARGET_ARCH = X64
TOOL_CHAIN_TAG = VS2012x86
2.Conf\tools_def.txt
*_MYTOOLS_*_ASM16_PATH = DEF(VS2012_BIN)\ml.exe
將 VS2010 改成 VS2012
將10.0 改成 12.0
3.改完就可以 build -a X64 -p AppPkg\AppPkg.dsc
"Visual Studio Ultimate 2013 with Update 4",
http://www.visualstudio.com/downloads/download-visual-studio-vs
搭建环境对于新手来说是很难的一件事,我按照你说的做,会遇到和你不一样的问题,可能是我系统环境变量和你设置的不一样。我就不知道该怎么解决了~~~~
Since UDK2015 is already release. so removed the UDK2010 and added UDK2015 packaged to EADK compiler environment.
1. To download below packages
EADK: EadkPkg_B1.02_Release.zip
https://sourceforge.net/projects/edk2/files/EDK%20II%20Releases/EADK/EADK_1.02/EadkPkg_B1.02_Release.zip/download
EDKII: UDK2015.Complete.MyWorkSpace.zip
https://sourceforge.net/projects/edk2/files/UDK2015_Releases/UDK2015/UDK2015.Complete.MyWorkSpace.zip/download
MdePkg 1.00 : MdePkg.zip
https://sourceforge.net/projects/edk2/files/EDK%20II%20Releases/MdePkg%201.00/MdePkg.zip/download
EDK II Shell : EDKII_UEFI_Shell_2.0_ShellPkg_Rel_1.0.zip
https://sourceforge.net/projects/edk2/files/EDK%20II%20Releases/EDK%20II%20Shell/EDKII_UEFI_Shell_2.0_ShellPkg_Rel_1.0.zip/download
2.install Visual studio 2013_U5()
Since UDK2017 is already resale. please refer to below link to setup compiler environment. Thanks!
http://bios.rewolf.net/2017/05/uefi-compiler-environment-setup-step-by.html