bochs-emu / Bochs

Bochs - Cross Platform x86 Emulator Project
https://bochs.sourceforge.io/
GNU Lesser General Public License v2.1
792 stars 94 forks source link

Add TPM 1.2, 2.0 emulation, UEFI with Secure Boot emulation on Bochs x86 emulator #265

Open youself64github opened 5 months ago

youself64github commented 5 months ago

Windows 11 requires TPM 2.0 and UEFI with Secure Boot and also, Some OSes only work in UEFI and not in Legacy BIOS, So Bochs x86 emulator needs to add TPM 1.2, TPM 2.0, UEFI BIOS with Secure Boot Support emulation.

DrChat commented 4 months ago

Some prior work/discussion with UEFI: https://sourceforge.net/p/bochs/mailman/bochs-developers/thread/020e01caf5f5%24c4c7c6e0%244e5754a0%24%40com/ https://forum.osdev.org/viewtopic.php?f=1&t=33440

Note that Bochs actually already effectively supports UEFI. I had to bump BIOSROMSZ, and OVMF loads up just fine.

DrChat commented 4 months ago

Note that OVMF does not embed ACPI tables anymore - they defer to qemu via a pseudo fwcfg device: https://vinxue.github.io/2022/03/01/ovmf_uefi_with_acpi.html

https://github.com/tianocore/edk2/blob/ccf91b518f22102d446f26320110d30ea0fc1fa9/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c#L45 https://github.com/tianocore/edk2/blob/ccf91b518f22102d446f26320110d30ea0fc1fa9/OvmfPkg/Library/AcpiPlatformLib/QemuFwCfgAcpi.c#L1099

This would need to be implemented by Bochs in order to boot into Windows. Specifically, the bootloader requires the MADT table.

DrChat commented 4 months ago

@stlintel Would you accept a PR that bumps BIOSROMSZ to 4M? It's needed in order to run a standard OVMF build.

I am not alone here. I think it can be accepted.

DrChat commented 4 months ago

Note: For reference, I'm using OVMF based on edk2-stable202105 with this patchset: bochs.patch

youself64github commented 2 months ago

I tried OVMF bios on Bochs, but it panics then Bochs crashed for me.

godmar commented 1 month ago

Could you clarify - are you saying that Bochs 2.7/2.8 does not provide ACPI tables such as the RSDT and MADT at all when used with its default BIOS?

I just updated our teaching OS to implement ACPI (since Qemu is phasing out MPP tables) and although we mostly use Qemu, we'd love to retain the ability to support Bochs as well, but ideally not at the price of having both an ACPI and an MPP based implementation - we'd like to keep our code small.

godmar commented 1 month ago

Could you clarify - are you saying that Bochs 2.7/2.8 does not provide ACPI tables such as the RSDT and MADT at all when used with its default BIOS?

I just updated our teaching OS to implement ACPI (since Qemu is phasing out MPP tables) and although we mostly use Qemu, we'd love to retain the ability to support Bochs as well, but ideally not at the price of having both an ACPI and an MPP based implementation - we'd like to keep our code small.

Following up on my own question - no, Bochs does support ACPI tables in its default (legacy boot) configuration. This thread is about future UEFI support.