Hello,
I'm trinying to load a EFI\BOOT\Bootx64.efi-image from a specific partition
using the UEFI LoadImage() function.
But I think I have some difficulties to build a correct DevicePath to the
image.
Right now I do it the following way, but the LoadImage() function gets stuck
in a Deadloop:
struct {
EFI_DEVICE_PATH_PROTOCOL Header;
CHAR16 FileName[22];
EFI_DEVICE_PATH_PROTOCOL end;
} ApplicationFilePath = {
{
MEDIA_DEVICE_PATH,
MEDIA_FILEPATH_DP,
46
},
{ L"EFI\\BOOT\\BOOTx64.EFI"},
{
END_DEVICE_PATH, END_ENTIRE_SUBTYPE,
sizeof(EFI_DEVICE_PATH_PROTOCOL)
}
};
EFI_DEVICE_PATH_PROTOCOL *pApplicationFilePath = (EFI_DEVICE_PATH_PROTOCOL
*)&ApplicationFilePath;
// Get all BlockIO-Protocols
Status =
pBS->LocateHandleBuffer(ByProtocol,&gEfiBlockIoProtocolGuid,NULL,&Count,&Han
dle);
for( i=0; i<Count; i++ ){
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_DEVICE_PATH_PROTOCOL *PartitionDevicePath,
*TmpDevicePath;
EFI_DEVICE_PATH_PROTOCOL *pApplicationPath = NULL;
Status = pBS->HandleProtocol(Handle[i],
&gEfiDevicePathProtocolGuid, &PartitionDevicePath);
// Get last node of the device path. It should be partition
node
PartitionNode = (HARDDRIVE_DEVICE_PATH*)PartitionDevicePath;
for( TmpDevicePath = PartitionDevicePath;
!EfiIsDevicePathEndType(TmpDevicePath);
TmpDevicePath =
EfiNextDevicePathNode(TmpDevicePath) )
{
PartitionNode =
(HARDDRIVE_DEVICE_PATH*)TmpDevicePath;
}
// Here I'm looking for a specific partition and check some
Header-Parameter
if (PartitionNode->Header.Type != MEDIA_DEVICE_PATH ||
PartitionNode->Header.SubType !=
MEDIA_HARDDRIVE_DP ||
PartitionNode->SignatureType != 0x02 ||
MemCmp(&PartitionNode->Signature,
gGuidOfASpecificPartition, sizeof(EFI_GUID)) != 0)
continue;
Status =
pBS->LocateProtocol(&gEfiDevicePathUtilitiesProtocolGuid,
NULL,(VOID**)&pDevicePathUtils);
// Build the whole DevicePath
pApplicationPath =
pDevicePathUtils->AppendDevicePath(PartitionDevicePath,pApplicationFilePath)
;
// Try to load the Image using the built DevicePath
Status = pBS->LoadImage
(TRUE,ImageHandle,pApplicationPath,NULL,0,&Handle);
// But it resaults in a deadloop
}
I would appreciate any hints on what I'm missing.
Thank you,
Michael
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel