3

I used gnu-efi.
I do not understand how to simply read file.
I understand about using the BlockIOProtocol.

Could you tell us along with a simple example?

unixsmurf
  • 5,852
  • 1
  • 33
  • 40

1 Answers1

5

I don't have a simple example handy, sorry. But in general you proceed like this

  • in EfiMain you have an IMAGE_HANDLE of your loaded image
  • use LOADED_IMAGE_PROTOCOL on the image handle to obtain an device handle of the device this image was loaded from (= the EFI partition)
  • Use SIMPLE_FILE_SYSTEM_PROTOCOL on the device handle to call OpenVolume, which will give you a EFI_FILE of the filesystem root
  • call Open on the root to open your file and Read on the resulting handle to read from it.
  • Don't forget to release all your handles afterwards.

Hope this helps.

mihi
  • 6,507
  • 1
  • 38
  • 48