blob: d37d638e097550e90c60b6f26bcbc35916aebb34 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001SUMMARY = "Libraries for producing EFI binaries"
2HOMEPAGE = "http://sourceforge.net/projects/gnu-efi/"
3DESCRIPTION = "GNU-EFI aims to 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."
4SECTION = "devel"
5LICENSE = "GPL-2.0-or-later | BSD-2-Clause"
6LIC_FILES_CHKSUM = "file://gnuefi/crt0-efi-arm.S;beginline=4;endline=16;md5=e582764a4776e60c95bf9ab617343d36 \
7 file://gnuefi/crt0-efi-aarch64.S;beginline=4;endline=16;md5=e582764a4776e60c95bf9ab617343d36 \
8 file://inc/efishellintf.h;beginline=13;endline=20;md5=202766b79d708eff3cc70fce15fb80c7 \
9 file://lib/arm/math.c;beginline=2;endline=15;md5=8ed772501da77b2b3345aa6df8744c9e \
10 file://lib/arm/initplat.c;beginline=2;endline=15;md5=8ed772501da77b2b3345aa6df8744c9e \
11 file://lib/aarch64/math.c;beginline=2;endline=15;md5=8ed772501da77b2b3345aa6df8744c9e \
12 file://lib/aarch64/initplat.c;beginline=2;endline=15;md5=8ed772501da77b2b3345aa6df8744c9e \
13 "
14
15SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/files/${BP}.tar.bz2 \
16 file://parallel-make-archives.patch \
17 file://gnu-efi-3.0.9-fix-clang-build.patch \
Patrick Williams2a254922023-08-11 09:48:11 -050018 file://0001-riscv64-adjust-type-definitions.patch \
19 file://0001-riscv64-ignore-unknown-relocs.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050020 "
21
Patrick Williams2a254922023-08-11 09:48:11 -050022SRC_URI[sha256sum] = "7807e903349343a7a142ebb934703a2872235e89688cf586c032b0a1087bcaf4"
Patrick Williams92b42cb2022-09-03 06:53:57 -050023
24COMPATIBLE_HOST = "(x86_64.*|i.86.*|aarch64.*|arm.*|riscv64.*)-linux"
25COMPATIBLE_HOST:armv4 = 'null'
26
27do_configure:linux-gnux32:prepend() {
28 cp ${STAGING_INCDIR}/gnu/stubs-x32.h ${STAGING_INCDIR}/gnu/stubs-64.h
29 cp ${STAGING_INCDIR}/bits/long-double-32.h ${STAGING_INCDIR}/bits/long-double-64.h
30}
31
32def gnu_efi_arch(d):
33 import re
34 tarch = d.getVar("TARGET_ARCH")
35 if re.match("i[3456789]86", tarch):
36 return "ia32"
37 return tarch
38
Patrick Williams2a254922023-08-11 09:48:11 -050039do_compile:prepend() {
40 unset LDFLAGS
41}
42
Patrick Williams92b42cb2022-09-03 06:53:57 -050043EXTRA_OEMAKE = "'ARCH=${@gnu_efi_arch(d)}' 'CC=${CC}' 'AS=${AS}' 'LD=${LD}' 'AR=${AR}' \
44 'RANLIB=${RANLIB}' 'OBJCOPY=${OBJCOPY}' 'PREFIX=${prefix}' 'LIBDIR=${libdir}' \
45 "
46
47# gnu-efi's Makefile treats prefix as toolchain prefix, so don't
48# export it.
49prefix[unexport] = "1"
50
51do_install() {
52 oe_runmake install INSTALLROOT="${D}"
53}
54
Patrick Williams2a254922023-08-11 09:48:11 -050055FILES:${PN} += "${libdir}/*.lds ${libdir}/gnuefi/apps"
Patrick Williams92b42cb2022-09-03 06:53:57 -050056
57# 64-bit binaries are expected for EFI when targeting X32
58INSANE_SKIP:${PN}-dev:append:linux-gnux32 = " arch"
59INSANE_SKIP:${PN}-dev:append:linux-muslx32 = " arch"
60
61BBCLASSEXTEND = "native"
62
63# It doesn't support sse, its make.defaults sets:
64# CFLAGS += -mno-mmx -mno-sse
65# So also remove -mfpmath=sse from TUNE_CCARGS
66TUNE_CCARGS:remove = "-mfpmath=sse"
67
68python () {
69 ccargs = d.getVar('TUNE_CCARGS').split()
70 if '-mx32' in ccargs:
71 # use x86_64 EFI ABI
72 ccargs.remove('-mx32')
73 ccargs.append('-m64')
74 d.setVar('TUNE_CCARGS', ' '.join(ccargs))
75}