BVintila
BVintila

Reputation: 163

EFI application - LoadImage fails with EFI_NOT_FOUND for mtftp downloaded file

I'm using EDK2 and C for this application. I'm doing PXE over IPv6. I have a UEFI application that downloads the file "bootmgfw.efi" which is the Windows EFI boot loader. I don't call mtftp() directly but through an EFI_LOAD_FILE_PROTOCOL. The image is downloaded as I saw the packets going through the network using Wireshark. The file size is also reported correctly. I can also have a sneak peek at the buffer and it seems to contain the right data. The issue I'm encountering is when calling LoadImage(). It returns EFI_NOT_FOUND.

Status = bootServices->LoadImage(TRUE, ImageHandle, loadFilePath, NULL, 0, &loadedBootProgram);

ImageHandle is what the entry point of the app receives. loadFilePath is a EFI_DEVICE_PATH_PROTOCOL pointer created by appending the file path of the currently loaded image file to itself.

*dummyPath = devPathUtilities->AppendDevicePath(thisImageFilePath, thisImageFilePath);

This approach works fine for IPv4 but not when I'm using IPv6. I do not know why (and it does not make sense to me) as it's old, existing code.

LoadImage works fine and StartImage as well when doing PXE over IPv4. Over IPv6 LoadImage returns EFI_NOT_FOUND, as previously stated. Googling this I found a IPv6_DEVICE_PATH that I think would do what I desire for IPv6, but I couldn't figure out how to create a EFI_DEVICE_PATH_PROTOCOL object with this. I also found the approach where one downloads the image, keeps it into the buffer and calls LoadImage by passing the buffer and a MEMORY_DEVICE_PATH object for it, but I don't want to do that as the image I'm loading needs to be aware it's being loaded from the network to further download the files it needs over the network as well.

I have also altered the contents of pxeProtocolInterface->Mode->ProxyOffer and set pxeProtocolInterface->Mode->ProxyOfferReceived to true as that was needed for a successful IPv4 StartImage call.

Documentation of LoadImage() does not mention anything IPv6 specific. The image I'm trying to load is not corrupted as it loads fine if it's the first PXE specified image.

Now the question is: how can I make it work for IPv6 or what am I doing wrong?

Upvotes: 1

Views: 71

Answers (0)

Related Questions