Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
EFI_GUID imageGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
status = BS->HandleProtocol(ImageHandle, &imageGuid, (VOID**)&loader);
EFI_GUID fsProt = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
status = BS->HandleProtocol(loader->DeviceHandle, &fsProt, (VOID**)&fileSys);
And the second call fails with EFI_ERROR_INVALID_PARAMETER.
Also, I am using the file handle obtained from the images structure.
Any suggestions?
Thanks,
nexos
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
uhm, do you start the image recursively? because loader->FilePath points to the file part of the of the device path of the image, whose Loaded Image Protocol instance is pointed to by the "loader" variable.
Also, use OpenProtocol() instead of HandleProtocol() for obtaining a protocol instance from the handle, the latter is deprecated. I do like this and it works:
Status = pbs->OpenProtocol(
gpLoadedImageProtocol->DeviceHandle,
&gEfiSimpleFileSystemGuid,
&gpSfspHomeDrive,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
ANT - NT-like OS for x64 and arm64. efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).
when you LoadImage() something, it means, you have 2 images - one, that is started by the FW (let it be Img0) and the other (Img1), you start through LoadImage()/StartImage(). you should provide Device Path to Img1, when doing LoadImage() for it. So the Device Path would be something like [storage-device-part]\efi\nexos\Img1.efi. If Img1 resides on the same volume as Img0, [storage-device-part] is the same as for Img0. The idea is you should know the Device Path of this image (generally speaking, your chainloading system should have it written somewhere in its configuration). what do you try to accomplish with feeding LoadImage() with memory mapped device path? it won't let you grab Img1 from its storage. and btw, why do you start UEFI with such an unnecessary and useless thing like "chainloading"?
ANT - NT-like OS for x64 and arm64. efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).