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