Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | require systemd.inc |
| 2 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" |
| 3 | |
| 4 | require conf/image-uefi.conf |
| 5 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 6 | DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 7 | |
| 8 | inherit meson pkgconfig gettext |
| 9 | inherit deploy |
| 10 | |
| 11 | LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " |
| 12 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 13 | EFI_LD = "bfd" |
| 14 | LDFLAGS:append = " -fuse-ld=${EFI_LD}" |
| 15 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 16 | do_write_config[vardeps] += "EFI_LD" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 17 | do_write_config:append() { |
| 18 | cat >${WORKDIR}/meson-${PN}.cross <<EOF |
| 19 | [binaries] |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 20 | c_ld = ${@meson_array('EFI_LD', d)} |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 21 | EOF |
| 22 | } |
| 23 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 24 | MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross" |
| 25 | |
| 26 | MESON_TARGET = "systemd-boot" |
| 27 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 28 | EXTRA_OEMESON += "-Defi=true \ |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 29 | -Dbootloader=true \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 30 | -Dman=false \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 31 | " |
| 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. |
| 36 | python __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 | |
| 46 | FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" |
| 47 | |
| 48 | RDEPENDS:${PN} += "virtual-systemd-bootconf" |
| 49 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 50 | CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t" |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 51 | |
| 52 | COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux" |
| 53 | COMPATIBLE_HOST:x86-x32 = "null" |
| 54 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 55 | do_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 | |
| 60 | do_deploy () { |
| 61 | install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} |
| 62 | install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR} |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 63 | install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR} |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | addtask deploy before do_build after do_compile |
| 67 | |