blob: 0c4e294192811f70e56083148f7bd1c8f7c18fb7 [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001SUMMARY = "Hafnium"
2DESCRIPTION = "A reference Secure Partition Manager (SPM) for systems that implement the Armv8.4-A Secure-EL2 extension"
3DEPENDS = "gn-native ninja-native bison-native bc-native dtc-native openssl-native"
4
5LICENSE = "BSD-3-Clause & GPL-2.0-only"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=782b40c14bad5294672c500501edc103"
7
8PACKAGE_ARCH = "${MACHINE_ARCH}"
9
Patrick Williams8dd68482022-10-04 07:57:18 -050010
11CLANGNATIVE = ""
12CLANGNATIVE:runtime-llvm = "clang-native"
13
14inherit deploy python3native pkgconfig ${CLANGNATIVE}
Brad Bishopbec4ebc2022-08-03 09:55:16 -040015
16SRC_URI = "gitsm://git.trustedfirmware.org/hafnium/hafnium.git;protocol=https;branch=master \
17 file://0001-define-_Noreturn-if-needed.patch \
18 file://host-ld.patch \
Patrick Williams8dd68482022-10-04 07:57:18 -050019 file://pkg-config-native.patch;patchdir=third_party/linux \
20 file://0001-Fix-build-with-clang-15.patch \
21 "
22SRCREV = "79e9522d26fc2a88a44af149034acc27312b73a1"
Brad Bishopbec4ebc2022-08-03 09:55:16 -040023S = "${WORKDIR}/git"
24B = "${WORKDIR}/build"
25
26COMPATIBLE_MACHINE ?= "invalid"
27COMPATIBLE_MACHINE:qemuarm64 = "qemuarm64"
28
29# Default build 'reference'
30HAFNIUM_PROJECT ?= "reference"
31
32# Platform must be set for each machine
33HAFNIUM_PLATFORM ?= "invalid"
34HAFNIUM_PLATFORM:qemuarm64 = "qemu_aarch64"
35
36# do_deploy will install everything listed in this variable. It is set by
37# default to hafnium
38HAFNIUM_INSTALL_TARGET ?= "hafnium"
39
40# set project to build
41EXTRA_OEMAKE += "PROJECT=${HAFNIUM_PROJECT}"
42
43EXTRA_OEMAKE += "OUT_DIR=${B}"
44
45# Don't use prebuilt binaries for gn and ninja
46EXTRA_OEMAKE += "GN=${STAGING_BINDIR_NATIVE}/gn NINJA=${STAGING_BINDIR_NATIVE}/ninja"
47
48do_configure[cleandirs] += "${B}"
49
50do_compile() {
51 oe_runmake -C ${S}
52}
53
54do_install() {
55 cd ${B}/${HAFNIUM_PLATFORM}_clang
56 install -d -m 755 ${D}/firmware
57 for bldfile in ${HAFNIUM_INSTALL_TARGET}; do
58 install -m 0755 $bldfile.bin $bldfile.elf ${D}/firmware/
59 done
60}
61
62FILES:${PN} = "/firmware/*.bin"
63FILES:${PN}-dbg = "/firmware/*.elf"
64SYSROOT_DIRS += "/firmware"
65INSANE_SKIP:${PN} = "ldflags"
66INSANE_SKIP:${PN}-dbg = "ldflags"
67# Build paths are currently embedded
68INSANE_SKIP:${PN}-dbg += "buildpaths"
69
70do_deploy() {
71 cp -rf ${D}/firmware/* ${DEPLOYDIR}/
72}
73addtask deploy after do_install
74
75python() {
76 # https://developer.trustedfirmware.org/T898
77 if d.getVar("BUILD_ARCH") != "x86_64":
78 raise bb.parse.SkipRecipe("Cannot be built on non-x86-64 hosts")
79}
Patrick Williams8dd68482022-10-04 07:57:18 -050080
81EXCLUDE_FROM_WORLD = "1"