xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-core/systemd/systemd-boot_250.5.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1require 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
22EFI_LD = "bfd"
23
24EXTRA_OEMESON += "-Defi=true \
25                  -Dgnu-efi=true \
26                  -Defi-includedir=${STAGING_INCDIR}/efi \
27                  -Defi-libdir=${STAGING_LIBDIR} \
28                  -Defi-ld=${EFI_LD} \
29                  -Dman=false \
30                  --cross-file ${WORKDIR}/meson-${PN}.cross \
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.
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
50# Imported from the old gummiboot recipe
51TUNE_CCARGS:remove = "-mfpmath=sse"
52
53COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
54COMPATIBLE_HOST:x86-x32 = "null"
55
56do_compile() {
57	ninja \
58		src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} \
59		src/boot/efi/linux${EFI_ARCH}.efi.stub
60}
61
62do_install() {
63	install -d ${D}${EFI_FILES_PATH}
64	install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
65}
66
67do_deploy () {
68	install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
69	install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
70}
71
72addtask deploy before do_build after do_compile
73
74