1*b58112e5SPatrick Williamsrequire systemd.inc
2*b58112e5SPatrick WilliamsFILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3*b58112e5SPatrick Williams
4*b58112e5SPatrick Williamsrequire conf/image-uefi.conf
5*b58112e5SPatrick Williams
6*b58112e5SPatrick WilliamsDEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native"
7*b58112e5SPatrick Williams
8*b58112e5SPatrick Williamsinherit meson pkgconfig gettext
9*b58112e5SPatrick Williamsinherit deploy
10*b58112e5SPatrick Williams
11*b58112e5SPatrick WilliamsLDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
12*b58112e5SPatrick Williams
13*b58112e5SPatrick WilliamsEFI_LD = "bfd"
14*b58112e5SPatrick WilliamsLDFLAGS:append = " -fuse-ld=${EFI_LD}"
15*b58112e5SPatrick Williams
16*b58112e5SPatrick Williamsdo_write_config[vardeps] += "EFI_LD"
17*b58112e5SPatrick Williamsdo_write_config:append() {
18*b58112e5SPatrick Williams    cat >${WORKDIR}/meson-${PN}.cross <<EOF
19*b58112e5SPatrick Williams[binaries]
20*b58112e5SPatrick Williamsc_ld = ${@meson_array('EFI_LD', d)}
21*b58112e5SPatrick WilliamsEOF
22*b58112e5SPatrick Williams}
23*b58112e5SPatrick Williams
24*b58112e5SPatrick WilliamsMESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross"
25*b58112e5SPatrick Williams
26*b58112e5SPatrick WilliamsMESON_TARGET = "systemd-boot"
27*b58112e5SPatrick Williams
28*b58112e5SPatrick WilliamsEXTRA_OEMESON += "-Defi=true \
29*b58112e5SPatrick Williams                  -Dbootloader=true \
30*b58112e5SPatrick Williams                  -Dman=false \
31*b58112e5SPatrick Williams                  "
32*b58112e5SPatrick Williams
33*b58112e5SPatrick Williams# install to the image as boot*.efi if its the EFI_PROVIDER,
34*b58112e5SPatrick Williams# otherwise install as the full name.
35*b58112e5SPatrick Williams# This allows multiple bootloaders to coexist in a single image.
36*b58112e5SPatrick Williamspython __anonymous () {
37*b58112e5SPatrick Williams    import re
38*b58112e5SPatrick Williams    target = d.getVar('TARGET_ARCH')
39*b58112e5SPatrick Williams    prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
40*b58112e5SPatrick Williams    systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
41*b58112e5SPatrick Williams    d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
42*b58112e5SPatrick Williams    prefix = "systemd-" if prefix == "" else ""
43*b58112e5SPatrick Williams    d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
44*b58112e5SPatrick Williams}
45*b58112e5SPatrick Williams
46*b58112e5SPatrick WilliamsFILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
47*b58112e5SPatrick Williams
48*b58112e5SPatrick WilliamsRDEPENDS:${PN} += "virtual-systemd-bootconf"
49*b58112e5SPatrick Williams
50*b58112e5SPatrick WilliamsCFLAGS:append:libc-musl = " -D__DEFINED_wchar_t"
51*b58112e5SPatrick Williams
52*b58112e5SPatrick WilliamsCOMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
53*b58112e5SPatrick WilliamsCOMPATIBLE_HOST:x86-x32 = "null"
54*b58112e5SPatrick Williams
55*b58112e5SPatrick Williamsdo_install() {
56*b58112e5SPatrick Williams	install -d ${D}${EFI_FILES_PATH}
57*b58112e5SPatrick Williams	install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
58*b58112e5SPatrick Williams}
59*b58112e5SPatrick Williams
60*b58112e5SPatrick Williamsdo_deploy () {
61*b58112e5SPatrick Williams	install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
62*b58112e5SPatrick Williams	install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
63*b58112e5SPatrick Williams	install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR}
64*b58112e5SPatrick Williams}
65*b58112e5SPatrick Williams
66*b58112e5SPatrick Williamsaddtask deploy before do_build after do_compile
67*b58112e5SPatrick Williams
68