Dasharo/docs: Added documentation for Dasharo (UEFI) v0.1.0 for QEMU Q35

This commit is contained in:
maheshtammisetti
2023-01-23 21:06:16 +05:30
parent 594df41b3d
commit a986a10bae
11 changed files with 216 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
Error: Unhandled Rejection. Error: connect ECONNREFUSED 0.0.0.0:8000
Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

+48
View File
@@ -0,0 +1,48 @@
#Dasharo (UEFI) v0.1.0 for QEMU Q35 - Building Manual
In order to build the `Dasharo (UEFI) OVMF firmware image for QEMU Q35`, please follow the given steps to build the Dasharo firmware image from the EDK2 repository:
1. Clone the official Dasharo EDK2 repository to your local instance with git or downloading the source code from github.
```bash
git clone https://github.com/Dasharo/edk2.git
```
2. Once it is done, please follow the below instructions, in order to prepare your environment for the building of the OVMF image.
* Change the directory to Dasharo EDK2 repository locally -
```bash
cd Dasharo/edk2
```
* Setup the environment variables with the following command -
```bash
source edksetup.sh
```
* Update the submodules in order get the latest dependencies and avoid any build process errors while building the OVMF image.
```bash
git submodules update --init
```
3. In order to build the UEFI firmware image it can be done in two ways, one way is to give the flags with `-D SMM_REQUIRE` (SMM was actually enabled while building the firmware image, but the flags differ with feature to feature, so please check the OvmfPkgX64.dsc file). And second way is to set the flags in `OvmfPkgX64.dsc` and then build the firmware image. For the purpose of this documentation, I have preferred to set the features in `OvmfPkgX64.dsc` directly.
Check the following build command:
```bash
build -D DEBUG_ON_SERIAL_PORT -D BOOTLOADER=COREBOOT -a IA32 -a X64 -t GCC5 -b DEBUG -p OvmfPkg/OvmfPkgX64.dsc.
```
* `DEBUG_ON_SERIAL_PORT` = The following flag must be given for the **DEBUG** build as the output is redirected to the I/O port **0x402** to qemu monitor. We will be able to see the debug messages on the given debug I/O port. (0x402 will be later utilized in the qemu invocation further in this documentation).
4. Once the build is completed, the OVMF firmware image can be found below given path:
```bash
edk2/Build/Ovmf/DEBUG_GCC5/Ovmf.fd
```
+121
View File
@@ -0,0 +1,121 @@
# Dasharo (UEFI) v0.1.0 for QEMU Q35
1. Please verify your qemu installation, and then invoke the qemu emulator with the built OVMF firmware image as given below:
```bash
qemu-system-x86_64 -drive if=pflash,format=raw,file=Build/OvmfX64/DEBUG_GCC5/FV/OVMF.fd -nographic -debugcon file:debug.log -global isa-debugcon.iobase=0x402 -global ICH9-LPC.disable_s3=1 -net none -machine q35,smm=on
```
* The `-drive` parameter indicates that the device is a pflash with the firmware image file pointing out to the built OVMF.fd image.
* `-nographic` indicates to start the qemu emulator without any graphical output. This is useful while testing in the environment like docker.
* `-debugcon file:debug.log -global isa-debugcon.iobase=0x402` default OVMF build writes debug messages to IO port **0x402**. The following qemu command line options save them in the file called debug.log.
* `-global ICH9-LPC.disable_s3=1` SMM is put to use in the S3 suspend and resume infrastructure, and in the UEFI variable driver stack. Similarly, a pflash-backed variable store is a requirement. As SMM was enabled while building the firmware image.
* `-net none` disables the OptionROM execution which will interfere with the firmware image, if not disabled.
* `-machine q35,smm=on` For SMM to work, only Q35 machines are supported hence the machine type.
2. After executing the above qemu command, one should be able to see the UEFI built-in shell and should be able to get to the BIOS selection area.
3. The features which are enabled in the `OvmfPkgX64.dsc` can be verified in the `BIOS menu` and also at the `Device Manager section` and the Dasharo features can be verified at the `Dasharo System Features` section.
## Useful Tips for modifying the changes in .DSC & .FDF
### Following the below guide, one can rebuild the firmware image and run it in the qemu and experiment with the features which are needed.
1. By making some changes in the `OvmfPkgX64.dsc` file, one can add features like OPAL, SATA security support for QEMU Q35 machine and also for specific platforms.
* An example of where the changes can be made in the `OvmfPkgX64.dsc` file is given below.
> The following changes describe about defining in the **Defines Section** of `OvmfPkgX64.dsc`
```bash
# Defines for default states. These can be changed on the command line.
# -D FLAG=VALUE
#
(...)
DEFINE SATA_PASSWORD_ENABLE = TRUE
DEFINE OPAL_PASSWORD_ENABLE = TRUE
```
* Include the appropriate libraries in the **Libraries Section** of `OvmfPkgX64.dsc`
```bash
#
# OPAL_PASSWORD
#
!if $(OPAL_PASSWORD_ENABLE) == TRUE
TcgStorageCoreLib|SecurityPkg/Library/TcgStorageCoreLib/TcgStorageCoreLib.inf
TcgStorageOpalLib|SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalLib.inf
!endif
S3BootScriptLib|MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf
#
#
```
> Depending upon the feature, proper PCD's must be defined in the `OvmfPkgX64.dsc` file.
* Addition of the components in the **Components Section** of `OvmfPkgX64.dsc` file.
```bash
### SATA_PASSWORD
!if $(SATA_PASSWORD_ENABLE) == TRUE
SecurityPkg/HddPassword/HddPasswordPei.inf
!endif
#
#
```
2. The .FDF file tells about the location of the source file and options to be used for the build process.
* Below code snippet shows about the location of the `SATA_PASSWORD` .inf file.
```bash
!if $(SATA_PASSWORD_ENABLE) == TRUE
INF SecurityPkg/HddPassword/HddPasswordDxe.inf
!endif
```
> It is important to include all the necessary source file locations to point out the source libraries in .FDF file
* Below is the snippet of the SATA_PASSWORD support in `Device Manager`.
![SATA_PASSWORD](images/q35-dasharo-device-manager.png)
3. By default the `Dasharo System Features` are disabled in the **DasharoSystemFeatures.dec** file which describes the configuration of the platform.
* The flags can be toggled in order to enable the `Dasharo System Features` and view the features in `BIOS Menu => Dasharo System Features` menu.
```bash
[PcdsFixedAtBuild]
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowMenu|TRUE|BOOLEAN|0x00000001
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowSecurityMenu|TRUE|BOOLEAN|0x00000002
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowIntelMeMenu|TRUE|BOOLEAN|0x00000003
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowUsbMenu|TRUE|BOOLEAN|0x00000004
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowNetworkMenu|TRUE|BOOLEAN|0x00000005
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowChipsetMenu|TRUE|BOOLEAN|0x00000006
gDasharoSystemFeaturesTokenSpaceGuid.PcdDefaultNetworkBootEnable|FALSE|BOOLEAN|0x00000007
```
> In the above PCD definitions, please check the column after PCD definition in order to find the value of **TRUE/FALSE**.
>
> By toggling these flags, one can view the Dasharo System Features.
* The below image shows the Dasharo System Features enabled for the QEMU Q35 machine.
![DasharoSystemFeatures](images/q35-dasharo-features.png)
Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

