Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Is this something to do with the versions I am using?
make[2]: Leaving directory '/home/yaakov/osdev/build-gcc-x86_64-w64-mingw32/x86_64-w64-mingw32/libgcc'
make[1]: *** [Makefile:127: all-multi] Error 2
make[1]: Leaving directory '/home/yaakov/osdev/build-gcc-x86_64-w64-mingw32/x86_64-w64-mingw32/libgcc'
make: *** [Makefile all-target-libgcc] Error 2
I am compiling gcc-9.3.0
My compiler version is gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
EFI apps are Windows apps with a different subsystem. EFI firmware was very much influenced by MS, hence it uses the same ABI, executable format, function naming style, and so on as MS stuff.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Using a cross-compiler with GNU-EFI is generally a bad idea. The complexity demonstrated on that UEFI Bare Bones page showcases that well (uses some source files directly instead of a library for example).
I've added an explanation and linked https://wiki.osdev.org/GNU-EFI page which describes the preferred way how GNU-EFI should be used. On the other hand I've also linked the UEFI Bare Bones page on the GNU-EFI page for those who insist to use a cross-compiler.
bzt wrote:Using a cross-compiler with GNU-EFI is generally a bad idea. The complexity demonstrated on that UEFI Bare Bones page showcases that well (uses some source files directly instead of a library for example).
I've added an explanation and linked https://wiki.osdev.org/GNU-EFI page which describes the preferred way how GNU-EFI should be used. On the other hand I've also linked the UEFI Bare Bones page on the GNU-EFI page for those who insist to use a cross-compiler.
Cheers,
bzt
I have successfully (I think) followed the steps up to
Then I am bit confused as to what to do next. The tutorial says
Now you can copy main.efi to your EFI System Partition, and after boot run it from the EFI Shell. Or you can rename it to EFI\BOOT\BOOTX64.EFI and it should be executed automatically on boot.
I'm not sure what this means. Should I continue with the UEFI App Bare Bones from
Creating the FAT image
Next, create a FAT filesystem image.
jamesread wrote:Then I am bit confused as to what to do next. The tutorial says
Now you can copy main.efi to your EFI System Partition, and after boot run it from the EFI Shell. Or you can rename it to EFI\BOOT\BOOTX64.EFI and it should be executed automatically on boot.
I'm not sure what this means. Should I continue with the UEFI App Bare Bones from Creating the FAT image
This only means you have to copy your compiled file (main.efi) to the ESP partition (as EFI/BOOT/BOOTX64.EFI) so that the UEFI firmware could find it in boot-time. You can follow that tutorial, follow the steps on wiki UEFI page, follow the Bootable Disk tutorial, or use an existing image and replace that one file as I wrote here. The point is, you have to copy your loader to the ESP somehow, but it doesn't matter how you do it.
bzt wrote:Using a cross-compiler with GNU-EFI is generally a bad idea.
The example on the wiki only uses GNU-EFI for its UEFI headers and doesn't link against it or use its build system. It won't work correctly if you follow the typical GNU-EFI build process anyway, since it doesn't use InitializeLib() or uefi_call_wrapper().