Any macOS installer contains a folder (e.g. called EFIPayloads) with EFI firmware files named MP61_0116_B17_LOCKED.scap, MBP114_0172_B09_LOCKED.fd or similarly.
How does one create a working EFI partition from those?
What I do know already:
An EFI partition is a FAT32 volume with a folder structure like this:
EFI APPLE EXTENSIONS Firmware.scap (always there) FIRMWARE (optional) EfiUpdaterApp2.efi MP51_0087_00B_LOCKED.fd
What I do not understand:
Which files do I take from the macOS Installer, and where do I place them in the EFI volume? E.g, do I use the
.scapfile matching the Mac model and rename that to
Firmware.scap, whereas a model-matching
.fdfile (which may be optional) then goes into the
EfiUpdaterApp2.efineeded to run the firmware, or is that only a leftover from an older firmware update process and can be removed?
Can I create a universal EFI boot partition, containing the firmware for any Mac model, so that I can put that onto an external disk and boot practically any Mac from it for which I've included its .fd or .scap file?
This answer suggests that the files in the FIRMWARE folder are not loaded when booting the system but are rather just used to flash the ROM. So, if the particular Mac had already installed the particular file into its Flash ROM once, it won't be needed any more and can be removed from the EFI partition.
I also did a test where I renamed the top "EFI" folder to "EFI-OFF" and rebooted a MacBook Air 2015. This resulted in a new EFI folder being created in the EFI partition with the same Firmware.scap file. This suggests that neiter files need to be present at boot time at all, at least on recent Macs. Meaning there's no need to create a bootoable EFI partition at all. I wonder if it still may contain additional support for Macs whose boot ROMs can't be updated, such as adding support to boot from APFS volumes, perhaps.
Recently, a friend got his EFI boot partition overwritten, whereas his main Mac boot partition had remained intact. Without this EFI partition, the Mac would not boot any more.
I then tried to repair the damage by copying my Mac's EFI partition to his Mac, using iBored (which I wrote myself, so I know what I was doing, trust me on that).
But that did not help - the Mac would still not boot.
After a while I figured that his rather old Mac (a MacBook Pro early-2009) probably required a different EFI firmware than the other Mac from which we tried copying the EFI firmware.
After some digging I found the mentioned .fd and .scap files in a macOS installer, which appears to prove my theory. Hence I would now like to get some more information on how this all fits together.