View previous topic :: View next topic |
Author |
Message |
tenspd137 Guru
Joined: 22 Aug 2006 Posts: 391
|
Posted: Thu Nov 15, 2012 7:34 pm Post subject: How to compile uefi application with gentoo gnu-efi?[solved] |
|
|
Hi all,
I was interested in learning how to create UEFI applications. I installed the gnu-efi ebuild and found in the readme that objcopy needs to support efi-app-x86_64. when I do objcopy --help, there is no mention of efi-app-x86_64. I tried adding the multitarget useflag with no luck. I was wondering if anyone knows how to get a toolchain that supports efi or if there are any goosd tutorials ( I have not been able to find any) about using gentoo/linux to build efi apps.
Thanks!
Last edited by tenspd137 on Tue Dec 04, 2012 10:09 pm; edited 1 time in total |
|
Back to top |
|
|
srs5694 Guru
Joined: 08 Mar 2004 Posts: 434 Location: Woonsocket, RI
|
Posted: Thu Nov 15, 2012 8:29 pm Post subject: |
|
|
First of all, Gentoo's GNU-EFI is at version 3.0i, which is extremely old (September, 2009). The current version is 3.0s, although in my tests it doesn't work so well (binaries fail to execute). Version 3.0r works fine for me, so you might want to try downloading it from its Sourceforge page and installing it locally. FWIW, I filed a bug report requesting a version bump in April of this year, but it's gotten no official action, although this bug report includes links to local ebuilds.
As to your main question, my objcopy also doesn't show efi-app-x86_64 as a target, but it does work. Here's what I get for supported targets:
Code: |
objcopy: supported targets: elf64-x86-64 elf32-i386 elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex
|
When I compile my rEFInd using GNU-EFI, I get the following (among many other messages) in the make output:
Code: |
/usr/bin/objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
-j .rela -j .reloc --target=efi-app-x86_64 refind_x64.so refind_x64.efi
|
This doesn't produce any error, and in fact the binary works fine.
So the bottom line is: Don't worry about it unless it gives you problems. If that's the case, post back with details.
One more point: It's possible to compile EFI applications using the TianoCore EDK2 rather than GNU-EFI. TianoCore is a complete EFI implementation, so it's overkill just to compile EFI applications, but it can do the job. It's also got a weird (by Linux standards) compilation process, which can make it awkward to install and use from Linux. Most EFI programs developed for Linux users, such as the new Shim security tool and gummiboot boot loader, use GNU-EFI and won't compile with TianoCore. OTOH, TianoCore is much more up-to-date than GNU-EFI, and it's the better choice if you want to compile something developed with TianoCore or its predecessor development kits, such as an EFI shell program. Some tools, such as rEFInd, can be compiled either way. (rEFInd's ability to boot BIOS/legacy boot loaders depends on TianoCore features, though; you can't launch BIOS/legacy boot loaders if you compile rEFInd with GNU-EFI.) You can look at rEFInd's BUILDING.txt and Makefiles to learn how to use TianoCore in a more Linux/Unix-like manner. In the end, which tool is best may depend on what you want to compile (which specific existing program or your own program that you're writing from scratch). If you're writing a new program, understanding the EFI features you want to use may be important. |
|
Back to top |
|
|
tenspd137 Guru
Joined: 22 Aug 2006 Posts: 391
|
Posted: Tue Dec 04, 2012 10:10 pm Post subject: |
|
|
Thanks for replying - I got pulled off onto another project, and have not gotten back to this. Your suggestions should give me a really good start point though.
Thanks! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|