Quote:
One issue I have with using the LoadImage function is that I am unable to specify a specific memory location for the file to be loaded to and I am also unable to get a pointer to where the file was loaded. One other question is how the Device Path type works and how to specify one.
In fact, if you want to control a location where to load your image you need 1) to allocate the buffer at that location (AllocatePages()), and only after successful allocation, load there your image. This is done by EFI_FILE_PROTOCOL. First you obtain instance of EFI_FILE_PROTOCOL for the root directory of the volume where your image resides (through the volume's instance EFI_SIMPLE_FILE SYSTEM_PROTOCOL OpenVolume() function), the volume should be a FAT partition. then find your file, using EFI_FILE_PROTOCOL functions. Then read your file, using them as well. Read EFI_FILE_PROTOCOL.
But it's not that easy. You should behave as a proper OSLoader - taking over the control of the FW, calling GetMemoryMap() and ExitBootServices(). This phase is not as easy as just loading the file and jumping at it. For example, if you won't take control over, calling ExitBootServices(), FW still will run (the timer ISR, also watchdog, which might reset the board).