Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | require systemd.inc |
| 2 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" |
| 3 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame^] | 4 | require conf/image-uefi.conf |
| 5 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 6 | DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native" |
| 7 | |
| 8 | # NOTE: These three patches are in theory not needed, but we haven't |
| 9 | # figured out how to correctly pass efi-cc parameter if it's an array. |
| 10 | SRC_URI += "file://0001-Revert-meson-use-an-array-option-for-efi-cc.patch \ |
| 11 | file://0001-Revert-meson-print-EFI-CC-configuration-nicely.patch \ |
| 12 | file://0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch \ |
Brad Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame] | 13 | file://0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 14 | " |
| 15 | |
| 16 | inherit meson pkgconfig gettext |
| 17 | inherit deploy |
| 18 | |
| 19 | EFI_CC ?= "${CC}" |
| 20 | EXTRA_OEMESON += "-Defi=true \ |
| 21 | -Dgnu-efi=true \ |
| 22 | -Defi-includedir=${STAGING_INCDIR}/efi \ |
| 23 | -Defi-ldsdir=${STAGING_LIBDIR} \ |
| 24 | -Defi-libdir=${STAGING_LIBDIR} \ |
| 25 | -Dman=false \ |
| 26 | -Defi-cc='${EFI_CC}' \ |
| 27 | -Defi-ld='${LD}' \ |
Brad Bishop | 08902b0 | 2019-08-20 09:16:51 -0400 | [diff] [blame] | 28 | -Defi-objcopy='${OBJCOPY}' \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 29 | " |
| 30 | |
| 31 | # install to the image as boot*.efi if its the EFI_PROVIDER, |
| 32 | # otherwise install as the full name. |
| 33 | # This allows multiple bootloaders to coexist in a single image. |
| 34 | python __anonymous () { |
| 35 | import re |
| 36 | target = d.getVar('TARGET_ARCH') |
| 37 | prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-" |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame^] | 38 | systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE") |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 39 | d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage) |
| 40 | prefix = "systemd-" if prefix == "" else "" |
| 41 | d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix) |
| 42 | } |
| 43 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame^] | 44 | FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 45 | |
| 46 | RDEPENDS_${PN} += "virtual/systemd-bootconf" |
| 47 | |
| 48 | # Imported from the old gummiboot recipe |
| 49 | TUNE_CCARGS_remove = "-mfpmath=sse" |
| 50 | COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux" |
| 51 | COMPATIBLE_HOST_x86-x32 = "null" |
| 52 | |
| 53 | do_compile() { |
| 54 | SYSTEMD_BOOT_EFI_ARCH="ia32" |
| 55 | if [ "${TARGET_ARCH}" = "x86_64" ]; then |
| 56 | SYSTEMD_BOOT_EFI_ARCH="x64" |
| 57 | fi |
| 58 | |
| 59 | ninja src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} |
| 60 | } |
| 61 | |
| 62 | do_install() { |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame^] | 63 | install -d ${D}${EFI_FILES_PATH} |
| 64 | install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | do_deploy () { |
| 68 | install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} |
| 69 | } |
| 70 | addtask deploy before do_build after do_compile |