]>
Commit | Line | Data |
---|---|---|
898b5b63 MK |
1 | # **EDK II firmware for Intel(R) Quark SoC X1000 based platforms**\r |
2 | \r | |
3 | ## **Features**\r | |
4 | * UEFI firmware image with ability to enable/disable major features such as\r | |
5 | - Logging\r | |
6 | - Source level debug using [Intel(R) UEFI Development Kit Debugger Tool](\r | |
7 | https://firmware.intel.com/develop/intel-uefi-tools-and-utilities/intel-uefi-development-kit-debugger-tool)\r | |
8 | - Boot Performance Measurements\r | |
9 | - UEFI Secure Boot with Physical Presence\r | |
10 | - TCG Measured Boot using TPM 1.2 hardware devices on I2C bus\r | |
11 | * Minimal firmware image for initial power-on and debug\r | |
12 | * UEFI Shell built into FLASH image\r | |
13 | * UEFI Linux operating system boot support from Micro SD FLASH\r | |
14 | * Hardware Support\r | |
15 | - [Intel(R) Quark SoC X1000 CPU](\r | |
16 | http://www.intel.com/content/www/us/en/embedded/products/quark/quark-x1000-datasheet.html)\r | |
17 | - [Intel(R) Galileo Development Board](\r | |
18 | http://www.intel.com/content/www/us/en/embedded/products/galileo/galileo-g1-datasheet.html)\r | |
19 | - [Intel(R) Galileo Gen 2 Development Board](\r | |
20 | http://www.intel.com/content/www/us/en/embedded/products/galileo/galileo-overview.html)\r | |
21 | - HPET Timer\r | |
22 | - Real Time Clock\r | |
23 | * Major I/O Subsystems\r | |
24 | - PCI including support for Mini PCI Express Cards\r | |
25 | - USB using EHCI and OHCI host controllers\r | |
26 | - Micro SD FLASH with FAT file system support\r | |
27 | - Serial UART up to 921600 baud for console, logging, and debug\r | |
28 | * ACPI Tables with ACPI S3 sleep state support\r | |
29 | * SMBIOS Tables\r | |
30 | \r | |
31 | ## **Windows Build Instructions**\r | |
32 | \r | |
33 | ### Pre-requisites\r | |
34 | \r | |
35 | * GIT client: Available from https://git-scm.com/downloads\r | |
36 | * Microsoft Visual Studio.\r | |
37 | - Visual Studio 2015 recommended and is used in the examples below.\r | |
38 | * Microsoft Windows Driver Development Kit 3790.1830\r | |
39 | - http://download.microsoft.com/download/9/0/f/90f019ac-8243-48d3-91cf-81fc4093ecfd/1830_usa_ddk.iso\r | |
40 | - Mount ISO image\r | |
41 | - Right click on ```x86\kitsetup.exe``` & choose **Run as administrator**\r | |
42 | - Install to C:\WINDDK\3790.1830\r | |
43 | - Uncheck all Component Groups\r | |
44 | - Expand Build Environment Component\r | |
45 | - Check Windows Driver Development Kit 16-bit Additional Build Tools\r | |
46 | - Install\r | |
47 | * ASL compiler: Available from http://www.acpica.org\r | |
48 | - Install into ```C:\ASL``` to match default tools_def.txt configuration.\r | |
49 | \r | |
50 | Create a new directory for an EDK II WORKSPACE.\r | |
51 | \r | |
52 | The code block below shows the GIT clone operations required to pull the EDK II\r | |
53 | source tree, the FatPkg sources, the pre-built versions of BaseTools as WIN32\r | |
54 | binaries, and the edk2-non-osi repository that provides a binary file for the\r | |
55 | Quark Remote Management Unit (RMU).\r | |
56 | \r | |
57 | Next it sets environment variables that must be set before running\r | |
58 | ```edksetup.bat```. Since content is being pulled from multiple repositories,\r | |
59 | the EDK II [Multiple Workspace](\r | |
60 | https://github.com/tianocore/tianocore.github.io/wiki/Multiple_Workspace)\r | |
61 | feature is used.\r | |
62 | \r | |
63 | Next, the ```edksetup.bat``` file is run to complete the initialization of an\r | |
64 | EDK II build environment. Two example build commands are shown. The first one\r | |
65 | in ```QuarkPlatformPlg/Quark.dsc``` builds a full UEFI firmware image that is\r | |
66 | able to boot the built-in UEFI Shell and Linux from a micro SD FLASH card. The\r | |
67 | second one in ```QuarkPlatformPkg/QuarkMin.dsc``` builds a minimal firmware\r | |
68 | image that is useful for initial power-on and debug of new features.\r | |
69 | \r | |
70 | ```cmd\r | |
71 | git clone https://github.com/tianocore/edk2.git\r | |
72 | git clone https://github.com/tianocore/edk2-FatPkg.git FatPkg\r | |
73 | git clone https://github.com/tianocore/edk2-BaseTools-win32.git\r | |
74 | git clone https://github.com/tianocore/edk2-non-osi.git\r | |
75 | \r | |
76 | set WORKSPACE=%CD%\r | |
77 | set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-non-osi\r | |
78 | set EDK_TOOLS_BIN=%WORKSPACE%\edk2-BaseTools-win32\r | |
79 | \r | |
80 | cd edk2\r | |
81 | edksetup.bat\r | |
82 | \r | |
83 | build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc\r | |
84 | build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/QuarkMin.dsc\r | |
85 | ```\r | |
86 | \r | |
87 | ## **Linux Build Instructions**\r | |
88 | \r | |
89 | ### Pre-requisites\r | |
90 | \r | |
91 | * GIT client\r | |
92 | * GCC 4.9 compiler\r | |
93 | * ASL compiler: Available from http://www.acpica.org.\r | |
94 | \r | |
95 | Create a new directory for an EDK II WORKSPACE.\r | |
96 | \r | |
97 | The code block below shows the GIT clone operations required to pull the EDK II\r | |
98 | source tree, the FatPkg sources, and the edk2-non-osi repository that provides a\r | |
99 | binary file for the Quark Remote Management Unit (RMU).\r | |
100 | \r | |
101 | Next it sets environment variables that must be set before running\r | |
102 | ```edksetup.bat```. Since content is being pulled from multiple repositories,\r | |
103 | the EDK II [Multiple Workspace](\r | |
104 | https://github.com/tianocore/tianocore.github.io/wiki/Multiple_Workspace)\r | |
105 | feature is used.\r | |
106 | \r | |
107 | Next, the EDK II BaseTools required to build firmware images are built.\r | |
108 | \r | |
109 | Next, the ```edksetup.bat``` file is run to complete the initialization of an\r | |
110 | EDK II build environment. Two example build commands are shown. The first one\r | |
111 | in ```QuarkPlatformPlg/Quark.dsc``` builds a full UEFI firmware image that is\r | |
112 | able to boot the built-in UEFI Shell and Linux from a micro SD FLASH card. The\r | |
113 | second one in ```QuarkPlatformPkg/QuarkMin.dsc``` builds a minimal firmware\r | |
114 | image that is useful for initial power-on and debug of new features.\r | |
115 | \r | |
116 | ```sh\r | |
117 | git clone https://github.com/tianocore/edk2.git\r | |
118 | git clone https://github.com/tianocore/edk2-FatPkg.git FatPkg\r | |
119 | git clone https://github.com/tianocore/edk2-non-osi.git\r | |
120 | \r | |
121 | export WORKSPACE=$PWD\r | |
122 | export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-non-osi\r | |
123 | export EDK_TOOLS_PATH=$WORKSPACE/edk2/BaseTools\r | |
124 | \r | |
125 | make -C edk2/BaseTools\r | |
126 | \r | |
127 | cd $WORKSPACE/edk2\r | |
128 | \r | |
129 | . edksetup.sh BaseTools\r | |
130 | \r | |
131 | build -a IA32 -t GCC49 -p QuarkPlatformPkg/Quark.dsc\r | |
132 | build -a IA32 -t GCC49 -p QuarkPlatformPkg/QuarkMin.dsc\r | |
133 | ```\r | |
134 | \r | |
135 | ## **Build Features**\r | |
136 | \r | |
137 | The table below contains a summary of the build flags to enable or disable\r | |
138 | features on the build command line using ```-D``` flags.\r | |
139 | \r | |
140 | | **Define Name** | **Default Value** | **Supported Values** |\r | |
141 | | -------------------------- | ----------------- | -------------------- |\r | |
142 | | ```GALILEO``` | GEN2 | GEN1, GEN2 |\r | |
143 | | ```LOGGING``` | TRUE | TRUE, FALSE |\r | |
144 | | ```SOURCE_DEBUG_ENABLE``` | FALSE | TRUE, FALSE |\r | |
145 | | ```PERFORMANCE_ENABLE``` | FALSE | TRUE, FALSE |\r | |
146 | | ```SECURE_BOOT_ENABLE``` | FALSE | TRUE, FALSE |\r | |
147 | | ```MEASURED_BOOT_ENABLE``` | FALSE | TRUE, FALSE |\r | |
148 | | ```TPM_12_HARDWARE``` | NONE | NONE, LPC, ATMEL_I2C, INFINEON_I2C |\r | |
149 | \r | |
150 | * ```GALILEO``` - Used to specify the type of Intel(R) Galileo board type. The\r | |
151 | default is ```GEN2``` for the [Intel(R) Galileo Gen 2 Development Board](\r | |
152 | http://www.intel.com/content/www/us/en/embedded/products/galileo/galileo-overview.html).\r | |
153 | The other supported value is ```GEN1``` for the [Intel(R) Galileo Development Board](\r | |
154 | http://www.intel.com/content/www/us/en/embedded/products/galileo/galileo-g1-datasheet.html).\r | |
155 | Add ```-D GALILEO=GEN1``` to the build command for [Intel(R) Galileo Development Board](\r | |
156 | http://www.intel.com/content/www/us/en/embedded/products/galileo/galileo-g1-datasheet.html).\r | |
157 | \r | |
158 | * ```LOGGING``` - Used to enable/disable logging messages from DEBUG() macros to\r | |
159 | a serial UART. The default is TRUE for enabled when the BUILDTARGET is DEBUG\r | |
160 | (```-b DEBUG```). The default is FALSE for disabled when the BUILDTARGET is\r | |
161 | not DEBUG (e.g. ```-b RELEASE```). Add ```-D LOGGING``` to the build command\r | |
162 | to force logging enabled. Add ```-D LOGGING=FALSE``` to force logging\r | |
163 | disabled.\r | |
164 | \r | |
165 | * ```SOURCE_DEBUG_ENABLE``` - Used to enable/disable source level debug using the\r | |
166 | [Intel(R) UEFI Development Kit Debugger Tool](\r | |
167 | https://firmware.intel.com/develop/intel-uefi-tools-and-utilities/intel-uefi-development-kit-debugger-tool).\r | |
168 | The default is FALSE for disabled. Add ```-D SOURCE_DEBUG_ENABLE``` to the\r | |
169 | build command line to enable source level debug.\r | |
170 | \r | |
171 | * ```PERFORMANCE_ENABLE``` - Used to enable/disable boot performance measurement.\r | |
172 | The default is FALSE for disabled. Add ```-D PERFORMANCE_ENABLE``` to the\r | |
173 | build command line to enable boot performance measurement. When this feature\r | |
174 | is enabled, both ```LOGGING``` and ```SOURCE_DEBUG_ENABLE``` are automatically\r | |
175 | disabled so there is not boot time overhead from the serial UART for logging\r | |
176 | messages or the debug agent.\r | |
177 | \r | |
178 | * ```SECURE_BOOT_ENABLE``` - Used to enable/disable UEFI Secure Boot features.\r | |
179 | The default is FALSE for disabled. Add ```-D SECURE_BOOT_ENABLE``` to the\r | |
180 | build command line to enable UEFI Secure Boot features.\r | |
181 | \r | |
182 | * ```MEASURED_BOOT_ENABLE``` - Used to enable/disable measurement of firmware\r | |
183 | code and data into a TPM 1.2 hardware device. The default is FALSE for\r | |
184 | disabled. Add ```-D MEASURED_BOOT_ENABLE``` to the build command line to\r | |
185 | enable UEFI Secure Boot features.\r | |
186 | \r | |
187 | * ```TPM_12_HARDWARE``` - Used to specify the type of TPM 1.2 hardware device\r | |
188 | that is connected to the Galileo board. This define is valid if the measure\r | |
189 | boot feature is enabled using ```-D MEASURED_BOOT_ENABLE```. The default is\r | |
190 | NONE for no TPM 1.2 hardware device connected. Add ```-D TPM_12_HARDWARE=LPC```\r | |
191 | for a TPM hardware device attached to an LPC bus (not supported on on Intel(R)\r | |
192 | Quark SoC X1000). Add ```-D TPM_12_HARDWARE=ATMEL_I2C``` for an\r | |
193 | [Atmel AT97SC3204T](http://www.atmel.com/devices/AT97SC3204T.aspx) or\r | |
194 | [Atmel AT97SC3205T](http://www.atmel.com/images/atmel-8883s-tpm-at97sc3205t-datasheet-summary.pdf)\r | |
195 | attached to the I2C bus of the Galileo Arduino header. Add\r | |
196 | ```-D TPM_12_HARDWARE=INFINION_I2C``` for an [Infineon SLB9645](\r | |
197 | http://www.infineon.com/dgdl/Infineon-TPM+SLB+9645-DS-v01_00-EN.pdf?fileId=5546d4625185e0e201518b83d0c63d7c)\r | |
198 | attached to the I2C bus of the Galileo Arduino header. The ATMEL_I2C setting\r | |
199 | has been tested with the [CryptoShield](https://www.sparkfun.com/products/13183)\r | |
200 | available from [SparkFun](https://www.sparkfun.com/).\r | |
201 | \r | |
202 | \r | |
203 | ### **Example Build Commands**\r | |
204 | \r | |
205 | Default build with logging enabled:\r | |
206 | \r | |
207 | ```build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc```\r | |
208 | \r | |
209 | Release build with logging disabled:\r | |
210 | \r | |
211 | ```build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc -b RELEASE```\r | |
212 | \r | |
213 | Enable source level debugging:\r | |
214 | \r | |
215 | ```build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc -D SOURCE_DEBUG_ENABLE```\r | |
216 | \r | |
217 | Enable boot performance metrics:\r | |
218 | \r | |
219 | ```build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc -D PERFORMANCE_ENABLE```\r | |
220 | \r | |
221 | Enable UEFI Secure Boot features:\r | |
222 | \r | |
223 | ```build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc -D UEFI_SECURE_BOOT```\r | |
224 | \r | |
225 | Enable UEFI Secure Boot and Measured Boot using Atmel I2C TPM hardware device:\r | |
226 | \r | |
227 | ```build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc -D UEFI_SECURE_BOOT\r | |
228 | -D MEASURED_BOOT_ENABLE -D TPM_12_HARDWARE=ATMEL_I2C```\r | |
229 | \r | |
230 | ## **FLASH Update using DediProg SF100**\r | |
231 | \r | |
232 | Once the sources have been downloaded, an EDK II build environment established,\r | |
233 | and an EDK II firmware image has been built, the EDK II firmware image needs to\r | |
234 | installed into the FLASH device on the target Galileo development board. One\r | |
235 | way to do this is with the [Dediprog SF100 IC Programmer](\r | |
236 | http://www.dediprog.com/pd/spi-flash-solution/SF100).\r | |
237 | \r | |
238 | * Install the DediProg SF100 software.\r | |
239 | \r | |
240 | * Connect the DediProg SF100 to the Galileo development board.\r | |
241 | \r | |
33e0f9a7 | 242 | ![](https://github.com/tianocore/tianocore.github.io/wiki/Projects/QuarkPlatformPkg/Images/Dediprog.jpg)\r |
898b5b63 MK |
243 | \r |
244 | * Make sure ```dpcmd.exe``` is in ```PATH```\r | |
245 | \r | |
246 | ```PATH=%PATH%;"c:\Program Files (x86)\DediProg\SF100"```\r | |
247 | \r | |
248 | * **NOTE**: It is recommended that the FLASH image that was shipped with the\r | |
249 | Galileo development board be read and saved before updating FLASH image. The\r | |
250 | command shown below read the FLASH image and saves it to the file\r | |
251 | called ```GalileoOriginalFirmware.bin```.\r | |
252 | \r | |
253 | ```dpcmd.exe -r GalileoOriginalFirmware.bin```\r | |
254 | \r | |
255 | * Update FLASH image using either the DediProg SF100 GUI or ```dpcmd.exe```.\r | |
256 | - Example update of Galileo firmware image when BUILDTARGET is DEBUG (default)\r | |
257 | \r | |
258 | ```dpcmd.exe -u%WORKSPACE%\Build\Quark\DEBUG_VS2015x86\FV\QUARK.fd ```\r | |
259 | \r | |
260 | - Example update of Galileo firmware image when BUILDTARGET is RELEASE\r | |
261 | (```-b RELEASE```)\r | |
262 | \r | |
263 | ```dpcmd.exe -u%WORKSPACE%\Build\Quark\RELEASE_VS2015x86\FV\QUARK.fd ```\r | |
264 | \r | |
265 | ## **Setting up a Serial Console and Booting to UEFI Shell**\r | |
266 | \r | |
267 | After the FLASH is updated on Galileo, a serial cable is connected between the\r | |
268 | host system and the Galileo target. A serial terminal emulator (such as\r | |
269 | [Tera Term](https://en.osdn.jp/projects/ttssh2/releases/)) can be used to see\r | |
270 | the logging messages from DEBUG() macros and the serial console for the UEFI\r | |
271 | Boot Manager, UEFI Shell, and operating system.\r | |
272 | \r | |
273 | The default serial communication parameters for the Intel(R) Galileo Gen 2\r | |
274 | Development Board is 921600,n,8,1 with no hardware flow control.\r | |
275 | \r | |
33e0f9a7 | 276 | ![](https://github.com/tianocore/tianocore.github.io/wiki/Projects/QuarkPlatformPkg/Images/TeraTermSerialParameters.png)\r |
898b5b63 MK |
277 | \r |
278 | The default serial communication parameters for the Intel(R) Galileo Development\r | |
279 | Board is 461800,n,8,1 with no hardware flow control.\r | |
280 | \r | |
281 | The following changes to the [Tera Term](https://en.osdn.jp/projects/ttssh2/releases/)\r | |
282 | configuration files are recommended for UEFI serial console compatibility.\r | |
283 | Some of the later use cases involve using the TCPIP mode, so some of these\r | |
284 | recommendation apply to the TCPIP use cases.\r | |
285 | \r | |
286 | * TERATERM.INI - Set terminal size to 80 x 25 and terminal settings to UTF8.\r | |
287 | \r | |
33e0f9a7 | 288 | ![](https://github.com/tianocore/tianocore.github.io/wiki/Projects/QuarkPlatformPkg/Images/TeraTermTerminal.png)\r |
898b5b63 MK |
289 | \r |
290 | * TERATERM.INI - Set font type to Terminal to support box drawing glyphs.\r | |
291 | \r | |
33e0f9a7 | 292 | ![](https://github.com/tianocore/tianocore.github.io/wiki/Projects/QuarkPlatformPkg/Images/TeraTermFont.png)\r |
898b5b63 MK |
293 | \r |
294 | * TERATERM.INI - Disable line mode to make TCPIP mode work like COM port mode.\r | |
295 | \r | |
296 | ```ini\r | |
297 | ; Line at a time mode\r | |
298 | EnableLineMode=off\r | |
299 | ```\r | |
300 | \r | |
301 | * KEYBOARD.CNF - Disable VT function keys for F5..F10\r | |
302 | \r | |
303 | ```ini\r | |
304 | [VT function keys]\r | |
305 | ;F6 key\r | |
306 | ;F6=64\r | |
307 | ;F7 key\r | |
308 | ;F7=65\r | |
309 | ;F8 key\r | |
310 | ;F8=66\r | |
311 | ;F9 key\r | |
312 | ;F9=67\r | |
313 | ;F10 key\r | |
314 | ;F10=68\r | |
315 | ```\r | |
316 | \r | |
317 | * KEYBOARD.CNF - Disable X function keys for F1..F4\r | |
318 | \r | |
319 | ```ini\r | |
320 | [X function keys]\r | |
321 | ; F1 key\r | |
322 | XF1=off\r | |
323 | ; F2 key\r | |
324 | ;XF2=60\r | |
325 | XF2=off\r | |
326 | ; F3 key\r | |
327 | ;XF3=61\r | |
328 | XF3=off\r | |
329 | ; F4 key\r | |
330 | ;XF4=62\r | |
331 | XF4=off\r | |
332 | ; F5 key\r | |
333 | ;XF5=63\r | |
334 | ```\r | |
335 | \r | |
336 | * KEYBOARD.CNF - Add UEFI serial console sequences for F1..F10\r | |
337 | \r | |
338 | ```ini\r | |
339 | [User keys]\r | |
340 | User1=59,0,$1B[M\r | |
341 | User2=60,0,$1B[N\r | |
342 | User3=61,0,$1B[O\r | |
343 | User4=62,0,$1B[P\r | |
344 | User5=63,0,$1B[Q\r | |
345 | User6=64,0,$1B[R\r | |
346 | User7=65,0,$1B[S\r | |
347 | User8=66,0,$1B[T\r | |
348 | User9=67,0,$1B[U\r | |
349 | User10=68,0,$1B[V\r | |
350 | ```\r | |
351 | \r | |
352 | Connect power adapter to Galileo development board, and the logging messages\r | |
353 | should be seen, followed by 5 second countdown, followed by an automatic boot to\r | |
354 | the built-in UEFI Shell.\r | |
355 | \r | |
33e0f9a7 | 356 | ![](https://github.com/tianocore/tianocore.github.io/wiki/Projects/QuarkPlatformPkg/Images/UefiShell.png)\r |
898b5b63 MK |
357 | \r |
358 | ## **Source Level Debug Using Intel(R) UEFI Development Kit Debugger Tool**\r | |
359 | \r | |
360 | ### Pre-requisites\r | |
361 | \r | |
362 | * Intel(R) UEFI Development Kit Debugger Tool User Manual for Ver 1.5 or higher:\r | |
363 | Available from https://firmware.intel.com/develop/intel-uefi-tools-and-utilities/intel-uefi-development-kit-debugger-tool\r | |
364 | * Intel(R) UEFI Development Kit Debugger Tool Ver 1.5 or higher: Available from\r | |
365 | https://firmware.intel.com/develop/intel-uefi-tools-and-utilities/intel-uefi-development-kit-debugger-tool\r | |
366 | * [Tera Term](https://en.osdn.jp/projects/ttssh2/releases/) or other serial\r | |
367 | terminal emulator with TCPIP support\r | |
368 | \r | |
369 | Follow instructions in Intel(R) UEFI Development Kit Debugger Tool User manual\r | |
370 | to setup host system.\r | |
371 | \r | |
372 | Build a firmware image with SOURCE_DEBUG_ENABLE enabled\r | |
373 | (```-D SOURCE_DEBUG_ENABLE```). This will select the appropriate libraries,\r | |
374 | debug agent, and PCDs for Galileo. Galileo does not support a USB 2.0 debug\r | |
375 | port, so only the UART based communications library is used.\r | |
376 | \r | |
377 | Use Dediprog SF100 to update the Galileo development board FLASH image.\r | |
378 | \r | |
379 | Update the ```[Debug Port]``` section of the SoftDebugger.ini file with the host\r | |
380 | side UART configuration settings. The following example uses COM5, which must\r | |
381 | be updated with the COM port the Galileo target is attached. The following\r | |
382 | example also shows a baud rate of 921600 which is correct for a Galileo Gen 2.\r | |
383 | If a Galileo Gen 1 is being used, set the baud rate to 460800. By default, the\r | |
384 | Galileo console is redirected to TCPIP port 20715.\r | |
385 | \r | |
386 | ```ini\r | |
387 | [Debug Port]\r | |
388 | Channel = Serial\r | |
389 | Port = COM5\r | |
390 | FlowControl = 0\r | |
391 | BaudRate = 921600\r | |
392 | Server =\r | |
393 | ```\r | |
394 | \r | |
395 | Connect power adapter to Galileo development board and run a command script with\r | |
396 | the contents below to start a Tera Term session on TCPIP port 20715 and start\r | |
397 | the Intel(R) UEFI Development Kit Debugger Tool using UART connection between\r | |
398 | the host and target and WinDbg. The REBOOT button on the Galileo development\r | |
399 | board may need to be pressed for the debugger to perform the initial connect.\r | |
400 | \r | |
401 | ```cmd\r | |
402 | start "Console" /B "c:\Program Files (x86)\teraterm\ttermpro.exe" localhost:20715 /nossh\r | |
403 | start "Debugger" /B "C:\Program Files (x86)\Intel\Intel(R) UEFI Development Kit Debugger Tool\eXdi.exe" /LaunchWinDbg\r | |
404 | ```\r | |
405 | \r | |
406 | The figure below should be seen when a connection is made. The SoftDebugger\r | |
407 | Debug Console window shows the status of the connection between the host and the\r | |
408 | target. The Tera Term window shows the console output from the SEC phase until\r | |
409 | the debug agent is initialized. The WinDbg window shows that the debugger is\r | |
410 | connected and the WinDbg application can be used for run control, breakpoint\r | |
411 | management, and viewing call stacks, local variables, global variables, etc.\r | |
412 | \r | |
33e0f9a7 | 413 | ![](https://github.com/tianocore/tianocore.github.io/wiki/Projects/QuarkPlatformPkg/Images/UdkDebugger.png)\r |
898b5b63 MK |
414 | \r |
415 | ## **Debug Using Intel(R) System Debugger using OpenOCD**\r | |
416 | \r | |
417 | Setup hardware and software components following the instructions in the article at:\r | |
418 | https://software.intel.com/en-us/articles/using-intel-system-debugger-with-openocd\r | |
419 | \r | |
420 | Connect power adapter to Galileo development board.\r | |
421 | \r | |
422 | The following batch file starts Tera Term serial console on COM5 at 921600 baud,\r | |
423 | starts OpenOCD using a Flyswatter2, and starts Intel(R) System Studio Debugger.\r | |
424 | Select the **Connect** button to complete the host to target connection.\r | |
425 | \r | |
426 | ```cmd\r | |
427 | set OPENOCD="C:\Program Files (x86)\IntelSWTools\system_studio_for_windows_2016.0.023\debugger\openocd"\r | |
428 | start "Console" /B "c:\Program Files (x86)\teraterm\ttermpro.exe" /C=5 /BAUD=921600\r | |
429 | start "OpenOcd" /B %OPENOCD%\bin\openocd.exe -f ..\scripts\interface\ftdi\flyswatter2.cfg -f ..\scripts\board\quark_x10xx_board.cfg\r | |
430 | call "C:\Program Files (x86)\IntelSWTools\System Debugger 2016\system_debugger\start_xdb_gdb_remote.bat"\r | |
431 | ```\r | |
432 | \r | |
433 | When **Reset Target** is selected, the Galileo development board does not always\r | |
434 | halt at the first instruction at the reset vector. If debug is required from\r | |
435 | the first instruction of the reset vector, then update the file\r | |
436 | ```UefiCpuPkg/SecCore/Ia32/ResetVector.asm``` and change the two NOP\r | |
437 | instructions at the label ```ResetHandler:``` to ```JMP $```. This puts the CPU\r | |
438 | into a wait loop until the debugger is connected and the debugger is used to set\r | |
439 | instruction pointer to the next instruction.\r | |
440 | \r | |
441 | ```\r | |
442 | ;\r | |
443 | ; For IA32, the reset vector must be at 0xFFFFFFF0, i.e., 4G-16 byte\r | |
444 | ; Execution starts here upon power-on/platform-reset.\r | |
445 | ;\r | |
446 | ResetHandler:\r | |
447 | ; nop\r | |
448 | ; nop\r | |
449 | jmp $\r | |
450 | ApStartup:\r | |
451 | ;\r | |
452 | ; Jmp Rel16 instruction\r | |
453 | ; Use machine code directly in case of the assembler optimization\r | |
454 | ; SEC entry point relative address will be fixed up by some build tool.\r | |
455 | ;\r | |
456 | ; Typically, SEC entry point is the function _ModuleEntryPoint() defined in\r | |
457 | ; SecEntry.asm\r | |
458 | ;\r | |
459 | DB 0e9h\r | |
460 | DW -3\r | |
461 | ```\r | |
462 | \r | |
463 | ## **Install, Configure, and Boot Linux**\r | |
464 | \r | |
465 | * Download SD Card Linux Image: Available at\r | |
466 | http://www.intel.com/content/www/us/en/support/boards-and-kits/intel-galileo-boards/000005614.html\r | |
467 | * Extract the SD Card Linux Image to a FAT formatted Micro SD FLASH device\r | |
468 | * Install Micro SD FLASH device into Galileo development board\r | |
469 | \r | |
470 | Connect power adapter to Galileo development board and boot to the UEFI Shell.\r | |
471 | \r | |
472 | From the UEFI Shell execute the following commands to copy the GRUB EFI boot\r | |
473 | loader to ```\efi\boot\bootia32.efi```. This allows the UEFI Boot Manager, on\r | |
474 | all future boots, to auto detect that the Micro SD FLASH device is bootable.\r | |
475 | \r | |
476 | ```\r | |
477 | Shell> connect -r\r | |
478 | Shell> map -r\r | |
479 | Shell> fs0:\r | |
480 | FS0:> mkdir efi\r | |
481 | FS0:> mkdir efi\boot\r | |
482 | FS0:> cp grub.efi efi\boot\bootia32.efi\r | |
483 | ```\r | |
484 | \r | |
485 | The GRUB boot loader is set to a UART baud rate of 115200. A couple changes are\r | |
486 | required to change the baud rate to 460800 for Galileo Gen 1 or 921600 for\r | |
487 | Galileo Gen 2. From the UEFI Shell, execute the following commands to make a\r | |
488 | backup copy and edit the GRUB configuration file.\r | |
489 | \r | |
490 | ```\r | |
491 | FS0:> cp boot\grub\grub.conf boot\grub\grub.conf.org\r | |
492 | FS0:> edit boot\grub\grub.conf\r | |
493 | ```\r | |
494 | \r | |
495 | * Delete the lines associated with the boot option with the following title.\r | |
496 | \r | |
497 | ```\r | |
498 | title Clanton SVP kernel-SPI initrd-SPI IMR-On IO-APIC/HPET NoEMU\r | |
499 | ```\r | |
500 | \r | |
501 | * Replace the two instances of 115200 in the following line to 460800 for\r | |
502 | Galileo Gen 1 or 921600 for Galileo Gen 2.\r | |
503 | \r | |
504 | ```\r | |
505 | kernel /bzImage root=/dev/ram0 console=ttyS1,115200n8 earlycon=uart8250,mmio32,$EARLY_CON_ADDR_REPLACE,115200n8 reboot=efi,warm apic=debug rw LABEL=boot debugshell=5 rootimage=image-full-galileo-clanton.ext3\r | |
506 | ```\r | |
507 | * Press F3 to save the file\r | |
508 | * Run the ```exit``` command to exit from the UEFI Shell and return to the\r | |
509 | UEFI Boot Manager\r | |
510 | * Select **Boot Manager**\r | |
511 | * Select **UEFI Misc Device** for the Micro SD FLASH device.\r | |
512 | * GRUB should run and Linux should boot with serial log messages.\r | |
513 | * When the serial log messages stop, change the Tera Term baud rate to 115200\r | |
514 | * Login as ```root```. No password is required.\r | |
515 | * Use ```vi``` to edit ```/etc/inittab```\r | |
516 | * Change the baud rate of ttyS1 from 115200 to 460800 for Galileo Gen 1 or\r | |
517 | 921600 for Galileo Gen 2. The line that need to be updated is shown below\r | |
518 | \r | |
519 | ```\r | |
520 | S:2345:respawn:/sbin/getty 115200 ttyS1\r | |
521 | ```\r | |
522 | \r | |
523 | * Save the updated ```/etc/inittab```\r | |
524 | * Run ```reboot -f``` to shutdown Linux and reboot the platform.\r | |
525 | * Set the Tera Term baud rate back to 460800 for Galileo Gen 1 or 921600 for\r | |
526 | Galileo Gen 2.\r | |
527 | \r | |
528 | After these changes both the EDK II firmware and the Linux operating system use\r | |
529 | the same baud rate.\r | |
530 | \r | |
531 | ### **Testing ACPI S3 Sleep**\r | |
532 | \r | |
533 | The ACPI S3 Sleep and Resume feature can be tested on a Galileo development\r | |
534 | board using the Real Time Clock (RTC) for a wake event. The shell script shown\r | |
535 | below arms the RTC wake alarm 10 seconds in the future and puts the system to\r | |
536 | sleep. A shorter time in seconds can be passed in as the first argument to the\r | |
537 | script, but do not use times shorter than 2 or 3 seconds.\r | |
538 | \r | |
539 | **NOTE**: The stmmac module is unloaded because the module is not compatible\r | |
540 | with S3 resume.\r | |
541 | \r | |
542 | ```sh\r | |
543 | #\r | |
544 | # Unload NIC driver that causes S3 to fail\r | |
545 | #\r | |
546 | rmmod stmmac\r | |
547 | \r | |
548 | #\r | |
549 | # Disable RTC wake alarm\r | |
550 | #\r | |
551 | echo 0 > /sys/class/rtc/rtc0/wakealarm\r | |
552 | \r | |
553 | #\r | |
554 | # Compute wake time that is $1 seconds in the future\r | |
555 | #\r | |
556 | let WakeTime=`date '+%s'`\r | |
557 | echo $WakeTime\r | |
558 | if ["$1" = ""]; then\r | |
559 | let WakeTime=$WakeTime+10\r | |
560 | else\r | |
561 | let WakeTime=$WakeTime+$1\r | |
562 | fi\r | |
563 | echo $WakeTime\r | |
564 | \r | |
565 | #\r | |
566 | # Enable RTC wake alarm $1 seconds in the future\r | |
567 | #\r | |
568 | echo $WakeTime > /sys/class/rtc/rtc0/wakealarm\r | |
569 | \r | |
570 | #\r | |
571 | # Put systems into ACPI S3 sleep state\r | |
572 | #\r | |
573 | echo mem > /sys/power/state\r | |
574 | ```\r | |
575 | \r | |
576 | ## **UEFI Secure Boot Feature and Physical Presence**\r | |
577 | \r | |
578 | Build a firmware image with SECURE_BOOT_ENABLE enabled\r | |
579 | (```-D SECURE_BOOT_ENABLE```). This builds in support for UEFI authenticated\r | |
580 | variables, UEFI image verification, and UEFI Secure Boot configuration screens\r | |
581 | in the Device Manager. In order to change the UEFI Secure Boot configuration,\r | |
582 | the user must assert physical presence. The Galileo development board only has\r | |
583 | two push buttons (REBOOT and RESET). The REBOOT button unconditionally reboots\r | |
584 | the platform. The RESET button asserts the reset signal on the Arduino header\r | |
585 | and is also connected to a GPIO pin, so the state of the RESET button can be\r | |
586 | read. The user asserts physical presence by holding the RESET button while the\r | |
587 | Galileo development board boots, or by holding the RESET button while selecting\r | |
588 | the **Secure Boot Configuration** option in the Device Manager.\r | |
589 | \r | |
590 | Use Dediprog SF100 to update the Galileo development board FLASH image.\r | |
591 | \r | |
592 | Connect power adapter to Galileo development board and boot to the UEFI Boot\r | |
593 | Manager by pressing F2 or running the ```exit``` command from the UEFI Shell.\r | |
594 | Select **Device Manager** and then**Secure Boot Configuration**. Change\r | |
595 | **Customize Secure Boot** to **Customized** and then select **Custom Secure Boot\r | |
596 | Options**. If **Custom Secure Boot Options** can not be selected, then physical\r | |
597 | presence was not asserted using one of two methods listed above. Assert\r | |
598 | physical presence and try again.\r | |
599 | \r | |
600 | The **Custom Secure Boot Options** screen allows the Galileo development board\r | |
601 | to be enrolled into UEFI Secure Boot. See [How to Sign UEFI Drivers & Application V1.31](\r | |
602 | http://sourceforge.net/projects/edk2/files/General%20Documentation/SigningUefiImages%20-v1dot31.pdf/download)\r | |
603 | in the [SecurityPkg Wiki](https://github.com/tianocore/tianocore.github.io/wiki/SecurityPkg)\r | |
604 | for details on how to complete the UEFI Secure Boot enrollment.\r | |
605 | \r | |
606 | ## **Enable Measured Boot Feature using Atmel I2C TPM on CryptoShield**\r | |
607 | \r | |
608 | Build a firmware image with MEASURED_BOOT_ENABLE enabled\r | |
609 | (```-D MEASURED_BOOT_ENABLE```) and TPM_12_HARDWARE set to ATMEL_I2C\r | |
610 | (```-D TMP_12_HARDWARE=ATMEL_I2C```). This builds in the TCG PEIM and DXE\r | |
611 | modules and uses the library for the Atmel I2C TPM hardware device.\r | |
612 | \r | |
613 | Use Dediprog SF100 to update the Galileo development board FLASH image.\r | |
614 | \r | |
615 | Attach the CryptoShield to the Arduino header of the Galileo development board\r | |
616 | as shown below.\r | |
617 | \r | |
33e0f9a7 | 618 | ![](https://github.com/tianocore/tianocore.github.io/wiki/Projects/QuarkPlatformPkg/Images/GalileoCryptoShield.jpg)\r |
898b5b63 MK |
619 | \r |
620 | Connect power adapter to Galileo development board and boot to the UEFI Shell.\r | |
621 | In the boot logging messages, messages similar to the following should be seen\r | |
622 | as the Atmel I2C TPM hardware device is detected and used to measure the\r | |
623 | contents of firmware volumes and firmware tables.\r | |
624 | \r | |
625 | ```\r | |
626 | Loading PEIM at 0x0000FC75188 EntryPoint=0x0000FC75260 TrEEConfigPei.efi\r | |
627 | PROGRESS CODE: V03020002 I0\r | |
628 | TrEEConfiguration.TpmDevice from Setup: 1\r | |
629 | DetectTpmDevice:\r | |
630 | TpmDevice final: 1\r | |
631 | TpmDevice PCD: 8B01E5B6-4F19-46E8-AB93-1C53671B90CC\r | |
632 | . . .\r | |
633 | Loading PEIM at 0x0000FC70190 EntryPoint=0x0000FC70260 TcgPei.efi\r | |
634 | PROGRESS CODE: V03020002 I0\r | |
635 | Install PPI: E9DB0D58-D48D-47F6-9C6E-6F40E86C7B41\r | |
636 | Install PPI: A030D115-54DD-447B-9064-F206883D7CCC\r | |
637 | PROGRESS CODE: V03020003 I0\r | |
638 | The FV which is measured by TcgPei starts at: 0xFFF10000\r | |
639 | The FV which is measured by TcgPei has the size: 0xF0000\r | |
640 | The FV which is measured by TcgPei starts at: 0xFFD00000\r | |
641 | The FV which is measured by TcgPei has the size: 0x1E0000\r | |
642 | . . .\r | |
643 | Loading driver at 0x0000F620000 EntryPoint=0x0000F620260 TcgDxe.efi\r | |
644 | . . .\r | |
645 | TPM TcgDxe Measure Data when ReadyToBoot\r | |
646 | ```\r | |
647 | See the [SecurityPkg Wiki](https://github.com/tianocore/tianocore.github.io/wiki/SecurityPkg)\r | |
648 | for additional details on EDK II TPM support\r | |
649 | \r | |
650 | ## **Measuring Boot Performance**\r | |
651 | \r | |
652 | Build a firmware image with PERFORMANCE_ENABLE enabled\r | |
653 | (```-D PERFORMANCE_ENABLE```). This builds in the UEFI Shell and the DP.EFI\r | |
654 | (Dump Performance) into a firmware volume and also includes a simple file system\r | |
655 | driver for firmware volumes so the DP.EFI command can be run out of the FLASH.\r | |
656 | \r | |
657 | Use Dediprog SF100 to update the Galileo development board FLASH image.\r | |
658 | \r | |
659 | Connect power adapter to Galileo development board and let it boot to the UEFI\r | |
660 | Shell. Then use the REBOOT button or the ```reset``` UEFI Shell command to\r | |
661 | reboot the Galileo development board. The first boot after a FLASH update does\r | |
662 | extra work that is only performed one time. In order to get correct performance\r | |
663 | measurements, use the 2nd or later boots. After the 2nd boot, run the\r | |
664 | ```dp -s``` command. The output should look similar to the figure below.\r | |
665 | \r | |
33e0f9a7 | 666 | ![](https://github.com/tianocore/tianocore.github.io/wiki/Projects/QuarkPlatformPkg/Images/DpCommand.png)\r |