blob: 4ee25ee72f8f8c86f469702408856146cc59f9b5 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001require systemd.inc
2FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3
4require conf/image-uefi.conf
5
Patrick Williams2a254922023-08-11 09:48:11 -05006DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native"
Andrew Geissler595f6302022-01-24 19:11:47 +00007
8inherit meson pkgconfig gettext
9inherit deploy
10
11LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
12
Patrick Williams2a254922023-08-11 09:48:11 -050013EFI_LD = "bfd"
14LDFLAGS:append = " -fuse-ld=${EFI_LD}"
15
Andrew Geissler5082cc72023-09-11 08:41:39 -040016do_write_config[vardeps] += "EFI_LD"
Andrew Geissler595f6302022-01-24 19:11:47 +000017do_write_config:append() {
18 cat >${WORKDIR}/meson-${PN}.cross <<EOF
19[binaries]
Patrick Williams2a254922023-08-11 09:48:11 -050020c_ld = ${@meson_array('EFI_LD', d)}
Andrew Geissler595f6302022-01-24 19:11:47 +000021EOF
22}
23
Andrew Geissler5082cc72023-09-11 08:41:39 -040024MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross"
25
26MESON_TARGET = "systemd-boot"
27
Andrew Geissler595f6302022-01-24 19:11:47 +000028EXTRA_OEMESON += "-Defi=true \
Patrick Williams2a254922023-08-11 09:48:11 -050029 -Dbootloader=true \
Andrew Geissler595f6302022-01-24 19:11:47 +000030 -Dman=false \
Andrew Geissler595f6302022-01-24 19:11:47 +000031 "
32
33# install to the image as boot*.efi if its the EFI_PROVIDER,
34# otherwise install as the full name.
35# This allows multiple bootloaders to coexist in a single image.
36python __anonymous () {
37 import re
38 target = d.getVar('TARGET_ARCH')
39 prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
40 systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
41 d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
42 prefix = "systemd-" if prefix == "" else ""
43 d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
44}
45
46FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
47
48RDEPENDS:${PN} += "virtual-systemd-bootconf"
49
Andrew Geissler5082cc72023-09-11 08:41:39 -040050CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t"
Andrew Geissler595f6302022-01-24 19:11:47 +000051
52COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
53COMPATIBLE_HOST:x86-x32 = "null"
54
Andrew Geissler595f6302022-01-24 19:11:47 +000055do_install() {
56 install -d ${D}${EFI_FILES_PATH}
57 install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
58}
59
60do_deploy () {
61 install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
62 install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
Patrick Williams2a254922023-08-11 09:48:11 -050063 install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR}
Andrew Geissler595f6302022-01-24 19:11:47 +000064}
65
66addtask deploy before do_build after do_compile
67