This article assumes that you have Visual Studio 2010 installed and that EDKII has been downloaded to C:\edk2
Create New Visual Studio Project
This step's goal is to set up Visual Studio so that it can build the Windows-hosted (NT32) environment
1. Select File->New->Project
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzkccWyf9YLgl2BcxeiM2ou38JE_nVBtaKCTcq9dsp-5GqjOJ0o0uOE5wWq9a2VPN0qmyJDdhtZWeqG7qCy_mxzjjXDvziFkl7MZxEhCM2gotgnvMPFqDrJx5ecw3O-WJLhqqmjA/s320/01.jpg)
3. The Makefile Project Wizard will pop up. Click "Finish."
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGp7eAczEUrqBNQAN0JXznGCJa9XqoKcmHGhkvXL99sKm1M6Q-3F4qfki2hr79MDM-N0qgSxAZ0PbzWj7epCOEn6xl3uDA5_vJmWYLqmDV8wDrlrwbxpQEwu5Vj5fLP0saDWUIsg/s320/01.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyyAq-Jv3h7HAoFvPPMttueJmq3uG9apUaexBjAfKCiWm7IyTCWHBW9MMaueCtVyH-rf4AT3o5iGmyO6bBM_bxyNNMg8uJ9kcWSS04fPXLwmr-Q3dsHWEV9CvxZbrjO0gQK1lEOA/s400/01.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1wqtHbPYJIfQsokHCV6DgxDP9Bw50y_Tq8oRtbpxjfr6KchdPfBlEKIbH65EMfiE-7z0bEE7zsRWoDHu7-fUDxDGPeJ_4oPH8ywsV7dmoyvx2xMKh-hwx0bAOslSMw9eF1F-Dzw/s320/01.jpg)
7. Select "Build Command Line" and click the drop-down arrow on the right. Click "<Edit...>"
8. This will pop up a separate editor box. On three separate lines, enter the following text and click "OK."
cd /D c:\edk2
set WORKSPACE=c:\edk2
call edksetup.bat --nt32
build
9. Now, for "Rebuild All Command Line," enter
cd /D c:\edk2
set WORKSPACE=c:\edk2
call edksetup.bat --nt32
build clean
build
10. For "Clean Command Line," enter
cd /D c:\edk2
set WORKSPACE=c:\edk2
call edksetup.bat --nt32
build clean
11. Click "OK."
12. Edit target.txt, which is located in C:\edk2\Conf, and change TOOL_CHAIN_TAG = VS2010x86. By default, it is set to MYTOOLS, which builds in Visual Studio 2008 and will cause build errors.
Launching the Windows-Hosted Environment
At this point, you should be able to build by selecting Build->Build Solution (or using F7). You can run the emulated environment by going to the command prompt and typing:
cd /d c:\edk2\Build\NT32\DEBUG_VS2010x86\IA32
SecMain.exe
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1Ec3IZPQjXLbzLcUShbNE-myBLgsnr7auzyLJC803xLtsb_Vl6yy9g382ao0Rw3bc4BWIsjzrRqGlAqTASFNRJdcrbjNv0uwo5xh3dC3OBvE-WisXSUn12taoh9UWIz_a6sHB8Q/s320/02.jpg)
Conclusion
That gets us past the first step. Next time, we'll show how to set up the debugger and make the code debugger-friendly in VS 2010.
6 comments:
Nice tutorial - I'll try to use it. BTW: Do you know where 'build' command on Linux ? [ http://askubuntu.com/questions/204093/where-can-i-find-the-build-command-needed-to-build-the-environment-for-edk-2 ] ???
For Linux, you need to invoke 'build' using Python. See BaseTools/Source/Python/build/build.py.
Hi Tim,
How to compile Nt32pkg with x64 architecture? Is it possible?
Currently, there is no 64-bit emulation environment under Windows on TianoCore (there is a Unix one is EmulatorPkg).
The current Nt32Pkg is hard-coded to 32-bits in many places. There is some 32-bit assembly language. It is about 4-5 days work to move it over (I've done it for my company)
Hello! How to set the path to the header file?
Post a Comment