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

Source can't compile on latest EDK because gEfiLegacyBiosProtocolGuid removed #119

Open
nProtect opened this issue Apr 19, 2024 · 2 comments
Labels
bug Something isn't working question Questions

Comments

@nProtect
Copy link

nProtect commented Apr 19, 2024

Question description

Hello,

Seem source code can't compile if use with latest EDK because gEfiLegacyBiosProtocolGuid get removed.
Ref: https://edk2.groups.io/g/devel/topic/102518665

To temporary fix this, I need to comment this code to make it can compile on latest EDK

EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
Status = gBS->LocateProtocol(&gEfiLegacyBiosProtocolGuid,
	NULL,
	(VOID**)&LegacyBios);
ASSERT_EFI_ERROR(Status);

BootOptions[Index].Status = LegacyBios->LegacyBoot(LegacyBios,
	(BBS_BBS_DEVICE_PATH*)BootOptions[Index].FilePath,
	BootOptions[Index].OptionalDataSize,
	BootOptions[Index].OptionalData);

Is there any issue if I remove this code?

@nProtect nProtect added the question Questions label Apr 19, 2024
@Mattiwatti
Copy link
Owner

Indeed, EDK2 has removed all CSM support from OVMF. I actually ran into this issue a while ago, and I have fixed this locally by simply copying the minimum amount of code necessary from OVMF so that the same code in EfiGuard's loader can continue to compile (as the protocol and its GUID are actually used in 'real' PC firmware, not just OVMF, and I do not want to remove the code, as it prevents people from mistakenly thinking EfiGuard is not working when the real issue is the fact that their Windows is installed in BIOS mode.)

My main issue at the moment is actually the fact that I don't wish to encourage compilation using EDK2 master in the first place, but for different reasons: see #112, which is a more serious bug in current edk2 master that I do not currently have a fix or workaround for. Nevertheless, I will probably commit and push a fix for this sometime in the next few days, assuming I find time to test it.

To answer your question:

Is there any issue if I remove this code?

Nope. This code was only added as a way to help out idiots who are trying to use EfiGuard on a legacy (BIOS/MBR) installation of Windows, and point out to them why this is not going to work. Assuming you are using EfiGuard on an EFI installation of Windows as intended, this code will never be executed, and it is safe to remove it.

@Mattiwatti Mattiwatti added the bug Something isn't working label Apr 22, 2024
@nProtect
Copy link
Author

Indeed, EDK2 has removed all CSM support from OVMF. I actually ran into this issue a while ago, and I have fixed this locally by simply copying the minimum amount of code necessary from OVMF so that the same code in EfiGuard's loader can continue to compile (as the protocol and its GUID are actually used in 'real' PC firmware, not just OVMF, and I do not want to remove the code, as it prevents people from mistakenly thinking EfiGuard is not working when the real issue is the fact that their Windows is installed in BIOS mode.)

My main issue at the moment is actually the fact that I don't wish to encourage compilation using EDK2 master in the first place, but for different reasons: see #112, which is a more serious bug in current edk2 master that I do not currently have a fix or workaround for. Nevertheless, I will probably commit and push a fix for this sometime in the next few days, assuming I find time to test it.

To answer your question:

Is there any issue if I remove this code?

Nope. This code was only added as a way to help out idiots who are trying to use EfiGuard on a legacy (BIOS/MBR) installation of Windows, and point out to them why this is not going to work. Assuming you are using EfiGuard on an EFI installation of Windows as intended, this code will never be executed, and it is safe to remove it.

Thank you. I only modify some to use only myself and my windows installed as UEFI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Questions
Projects
None yet
Development

No branches or pull requests

2 participants