-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
OpenNetworkBoot: Add PXE and HTTP(S) Boot support #562
Open
mikebeaton
wants to merge
3
commits into
master
Choose a base branch
from
network-boot
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mikebeaton
changed the title
Network boot (replaces #554)
OpenNetworkBoot: Add PXE and HTTP(S) Boot support
Oct 8, 2024
mikebeaton
force-pushed
the
network-boot
branch
from
October 8, 2024 07:35
d63bd2b
to
650f201
Compare
Closed
mikebeaton
commented
Oct 8, 2024
Platform/OpenNetworkBoot/BmBoot.c
Outdated
Comment on lines
16
to
36
Expand the media device path which points to a BlockIo or SimpleFileSystem instance | ||
by appending EFI_REMOVABLE_MEDIA_FILE_NAME. | ||
|
||
@return The option number of the found boot option. | ||
@param DevicePath The media device path pointing to a BlockIo or SimpleFileSystem instance. | ||
@param FullPath The full path returned by the routine in last call. | ||
Set to NULL in first call. | ||
|
||
@return The next possible full path pointing to the load option. | ||
Caller is responsible to free the memory. | ||
**/ | ||
UINTN | ||
BmFindBootOptionInVariable ( | ||
IN EFI_BOOT_MANAGER_LOAD_OPTION *OptionToFind | ||
EFI_DEVICE_PATH_PROTOCOL * | ||
BmExpandMediaDevicePath ( | ||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, | ||
IN EFI_DEVICE_PATH_PROTOCOL *FullPath | ||
) | ||
{ | ||
EFI_STATUS Status; | ||
EFI_BOOT_MANAGER_LOAD_OPTION BootOption; | ||
UINTN OptionNumber; | ||
CHAR16 OptionName[BM_OPTION_NAME_LEN]; | ||
EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions; | ||
UINTN BootOptionCount; | ||
UINTN Index; | ||
|
||
OptionNumber = LoadOptionNumberUnassigned; | ||
|
||
// | ||
// Try to match the variable exactly if the option number is assigned | ||
// | ||
if (OptionToFind->OptionNumber != LoadOptionNumberUnassigned) { | ||
UnicodeSPrint ( | ||
OptionName, | ||
sizeof (OptionName), | ||
L"%s%04x", | ||
mBmLoadOptionName[OptionToFind->OptionType], | ||
OptionToFind->OptionNumber | ||
); | ||
Status = EfiBootManagerVariableToLoadOption (OptionName, &BootOption); | ||
|
||
if (!EFI_ERROR (Status)) { | ||
ASSERT (OptionToFind->OptionNumber == BootOption.OptionNumber); | ||
if ((OptionToFind->Attributes == BootOption.Attributes) && | ||
(StrCmp (OptionToFind->Description, BootOption.Description) == 0) && | ||
(CompareMem (OptionToFind->FilePath, BootOption.FilePath, GetDevicePathSize (OptionToFind->FilePath)) == 0) && | ||
(OptionToFind->OptionalDataSize == BootOption.OptionalDataSize) && | ||
(CompareMem (OptionToFind->OptionalData, BootOption.OptionalData, OptionToFind->OptionalDataSize) == 0) | ||
) | ||
{ | ||
OptionNumber = OptionToFind->OptionNumber; | ||
} | ||
|
||
EfiBootManagerFreeLoadOption (&BootOption); | ||
} | ||
} | ||
EFI_STATUS Status; | ||
EFI_HANDLE Handle; | ||
EFI_BLOCK_IO_PROTOCOL *BlockIo; | ||
VOID *Buffer; | ||
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff for BmBoot.c (here and onwards), as viewed at the second commit (which is why this comment says it is 'Outdated'), is misleading; the second commit only deletes lines, as can be seen e.g. with git diff --minimal network-boot~2 network-boot~
at the command line.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is simply a rebase (replacing #554), now that the previous two changes #552 #553 are merged.
I was surprised how much of network boot is done in the OVMF UI package. Hence needing to take (sometimes with small mods) several bits of that, in the files imported from EDK 2; and then needing to reimplement the rest of it, in the rest of this driver. Doing it that way means it works with existing network boot drivers, up to the top level of the network boot stack; and means it works, full stop, i.e. no need to try to work out from scratch the correct usage patterns for the lower level network libraries, which are very low level (e.g. you can't 'just' issue a GET or a POST in http, very far from it).
The three commits here are: 1. import three edk 2 files; 2. clean them down to just what I kept and modified; 3. everything else, so if you review just the third commit, it is much easier to see what I changed from the originals in BmBoot.c, BmBootDescription.c and TlsAuthConfigImpl.c.
As before, the biggest change for the rest of the project is switching to use the CryptoPkg intrinsics lib. Maybe that change per se could be discussed independent of reviewing the rest of this? (REFS: #555; acidanthera/audk#67; tianocore/edk2#6169 - based on these refs, I say a) we should use it, and b) we should leave it where it is (not move to MdePkg) for now.)