I am developing an operating system from scratch on the principle of "research through practice." The file for EFI is used for download. Interaction with EFI is reduced to a minimum. In VirtualBox, the file is launched once, depending on the contents of the ld script, or rather, on the settings of the beginning of the image.
On a real machine, without any conclusions, simply returns to the boot menu or displays that there is no loadable media.
It is difficult to cite something as an example to show the problem. The code can be obtained by reference .
Googling gives absolutely nothing in this respect (I could be wrong).