diff options
| -rw-r--r-- | meta-oe/recipes-security/spdm-emu/spdm-emu_git.bb | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/meta-oe/recipes-security/spdm-emu/spdm-emu_git.bb b/meta-oe/recipes-security/spdm-emu/spdm-emu_git.bb new file mode 100644 index 0000000000..bc241b5594 --- /dev/null +++ b/meta-oe/recipes-security/spdm-emu/spdm-emu_git.bb | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | SUMMARY = "SPDM Emulator" | ||
| 2 | DESCRIPTION = "Sample SPDM emulator implementation using libspdm \ | ||
| 3 | for testing SPDM communication." | ||
| 4 | HOMEPAGE = "https://github.com/DMTF/spdm-emu" | ||
| 5 | |||
| 6 | LICENSE = "BSD-3-Clause" | ||
| 7 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=ed4cfe4688e1ac2cc2e6748766571949" | ||
| 8 | |||
| 9 | SRC_URI = "gitsm://github.com/DMTF/spdm-emu;protocol=https;branch=main" | ||
| 10 | |||
| 11 | SRCREV = "5fca359b15e4edd4f070ca83c9da02799b6f78ae" | ||
| 12 | inherit cmake pkgconfig systemd | ||
| 13 | |||
| 14 | DEPENDS = "openssl" | ||
| 15 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" | ||
| 16 | PACKAGECONFIG[systemd] = "-DENABLE_SYSTEMD=ON,-DENABLE_SYSTEMD=OFF,systemd" | ||
| 17 | |||
| 18 | SYSTEMD_SERVICE:${PN} = "spdm-responder-emu.service" | ||
| 19 | |||
| 20 | def get_spdm_multiarch(d): | ||
| 21 | target_arch = d.getVar('TARGET_ARCH') | ||
| 22 | multiarch_options = { | ||
| 23 | "x86_64": "x64", | ||
| 24 | "i586": "ia32", | ||
| 25 | "i686": "ia32", | ||
| 26 | "arm": "arm", | ||
| 27 | "aarch64": "aarch64", | ||
| 28 | "riscv32": "riscv32", | ||
| 29 | "riscv64": "riscv64", | ||
| 30 | "ppc64le": "ppc64le", | ||
| 31 | } | ||
| 32 | |||
| 33 | if target_arch in multiarch_options: | ||
| 34 | return multiarch_options[target_arch] | ||
| 35 | |||
| 36 | bb.fatal("unsupported architecture '%s'" % target_arch) | ||
| 37 | |||
| 38 | EXTRA_OECMAKE += "\ | ||
| 39 | -DARCH=${@get_spdm_multiarch(d)} \ | ||
| 40 | -DTOOLCHAIN=NONE \ | ||
| 41 | -DTARGET=Release \ | ||
| 42 | -DCRYPTO=openssl \ | ||
| 43 | -DENABLE_BINARY_BUILD=1 \ | ||
| 44 | -DCOMPILED_LIBCRYPTO_PATH=${libdir} \ | ||
| 45 | -DCOMPILED_LIBSSL_PATH=${libdir} \ | ||
| 46 | " | ||
| 47 | |||
| 48 | OECMAKE_TARGET_COMPILE += " copy_sample_key" | ||
| 49 | |||
| 50 | do_install:append() { | ||
| 51 | # Install binaries to /usr/bin | ||
| 52 | install -d ${D}${bindir} | ||
| 53 | install -m 0755 ${B}/bin/spdm_requester_emu ${D}${bindir}/ | ||
| 54 | install -m 0755 ${B}/bin/spdm_responder_emu ${D}${bindir}/ | ||
| 55 | install -m 0755 ${B}/bin/spdm_device_attester_sample ${D}${bindir}/ | ||
| 56 | install -m 0755 ${B}/bin/spdm_device_validator_sample ${D}${bindir}/ | ||
| 57 | |||
| 58 | # Install certificates/keys to /usr/share/spdm-emu | ||
| 59 | install -d ${D}${datadir}/spdm-emu | ||
| 60 | for f in ${B}/bin/*; do | ||
| 61 | case "$(basename $f)" in | ||
| 62 | spdm_requester_emu|spdm_responder_emu|spdm_device_attester_sample|spdm_device_validator_sample) | ||
| 63 | ;; | ||
| 64 | *) | ||
| 65 | if [ -d "$f" ]; then | ||
| 66 | cp -r --no-preserve=ownership $f ${D}${datadir}/spdm-emu/ | ||
| 67 | else | ||
| 68 | install -m 0644 $f ${D}${datadir}/spdm-emu/ | ||
| 69 | fi | ||
| 70 | ;; | ||
| 71 | esac | ||
| 72 | done | ||
| 73 | } | ||
| 74 | |||
| 75 | FILES:${PN} += "${datadir}/spdm-emu" | ||