+22
View File
@@ -0,0 +1,22 @@
# Overview
* [Releases](releases.md) - Groups information about all releases.
* [Building manual](building-manual.md) - describes how to build Dasharo (UEFI) for
the QEMU Emulator Q35 Machine type.
* [Test matrix](test-matrix.md) - describes the validation scope used during the
Dasharo firmware validation procedure.
* [Development](development.md) - describes information for running the Dasharo OVMF in QEMU Q35 machine and for Dasharo Developers.
## Useful documents
* [EDK2 OVMF Package Documentation](https://github.com/tianocore/edk2/blob/master/OvmfPkg/README)
* [Dasharo EDK2 repo for the reference](https://github.com/Dasharo/edk2)
+18
View File
@@ -0,0 +1,18 @@
# Release Notes
Following Release Notes describe status of Open Source Firmware development for
QEMU Q35 (Emulator).
## v0.1.0 - 2023-01-20
### Added
- Enabled TPM Support.
- Secure Boot Support for Q35 machine.
- Option to reset Secure Boot keys to defaults.
- Dasharo System Features.
- Dasharo setup password.
- OPAL disk password support.
- SATA disk password support.
- SMM Feature enabled.
+6
View File
@@ -144,6 +144,12 @@ nav:
- 'Recovery': variants/protectli_vp46xx/recovery.md
- 'Hardware Configuration Matrix': variants/protectli_vp46xx/hardware-matrix.md
- 'Test matrix': variants/protectli_vp46xx/test-matrix.md
- 'QEMU Q35 Emulator':
- 'Overview': variants/qemu_q35/overview.md
- 'Releases': variants/qemu_q35/releases.md
- 'Building manual': variants/qemu_q35/building-manual.md
- 'Development': variants/qemu_q35/development.md
- 'Test matrix': variants/qemu_q35/test-matrix.md
- 'MSI PRO Z690-A':
- 'Overview': variants/msi_z690/overview.md
- 'Releases': variants/msi_z690/releases.md