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