Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable TPM in uefi #2624

Merged
merged 2 commits into from
Jul 6, 2022
Merged

Conversation

giggsoff
Copy link
Contributor

@giggsoff giggsoff commented May 13, 2022

To use TPM devices with qemu (when we use uefi provided by eve-uefi package) we should enable support inside uefi. Right now I can see zero values inside PCRs when I try to use eve-uefi.

Also this PR enables TPM option in Makefile to use swtpm as TPM device for Qemu.

Signed-off-by: Petr Fedchenkov giggsoff@gmail.com

@giggsoff giggsoff requested review from eriknordmark and rvs as code owners May 13, 2022 09:36
@giggsoff giggsoff force-pushed the fix-tpm-uefi-support branch 2 times, most recently from 013f763 to fd0982a Compare May 16, 2022 11:42
Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The qemu parts should be ok, but I don't know the impact of setting the options in pkg/uefi/build.sh - can this have an impact when running on bare metal? @rvs can you take a look?

@giggsoff
Copy link
Contributor Author

@rvs can you please review this? Without this patch PCRs are not filling when we run EVE-OS in qemu using eve-uefi package.

@mikem-zed
Copy link
Contributor

mikem-zed commented Jun 15, 2022

I've been using the same patch for UEFI for a while and I can confirm it is working

Copy link
Contributor

@rvs rvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should be fine when it comes to rebuilding Tianocore with these flags. However, I'm not quite a fan of how it got hooked up to the Makefile logic. See comments.

Makefile Outdated
(echo 'set devicetree="(hd0,msdos1)/eve.dtb"' ; echo 'set rootfs_root=/dev/vdb' ; echo 'set root=hd1' ; echo 'export rootfs_root' ; echo 'export devicetree' ; echo 'configfile /EFI/BOOT/grub.cfg' ) > $(EFI_PART)/BOOT/grub.cfg
$(QEMU_SYSTEM) $(QEMU_OPTS) -drive file=$(ROOTFS_IMG),format=raw -drive file=fat:rw:$(EFI_PART)/..,label=CONFIG,id=uefi-disk,format=vvfat
$(QUIET): $@: Succeeded

run-grub: $(BIOS_IMG) $(UBOOT_IMG) $(EFI_PART) $(DEVICETREE_DTB)
run-grub: $(BIOS_IMG) $(UBOOT_IMG) $(EFI_PART) $(DEVICETREE_DTB) swtpm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, why do we need swtpm in all these targets? I say -- let's make it conditional at least.

Copy link
Contributor Author

@giggsoff giggsoff Jun 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condition is inside swtpm target. I want to run swtpm as part of make TPM=y run... command.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that it would me much nicer if this followed (some) of the other makefile logic and was a SWTPM variable that would resolve to an empty string conditionally.

I understand that this is highly subjective -- I just absolutely dislike mixing these types of "styles" in Makefile (makefiles are ugly as it is and super convoluted).

To use TPM devices with qemu we should enable support inside uefi

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
@giggsoff giggsoff force-pushed the fix-tpm-uefi-support branch from fd0982a to 179af52 Compare June 29, 2022 14:58
@giggsoff giggsoff requested a review from rvs June 29, 2022 18:35
Makefile Outdated
(echo 'set devicetree="(hd0,msdos1)/eve.dtb"' ; echo 'set rootfs_root=/dev/vdb' ; echo 'set root=hd1' ; echo 'export rootfs_root' ; echo 'export devicetree' ; echo 'configfile /EFI/BOOT/grub.cfg' ) > $(EFI_PART)/BOOT/grub.cfg
$(QEMU_SYSTEM) $(QEMU_OPTS) -drive file=$(ROOTFS_IMG),format=raw -drive file=fat:rw:$(EFI_PART)/..,label=CONFIG,id=uefi-disk,format=vvfat
$(QUIET): $@: Succeeded

run-grub: $(BIOS_IMG) $(UBOOT_IMG) $(EFI_PART) $(DEVICETREE_DTB)
run-grub: $(BIOS_IMG) $(UBOOT_IMG) $(EFI_PART) $(DEVICETREE_DTB) swtpm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that it would me much nicer if this followed (some) of the other makefile logic and was a SWTPM variable that would resolve to an empty string conditionally.

I understand that this is highly subjective -- I just absolutely dislike mixing these types of "styles" in Makefile (makefiles are ugly as it is and super convoluted).

Makefile Outdated
Comment on lines 43 to 44
# Use tpm (any non-empty value will trigger using it)
TPM=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we document this in the markdown file which has the examples of how to build and run?

Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
@giggsoff giggsoff force-pushed the fix-tpm-uefi-support branch from 179af52 to c550d14 Compare July 6, 2022 18:11
Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run eden again

@eriknordmark eriknordmark merged commit 4bfe4a0 into lf-edge:master Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants