FS#59465 - [ovmf] compile with secure boot feature
Attached to Project:
Arch Linux
Opened by Frank (fau) - Friday, 27 July 2018, 15:58 GMT
Last edited by Eli Schwartz (eschwartz) - Sunday, 14 October 2018, 04:33 GMT
Opened by Frank (fau) - Friday, 27 July 2018, 15:58 GMT
Last edited by Eli Schwartz (eschwartz) - Sunday, 14 October 2018, 04:33 GMT
|
Details
Description:
Turn on compile time flag "-D SECURE_BOOT_ENABLE" to enable secure boot feature. Example build instructions can be found here: https://github.com/tianocore/tianocore.github.io/wiki/Testing-SMM-with-QEMU,-KVM-and-libvirt NOTE: Do not enable "-D SMM_REQUIRE" though! In my test build it made qemu failed to start. I don't know what the requirements are for SMM. NOTE: Follow instructions as given in the edk2 git tree to include openssl as a submodule: $EDK2_SOURCE/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt Having secure boot feature in ovmf would allow one to exercise secure boot and tools. Additional info: * package version(s) 1:r24021.3f34e36d04-1 |
This task depends upon
Closed by Eli Schwartz (eschwartz)
Sunday, 14 October 2018, 04:33 GMT
Reason for closing: Implemented
Additional comments about closing: ovmf 1:r24601.6861765935-1
Sunday, 14 October 2018, 04:33 GMT
Reason for closing: Implemented
Additional comments about closing: ovmf 1:r24601.6861765935-1
Would EXCLUDE_SHELL_FROM_FD be useful for us as well?
It is great to clarify why SMM_REQUIRE does not work.
It might be that I started qemu with parameters not compatible with the SMM feature. I found some more info here:
https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
I will have to try it again and see if that works for me.
I am looking at the instructions you mentioned (https://github.com/tianocore/tianocore.github.io/wiki/Testing-SMM-with-QEMU,-KVM-and-libvirt) and it mentions following build parametes
-D SMM_REQUIRE -D SECURE_BOOT_ENABLE \
-D HTTP_BOOT_ENABLE -D TLS_ENABLE \
It would be great to resolve the issue with SSM_REQUIRE as well.
The README (https://github.com/tianocore/edk2/blob/master/OvmfPkg/README) states a couple of things how to start qemu to get SMM to work with qemu.
I will also try it with SMM_REQUIRE again and following those instructions to see if it works then.
EDIT: typo
If you want you can close this now.
I further investigated why that SMM_REQUIRE doesn't work. I got it to work now and attached a patch for the PKGBUILD [testing].
You will notice in the patch: "-a IA32 -a X64 -p OvmfPkg/OvmfPkgIa32X64.dsc". I chose that config based on what is written here:
https://github.com/tianocore/tianocore.github.io/wiki/Testing-SMM-with-QEMU,-KVM-and-libvirt#install-ovmf-from-source
QUOTE: We build the Ia32 (32-bit PEI and DXE) and Ia32X64 (32-bit PEI, 64-bit DXE) OVMF platforms because they support ACPI S3 suspend/resume and SMM at the same time. S3 is a demanding use case for the SMM infrastructure, therefore we should enable this combination.
QUOTE: The X64 build of OVMF does not support the same yet (UefiCpuPkg/Universal/Acpi/S3Resume2Pei forces OVMF to choose between S3 and SMM). Thankfully, the PEI bitness is entirely irrelevant to guest OSes, thus the Ia32X64 platform can be used identically, as far as OS-facing functionality is concerned.
So there's no harm using 32bit PEI/DXE on 64bit hosts (that's how I understand this).
If we build with "-a X64 -p OvmfPkg/OvmfPkgX64.dsc" then S3 suspend/resume has to be explicitly disabled on the qemu command line via "-global ICH9-LPC.disable_s3=1" otherwise qemu will hang.
Further, SMM_REQUIRE requires that qemu is started with the q35 machine type and other settings which are documented here: https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
To summarize it, you have to start qemu like this:
-machine type=q35,smm=on,accel=kvm
-global driver=cfi.pflash01,property=secure,value=on
-global ICH9-LPC.disable_s3=0
-drive if=pflash,format=raw,unit=0,file=${ovmf_code},readonly
-drive if=pflash,format=raw,unit=1,file=${ovmf_vars}
ovmf_code would be set to /usr/share/ovmf/x64/OVMF_CODE.fd
and ovm_var would be set to a copy of /usr/share/ovmf/x64/OVMF_VARS.fd.
I'm not sure what release is targeted in the PKGBUILD. May I suggest we target the latest stable release, here's the announcement: https://lists.01.org/pipermail/edk2-devel/2018-August/028604.html
I also tried to compile with the newest openssl lib but it fails for me so I guess we have to go with what openssl-1.1.0h as it is right now.
It uses the latest stable release as announced here:
https://lists.01.org/pipermail/edk2-devel/2018-August/028604.html
All options are activated, same as in the Fedora build.
I tested the build with qemu and secure boot works for me.
A build without SB (secure boot) is straightforward to use with qemu.
And a build with SB+SMM_REQUIRE would provide a full featured SB environment.
We could still opt for leaving out SMM_REQUIRE (due to the requirement it imposes on the qemu setup). However, now that we have confirmed it works with SMM_REQUIRE I'd include that.
For now I am going to release fw with secureboot but without SMM support. And SMM request should go to a separate bug if needed.
Frank, are you OK with it?