Platform Build Windows Emulator Lab
tianocore.org
- Pin Visual Studio Command Prompt to Windows Task Bar
- Build a EDK II Platform using Emulator package
- Run the Emulator in Windows
Pin the Visual Studio Command prompt to Windows
Task Bar
Windows 10
Steps to Pin Visual Studio Command Prompt to task bar for Windows 10
- Using the Start menu in Windows 10, Left Click on "Windows Key" Lower Left
- Scroll down from the scroll bar on the right until "Visual Studio 201n"
- Left Click "Visual Studio 201n"
- Left Click "Visual Studio Tools"
This will open another Windows file explorer window
Note: VS 2013 example, other version of VS maybe different
-
Select "Developer Command Prompt for VS201n"
-
Right Click to open Windows dialog box
Do not use any of the other
".. Command Prompts"
- Left Click on
"Pin to to taskbar"
- Open the VS Command Prompt
All Windows Labs use this short-cut to Build Edk II platforms and projects using Windows Visual Studio
(2010 / 2012 / 2013 / 2015/ 2017 or 2019)
## End Pin VS Prompt
Setup EmulatorPkg to build and run emulation
w/ Windows
Prerequisites
- Done Before Class
- Windows 10:
- Continuous Integration (CI) - Stuart CI Build with Visual Studio VS2017 or VS2019
- Non Stuart CI - Visual Studio VS2015, VS2017 or VS2019
- Windows SDK (for rc)
- Windows WDK (for Capsules)
- Python 3.7.x or greater and /Scripts directories on Path: Link to download
- Git for Windows on Path : Link
- NASM for Win64 : Link
Create Work Space Directory
Open a Windows command prompt
Make new directory for Work Space:
$ cd /
$ Mkdir FW
$ cd FW
$ Mkdir edk2-ws
$ cd edk2-ws
Note: if behind a firewall, set PROXYS FIRST
$ git config --global https.proxy proxy-dmz.intel.com:912
$ git config --global http.proxy proxy-dmz.intel.com:911
C:\FW\edk2-WS> git clone -b Edk2Lab_22Q1 https://github.com/tianocore-training/edk2.git
C:\FW\edk2-WS> git clone https://github.com/tianocore/edk2-libc.git
Download the Submodules and Checkout the Lab Branch
C:\FW\edk2-wS> cd edk2
C:\FW\edk2-wS\edk2> git submodule update --init
C:\FW\edk2-wS> cd ..
Download the Lab_Material_FW.zip from : github.com Lab_Matrial_FW.zip
OR
Use git clone
to download the Lab_Material_FW
C:\> git clone https://github.com/tianocore-training/Lab_Material_FW.git
Directory Lab_Material_FW will be created
FW
- Documentation
- DriverWizard
- edk2-ws
- edk2Linux
- LabSampleCode
- Nasm
Build EDK II
- Extract the Source
Extract the Downloaded Lab_Material_FW-main.zip to C:\
Note: Extract the Downloaded Lab_Material_FW.zip to C:\ (this will create a directory FW )
Build EDK II
- Copy edk2-ws
From the downloaded Lab_Material_FW folder,
copy and paste folder "..\edk2-ws"
to "C:/FW"
Note: Overwrite existing files and directories
Build EDK II
- Get Nasm
Copy Nasm
directory to C:\
(creating C:\Nasm
directory)
OPTIONAL
SKIP if doing Non-Stuart CI Build
- CD C:\FW\Edk2-ws and run setup script to setup
WORKSPACE
and Packages path
$ cd C:\FW\edk2-ws
$ Setenv.bat
$ cd edk2
The following are invoked in C:\FW\edk2-ws\edk2 directory
- Install the pip requirements (Note, Proxy option needed behind a firewall)
$ pip install --upgrade -r pip-requirements.txt --proxy http://proxy-chain.intel.com:911
- Get the code dependencies (done only when submodules change)
$ stuart_setup -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<Your TAG> -a X64
- Update other dependencies (done on new VS Command Prompt)
$ stuart_update -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<Your TAG> -a X64
- Build the BaseTools (done only when BaseTools change and first time)
$ python BaseTools\Edk2ToolsBuild.py -t <Your TAG>
- Compile the EmulatorPkg
$ stuart_build -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<Your TAG> -a X64 BLD_*_ADD_SHELL_STRING=1 BLD_*_WORKSPACE=%WORKSPACE%
Where "<Your TAG>
" is either VS2017
or VS2019
Output from CI Stuart Build
INFO - - Done -
INFO - Build end time: 13:17:07, Jul.27 2020
INFO - Build total time: 00:01:33
INFO -
INFO - ------------------------------------------------
INFO - --------------Cmd Output Finished---------------
INFO - --------- Running Time (mm:ss): 01:33 ----------
INFO - ----------- Return Code: 0x00000000 ------------
INFO - ------------------------------------------------
PROGRESS - Running Post Build
DEBUG - Plugin Success: Windows RC Path Support
DEBUG - Plugin Success: Windows Visual Studio Tool Chain Support
INFO - Writing BuildToolsReports to C:\FW\edk2-ws\edk2\Build\EmulatorX64\DEBUG_VS2017\BUILD_TOOLS_REPORT
DEBUG - Plugin Success: Build Tools Report Generator
PROGRESS - End time: 2020-07-27 13:17:07.515485 Total time Elapsed: 0:01:37
SECTION - Log file is located at: C:\FW\edk2-ws\edk2\Build\BUILDLOG_EmulatorPkg.txt
SECTION - Summary
PROGRESS - Success
SKIP if doing Stuart CI Build
Non Stuart CI Build EDK II
- build
BaseTools
Open VS Command prompt & Cd to work space directory
$> cd C:\FW\edk2-ws
Setup the local environment: (see batch file setenv.bat )
$> set WORKSPACE=%CD%
$> set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-libc
Invoke Edksetup.bat from directory C:/FW/edk2-ws/edk2 to Build BaseTools
$> cd edk2
$> edksetup.bat Rebuild
Building BaseTools only needs to be done once but setting up local environment and edksetup.bat needs to be done each new VS prompt session
SKIP if doing Stuart CI Build with VS2017 or VS2018
Non Stuart CI Build EDK II
- Update
Target.txt
Invoke Edksetup.bat
$> cd C:\FW\edk2-ws\edk2
$> edksetup.bat
notepad Conf/target.txt
Update the following define statements
TARGET_ARCH = X64
. . .
TOOL_CHAIN_TAG = <see table below>
Use the following for TOOL_CHAIN_TAG:
VS Version | TOOL_CHAIN_TAG | |
---|---|---|
2015 | VS2015x86 | |
2017 | VS2017 | |
2019 | VS2019 | |
$> build -D ADD_SHELL_STRING -a X64
Possible Build Errors
- If you get a BUILD Error: Error "C:/Program " not found
- First check that you have opened Visual Studio and installed the "C++"
- Open Visual Studio and create a "C++" project
- (This will take some time to install)
- If you get a BUILD Error: Check if RC.Exe compiler not found is the error goto slide 36 https://github.com/tianocore-training/Presentation_FW/blob/main/FW/Presentations/Lab_Guides/_C_01_Platform_Build_Win_Emulator_Lab_guide.md#slide-36--titlebuild-error--rcexe-
- If you get a BUILD Error: fatal error C1041: cannot open program database goto slide 38 https://github.com/tianocore-training/Presentation_FW/blob/main/FW/Presentations/Lab_Guides/_C_01_Platform_Build_Win_Emulator_Lab_guide.md#slide-38--titlebuild-error--c1041-38
Build EDK II
- Inside VS Prompt
Finished build
Invoke Emulation
From the command prompt
$> RunEmulator.bat
OR
run `WinHost.exe` from:
%WORKSPACE%/Build/EmulatorX64/DEBUG_VS20nn/X64
directory (where "nn" is the Visual Studio Version)
Notice 2 "GOP Window n" opened
Emulator at Shell Prompt
Type: "Reset" to exit
- Pin Visual Studio Command Prompt to Windows Task Bar
- Build a EDK II Platform using Emulator package
- Run the Emulator in Windows
Questions
Return to Main Training Page
Return to Training Table of contents for next presentation link
/**
Redistribution and use in source (original document form) and 'compiled' forms (converted
to PDF, epub, HTML and other formats) with or without modification, are permitted provided
that the following conditions are met:
Redistributions of source code (original document form) must retain the above copyright
notice, this list of conditions and the following disclaimer as the first lines of this
file unmodified.
Redistributions in compiled form (transformed to other DTDs, converted to PDF, epub, HTML
and other formats) must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the
distribution.
THIS DOCUMENTATION IS PROVIDED BY TIANOCORE PROJECT "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TIANOCORE PROJECT BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
Copyright (c) 2020, Intel Corporation. All rights reserved.
**/
##### Build Errors
Build Error- RC.exe Because RC.Exe is not found, Error Message:
"c:\Program Files (x86)\Windows Kits\8.0\bin\x64\rc.exe"
/Foc:\edkii.svn\Build\NT32IA32\DEBUG_VS2013x86\IA32\MdeModulePkg\Application\HelloWorld\HelloWorld\OUTPUT
\HelloWorldhii.lib
c:\edkii.svn\Build\NT32IA32\DEBUG_VS2013x86\IA32\MdeModulePkg\Application\HelloWorld\HelloWorld\OUTPUT\He
lloWorldhii.rc
'c:\Program' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Windows Kits\8.0\bin\x64\rc.exe' : return code '0x1'
Stop.
Find where the RC.EXE is located on your VS Installation:
Example (VS 2013): The RC.exe is located on this machine:
C:\Program Files (x86)\Windows Kits\8.1\bin\x64
Edit Conf/tools_def.txt
Build Error- RC.exe Cont...
Edit Conf/tools_def.txt
Search for your installation of Visual Studio (2013 or 2015)
Update according to the path for where the RC.EXE is found
# Microsoft Visual Studio 2013 Professional Edition
DEFINE WINSDK8_BIN = c:\Program Files\Windows Kits\8.1\bin\x86\
DEFINE WINSDK8x86_BIN = c:\Program Files (x86)\Windows Kits\8.1\bin\x64
# Microsoft Visual Studio 2015 Professional Edition
DEFINE WINSDK81_BIN = c:\Program Files\Windows Kits\8.1\bin\x86\
DEFINE WINSDK81x86_BIN = c:\Program Files (x86)\Windows Kits\8.1\bin\x64
> Set
Then See what the value of WINSDK10_PREFIX is. This is probably the problem. Search your directory "C:\Program Files (x86)" for the file rc.exe The one you want will be in C:\Program Files (x86)\Windows Kits\10\bin\x86
see below for the define:
From : DEFINE WINSDK10_BIN = ENV(WINSDK10_PREFIX)DEF(VS2017_HOST)
to : DEFINE WINSDK10_BIN = C:\Program Files (x86)\Windows Kits\10\bin\x86
Build Error: fatal error C1041: Build Error from fatal error C1041: cannot open program database
This Error is usually because the location you are building is being shared by another application in Windows. Example: Syncplicity may cause this
Error Message:
k:\fw\edk2\MdePkg\Library\BaseLib\LinkedList.c : fatal error C1041: cannot open program
database
'k:\fw\edk2\build\nt32ia32\debug_vs2013x86\ia32\mdepkg\library\baselib\baselib\vc120.pdb'; if
multiple CL.EXE write to the same .PDB file, please use /FS
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
12.0\Vc\bin\cl.exe"' : return code '0x2'
Stop.
Solution: Try using a Workspace that is not shared