]>
Commit | Line | Data |
---|---|---|
951a0353 SB |
1 | # EmulatorPkg - Platform CI\r |
2 | \r | |
3 | This ReadMe.md describes the Azure DevOps based Platform CI for EmulatorPkg and how\r | |
4 | to use the same Pytools based build infrastructure locally.\r | |
5 | \r | |
6 | ## Supported Configuration Details\r | |
7 | \r | |
8 | This solution for building and running EmulatorPkg has only been validated with Windows 10\r | |
9 | with VS2019 and Ubuntu 18.04 with GCC5 toolchain. Two different firmware builds are\r | |
10 | supported and are described below.\r | |
11 | \r | |
12 | | Configuration name | Architectures | DSC File |Additional Flags |\r | |
13 | | :---- | :----- | :---- | :---- |\r | |
14 | | IA32 | IA32 | EmulatorPkg.dsc | None |\r | |
15 | | X64 | X64 | EmulatorPkg.dsc | None |\r | |
16 | \r | |
17 | ## EDK2 Developer environment\r | |
18 | \r | |
19 | - [Python 3.8.x - Download & Install](https://www.python.org/downloads/)\r | |
20 | - [GIT - Download & Install](https://git-scm.com/download/)\r | |
21 | - [Edk2 Source](https://github.com/tianocore/edk2)\r | |
22 | - For building Basetools and other host applications\r | |
23 | \r | |
24 | ``` bash\r | |
25 | sudo apt-get update\r | |
26 | sudo apt-get install gcc g++ make uuid-dev\r | |
27 | ```\r | |
28 | \r | |
29 | - For building ARCH IA32 on X64 Ubuntu 18.04 LTS these steps where needed.\r | |
30 | \r | |
31 | ``` bash\r | |
32 | sudo dpkg --add-architecture i386\r | |
33 | sudo apt-get update\r | |
34 | sudo apt-get install libc6-dev:i386 libx11-dev:i386 libxext-dev:i386 lib32gcc-7-dev\r | |
35 | ```\r | |
36 | \r | |
37 | Note: edksetup, Submodule initialization and manual installation of NASM, iASL, or\r | |
38 | the required cross-compiler toolchains are **not** required, this is handled by the\r | |
39 | Pytools build system.\r | |
40 | \r | |
41 | ## Building with Pytools for EmulatorPkg\r | |
42 | \r | |
43 | 1. [Optional] Create a Python Virtual Environment - generally once per workspace\r | |
44 | \r | |
45 | ``` bash\r | |
46 | python -m venv <name of virtual environment>\r | |
47 | ```\r | |
48 | \r | |
49 | 2. [Optional] Activate Virtual Environment - each time new shell opened\r | |
50 | - Linux\r | |
51 | \r | |
52 | ```bash\r | |
53 | source <name of virtual environment>/bin/activate\r | |
54 | ```\r | |
55 | \r | |
56 | - Windows\r | |
57 | \r | |
58 | ``` bash\r | |
59 | <name of virtual environment>/Scripts/activate.bat\r | |
60 | ```\r | |
61 | \r | |
62 | 3. Install Pytools - generally once per virtual env or whenever pip-requirements.txt changes\r | |
63 | \r | |
64 | ``` bash\r | |
65 | pip install --upgrade -r pip-requirements.txt\r | |
66 | ```\r | |
67 | \r | |
68 | 4. Initialize & Update Submodules - only when submodules updated\r | |
69 | \r | |
70 | ``` bash\r | |
71 | stuart_setup -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>\r | |
72 | ```\r | |
73 | \r | |
74 | 5. Initialize & Update Dependencies - only as needed when ext_deps change\r | |
75 | \r | |
76 | ``` bash\r | |
77 | stuart_update -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>\r | |
78 | ```\r | |
79 | \r | |
80 | 6. Compile the basetools if necessary - only when basetools C source files change\r | |
81 | \r | |
82 | ``` bash\r | |
83 | python BaseTools/Edk2ToolsBuild.py -t <ToolChainTag>\r | |
84 | ```\r | |
85 | \r | |
86 | 7. Compile Firmware\r | |
87 | \r | |
88 | ``` bash\r | |
89 | stuart_build -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH>\r | |
90 | ```\r | |
91 | \r | |
92 | - use `stuart_build -c EmulatorPkg/PlatformCI/PlatformBuild.py -h` option to see additional\r | |
93 | options like `--clean`\r | |
94 | \r | |
95 | 8. Running Emulator\r | |
96 | - You can add `--FlashRom` to the end of your build command and the emulator will run after the\r | |
97 | build is complete.\r | |
98 | - or use the `--FlashOnly` feature to just run the emulator.\r | |
99 | \r | |
100 | ``` bash\r | |
101 | stuart_build -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=<TOOL_CHAIN_TAG> -a <TARGET_ARCH> --FlashOnly\r | |
102 | ```\r | |
103 | \r | |
104 | ### Notes\r | |
105 | \r | |
106 | 1. Configuring *ACTIVE_PLATFORM* and *TARGET_ARCH* in Conf/target.txt is **not** required. This\r | |
107 | environment is set by PlatformBuild.py based upon the `[-a <TARGET_ARCH>]` parameter.\r | |
108 | \r | |
109 | **NOTE:** Logging the execution output will be in the normal stuart log as well as to your console.\r | |
110 | \r | |
111 | ### Custom Build Options\r | |
112 | \r | |
113 | **MAKE_STARTUP_NSH=TRUE** will output a *startup.nsh* file to the location mapped as fs0. This is\r | |
114 | used in CI in combination with the `--FlashOnly` feature to run the Emulator to the UEFI shell and then execute\r | |
115 | the contents of *startup.nsh*.\r | |
116 | \r | |
117 | ### Passing Build Defines\r | |
118 | \r | |
119 | To pass build defines through _stuart_build_, prepend `BLD_*_`to the define name and pass it on the\r | |
120 | command-line. _stuart_build_ currently requires values to be assigned, so add an`=1` suffix for bare defines.\r | |
121 | For example, to enable the IP6 Network Stack, the stuart_build command-line would be:\r | |
122 | \r | |
123 | `stuart_build -c EmulatorPkg/PlatformCI/PlatformBuild.py BLD_*_NETWORK_IP6_ENABLE=1`\r | |
124 | \r | |
125 | ## References\r | |
126 | \r | |
127 | - [Installing and using Pytools](https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/using.md#installing)\r | |
128 | - More on [python virtual environments](https://docs.python.org/3/library/venv.html)\r |