ncroxon / gnu-efi Goto Github PK
View Code? Open in Web Editor NEWDevelop EFI applications for ARM-64, ARM-32, x86_64, IA-64 (IPF), IA-32 (x86), and MIPS platforms using the GNU toolchain and the EFI development environment.
Develop EFI applications for ARM-64, ARM-32, x86_64, IA-64 (IPF), IA-32 (x86), and MIPS platforms using the GNU toolchain and the EFI development environment.
The files in the "lib" and "inc" subdirectories are using the EFI Application Toolkit distributed by Intel at http://developer.intel.com/technology/efi This code is covered by the following agreement: Copyright (c) 1998-2000 Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE EFI SPECIFICATION AND ALL OTHER INFORMATION ON THIS WEB SITE ARE PROVIDED "AS IS" WITH NO WARRANTIES, AND ARE SUBJECT TO CHANGE WITHOUT NOTICE.
When compiling gnu-efi for mips64 on Ubuntu 24.04 (make ARCH=mips64 CROSS_COMPILE=mips64el-linux-gnuabi64-
), the following error is produced when building the apps:
mips64el-linux-gnuabi64-ld -nostdlib --warn-common --no-undefined --fatal-warnings --build-id=sha1 -z nocombreloc -z norelro -L/usr/src/gnu-efi//apps/../mips64el/lib -L/usr/src/gnu-efi//apps/../mips64el/gnuefi /usr/src/gnu-efi//apps/../mips64el/gnuefi/crt0-efi-mips64el.o -shared -Bsymbolic -L/usr/src/gnu-efi//apps/../mips64el/lib --defsym=EFI_SUBSYSTEM=0xa t.o -o t.so -T /usr/src/gnu-efi//apps/../gnuefi/elf_mips64el_efi.lds -lefi -lgnuefi /usr/lib/gcc-cross/mips64el-linux-gnuabi64/12/libgcc.a
mips64el-linux-gnuabi64-ld: /usr/src/gnu-efi//apps/../mips64el/gnuefi/crt0-efi-mips64el.o: in function `extra_header_fields':
(.text.head+0x9c): warning: internal error: unsupported relocation error
make[1]: *** [/usr/src/gnu-efi//apps/../Make.rules:52: t.so] Error 1
make[1]: Leaving directory '/usr/src/gnu-efi/mips64el/apps'
make: *** [Makefile:89: apps] Error 2
# mips64el-linux-gnuabi64-ld --version
GNU ld (GNU Binutils for Ubuntu) 2.42
This is likely to impact us with automated builds when GitHub Actions switches their ubuntu-latest
builder from 22.04 to 24.04 (and this issue was actually discovered when I tested some builds with GitHub Actions on their ubuntu-24.04
builder).
When trying to build using clang-18, and lld as linker, I get the below error.
clang -I/var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps -I/var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps/../inc -I/var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps/../inc/ia32 -I/var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps/../inc/protocol -Wno-error=pragmas -mno-mmx -mno-sse -mno-avx -fPIE -m32 -g -O2 -Wall -Wextra -Wno-pointer-sign -funsigned-char -fshort-wchar -fno-strict-aliasing -ffreestanding -fno-stack-protector -fno-stack-check -DCONFIG_ia32 -std=c11 -D__KERNEL__ -I/usr/src/sys/build/include -c /var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps/t.c -o t.o
ld.lld -nostdlib --warn-common --no-undefined --fatal-warnings --build-id=sha1 -z nocombreloc -shared -Bsymbolic -L/var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps/../ia32/lib -L/var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps/../ia32/gnuefi /var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps/../ia32/gnuefi/crt0-efi-ia32.o t.o -o t.so -lefi -lgnuefi /usr/lib/llvm/18/bin/../../../../lib/clang/18/lib/linux/libclang_rt.builtins-i386.a -T /var/tmp/portage/sys-boot/gnu-efi-3.0.18/work/gnu-efi-3.0.18//apps/../gnuefi/elf_ia32_efi.lds
ld.lld: error: section: .dynamic is not contiguous with other relro sections```
Mac's are arm64, but there is no compilation target for that under lib/*. I tried changing to arm and aarch64 but that for good reason doesn't work.
From https://sourceforge.net/p/gnu-efi/feature-requests/6/ by @pbatard
Created as an issue because gnu-efi should match EDK2
Dear gnu-efi team, @ncroxon,
Can you add a "move" box like https://sourceforge.net/projects/handbrake for example.
To disable/delete tabs, go here: https://sourceforge.net/projects/gnu-efi/
To add a new tab, go here: https://sourceforge.net/projects/gnu-efi/
To change informations, go here: https://sourceforge.net/p/gnu-efi/admin/overview
To export, go here: https://sourceforge.net/p/gnu-efi/admin/export
The new place can be added in:
Thanks in advance.
Despite having an explicit --defsym=EFI_SUBSYSTEM=0xb
in the linker command:
riscv64-linux-gnu-ld -nostdlib --warn-common --no-undefined --fatal-warnings --build-id=sha1 -z nocombreloc -z norelro -L/home/runner/work/gnu-efi/gnu-efi//apps/../riscv64/lib -L/home/runner/work/gnu-efi/gnu-efi//apps/../riscv64/gnuefi /home/runner/work/gnu-efi/gnu-efi//apps/../riscv64/gnuefi/crt0-efi-riscv64.o -shared -Bsymbolic -L/home/runner/work/gnu-efi/gnu-efi//apps/../riscv64/lib --defsym=EFI_SUBSYSTEM=0xb drv0.o -o drv0.so -T /home/runner/work/gnu-efi/gnu-efi//apps/../gnuefi/elf_riscv64_efi.lds -lefi -lgnuefi /usr/lib/gcc-cross/riscv64-linux-gnu/11/libgcc.a
It seems that the EFI subsystem is not properly applied to the RISCV64 driver, as the riscv64
artifacts from the build that produced https://github.com/ncroxon/gnu-efi/actions/runs/9159433032/job/25179796521 show that the drv0.efi
is still set as a UEFI Application (EFI_SUBSYSTEM=0xa
):
This is also confirmed by trying to load the driver in with an UEFI firmware in QEMU RISCV64, which fails because of the wrong subsystem type.
Considering that we have an explicit:
#ifndef EFI_SUBSYSTEM
#define EFI_SUBSYSTEM 10
#endif
in gnuefi/crt0-efi-riscv64.S
that we don't have in other archs, and that removing it produces the error:
gnuefi/crt0-efi-riscv64.S:70: Error: cannot represent BFD_RELOC_16 relocation in object file
I would think that the issue is that we need a delayed symbol resolution in crt0-efi-riscv64.o
(since it goes into libgnuefi.a
which we then link with the app, and which is the library that contains the PE header with the EFI_SUBSYSTEM
field), that either we haven't figured how to do, or that the current RISCV64 toolchain doesn't support yet...
It should be /usr/lib/debug/NORMALPATH but instead are being installed under apps directory
In Nixpkgs, we've found that gnu-efi 3.0.17 and 3.0.18 have serious regressions (NixOS/nixpkgs#234796 (comment), NixOS/nixpkgs#307063 (comment)) on aarch64-linux. For example, for efitools, a reverse dependency of gnu-efi:
sbsign --key DB.key --cert DB.crt --output HelloWorld-signed.efi HelloWorld.efi
Invalid DOS header magic
make: *** [Make.rules:123: HelloWorld-signed.efi] Error 1
rm HelloWorld.o
The full error log can be found at https://hydra.nixos.org/build/257666776. There's also a bug report on the same issue for Gentoo: https://bugs.gentoo.org/923101
As a bisection leads to 593e139, the same commit https://sourceforge.net/p/gnu-efi/bugs/37/ referred to, we believe that the issue on SourceForge is not actually resolved. Also, we're shipping binutils 2.41, if relevent.
Originally posted by gmbr3 May 7, 2024
macOS support (x86_64 only) was added to shim's gnu-efi
gnu-efi should move the crt0 for riscv64 to the objcopy type instead of the 'manual symbols' type as we now have efi-app-riscv64.
We should keep the original and rename it and allow detection of what is the default to prevent mix-ups like ARM64.
Relates to rhboot/shim#641
Use of wchar_t and -fshort-wchar is not permitted by musl libc toolchain. It only allows 32-bit wchar_t, we need CHAR16 to be 16-bit (obviously)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.