4 ms·
> 1. IIUC PE executables are Windows executables. So a Linux system that targets UEFI ends up writing a PE executable to the EFI System Partition? Short answer
by rft 3y ago
> 1. IIUC PE executables are Windows executables. So a Linux system that targets UEFI ends up writing a PE executable to the EFI System Partition?
Short answer: Yes.
Longer answer: Yes, but it is not exactly a classic Windows desktop application. A PE file itself is at its core just a way to store data in a somewhat structured way. It has metadata (like imports/exports and the target architecture) and actual contents (like data and code). I think it is a good idea to reuse an already existing, common executable file format for this use case. That the choice was PE instead of ELF or Mach-O is, IMO, the result of Microsoft being in the UEFI consortium. They are a big player and likely pushed for this. Whether or not ELF would have been a better choice, I can not say, but at this point I don't think it matters.
More info on that topic at OSDev Wiki: https://wiki.osdev.org/UEFI#Binary_Format https://wiki.osdev.org/UEFI#Binary_Format
File output on my GRUB install:
/boot/EFI/GRUB/grubx64.efi: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows, 4 sections
- Brian_K_White 3y ago"I think it is a good idea to reuse an already existing, common executable file format for this use case." Similarly how many file formats are actually just pkzip files with standardzied names and contents.