blob: 23a64bf30d6d867f8fe252930496bbc95c6fdc09 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001require systemd.inc
2FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3
4require conf/image-uefi.conf
5
6DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native python3-jinja2-native"
7
8inherit meson pkgconfig gettext
9inherit deploy
10
11LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
12
13do_write_config[vardeps] += "CC OBJCOPY"
14do_write_config:append() {
15 cat >${WORKDIR}/meson-${PN}.cross <<EOF
16[binaries]
17efi_cc = ${@meson_array('CC', d)}
18objcopy = ${@meson_array('OBJCOPY', d)}
19EOF
20}
21
22# need to use ${HOST_PREFIX} here, otherwise ld.bfd could be used from HOSTTOOLS_NONFATAL
23EFI_LD = "bfd"
24
25EXTRA_OEMESON += "-Defi=true \
26 -Dgnu-efi=true \
27 -Defi-includedir=${STAGING_INCDIR}/efi \
28 -Defi-libdir=${STAGING_LIBDIR} \
29 -Defi-ld=${EFI_LD} \
30 -Dman=false \
31 --cross-file ${WORKDIR}/meson-${PN}.cross \
32 "
33
34# install to the image as boot*.efi if its the EFI_PROVIDER,
35# otherwise install as the full name.
36# This allows multiple bootloaders to coexist in a single image.
37python __anonymous () {
38 import re
39 target = d.getVar('TARGET_ARCH')
40 prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
41 systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
42 d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
43 prefix = "systemd-" if prefix == "" else ""
44 d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
45}
46
47FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
48
49RDEPENDS:${PN} += "virtual-systemd-bootconf"
50
51# Imported from the old gummiboot recipe
52TUNE_CCARGS:remove = "-mfpmath=sse"
53
54COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
55COMPATIBLE_HOST:x86-x32 = "null"
56
57do_compile() {
58 ninja \
59 src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} \
60 src/boot/efi/linux${EFI_ARCH}.efi.stub
61}
62
63do_install() {
64 install -d ${D}${EFI_FILES_PATH}
65 install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
66}
67
68do_deploy () {
69 install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
70 install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
71}
72
73addtask deploy before do_build after do_compile
74