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