blob: 515abc289befb02a5cfd5ea4519f5801252cba9e [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001require systemd.inc
2FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3
Brad Bishopa34c0302019-09-23 22:34:48 -04004require conf/image-uefi.conf
5
Brad Bishop19323692019-04-05 15:28:33 -04006DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native"
7
8# NOTE: These three patches are in theory not needed, but we haven't
9# figured out how to correctly pass efi-cc parameter if it's an array.
10SRC_URI += "file://0001-Revert-meson-use-an-array-option-for-efi-cc.patch \
11 file://0001-Revert-meson-print-EFI-CC-configuration-nicely.patch \
12 file://0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch \
Brad Bishop08902b02019-08-20 09:16:51 -040013 file://0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch \
Brad Bishop19323692019-04-05 15:28:33 -040014 "
15
16inherit meson pkgconfig gettext
17inherit deploy
18
19EFI_CC ?= "${CC}"
20EXTRA_OEMESON += "-Defi=true \
21 -Dgnu-efi=true \
22 -Defi-includedir=${STAGING_INCDIR}/efi \
23 -Defi-ldsdir=${STAGING_LIBDIR} \
24 -Defi-libdir=${STAGING_LIBDIR} \
25 -Dman=false \
26 -Defi-cc='${EFI_CC}' \
27 -Defi-ld='${LD}' \
Brad Bishop08902b02019-08-20 09:16:51 -040028 -Defi-objcopy='${OBJCOPY}' \
Brad Bishop19323692019-04-05 15:28:33 -040029 "
30
31# install to the image as boot*.efi if its the EFI_PROVIDER,
32# otherwise install as the full name.
33# This allows multiple bootloaders to coexist in a single image.
34python __anonymous () {
35 import re
36 target = d.getVar('TARGET_ARCH')
37 prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
Brad Bishopa34c0302019-09-23 22:34:48 -040038 systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
Brad Bishop19323692019-04-05 15:28:33 -040039 d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
40 prefix = "systemd-" if prefix == "" else ""
41 d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
42}
43
Brad Bishopa34c0302019-09-23 22:34:48 -040044FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
Brad Bishop19323692019-04-05 15:28:33 -040045
46RDEPENDS_${PN} += "virtual/systemd-bootconf"
47
48# Imported from the old gummiboot recipe
49TUNE_CCARGS_remove = "-mfpmath=sse"
50COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
51COMPATIBLE_HOST_x86-x32 = "null"
52
53do_compile() {
54 SYSTEMD_BOOT_EFI_ARCH="ia32"
55 if [ "${TARGET_ARCH}" = "x86_64" ]; then
56 SYSTEMD_BOOT_EFI_ARCH="x64"
57 fi
58
59 ninja src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE}
60}
61
62do_install() {
Brad Bishopa34c0302019-09-23 22:34:48 -040063 install -d ${D}${EFI_FILES_PATH}
64 install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
Brad Bishop19323692019-04-05 15:28:33 -040065}
66
67do_deploy () {
68 install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
69}
70addtask deploy before do_build after do_compile