Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame^] | 1 | require grub2.inc |
| 2 | |
| 3 | GRUBPLATFORM = "efi" |
| 4 | |
| 5 | DEPENDS_append_class-target = " grub-efi-native" |
| 6 | RDEPENDS_${PN}_class-target = "diffutils freetype" |
| 7 | |
| 8 | SRC_URI += " \ |
| 9 | file://cfg \ |
| 10 | " |
| 11 | |
| 12 | S = "${WORKDIR}/grub-${PV}" |
| 13 | |
| 14 | # Determine the target arch for the grub modules |
| 15 | python __anonymous () { |
| 16 | import re |
| 17 | target = d.getVar('TARGET_ARCH') |
| 18 | if target == "x86_64": |
| 19 | grubtarget = 'x86_64' |
| 20 | grubimage = "grub-efi-bootx64.efi" |
| 21 | elif re.match('i.86', target): |
| 22 | grubtarget = 'i386' |
| 23 | grubimage = "grub-efi-bootia32.efi" |
| 24 | else: |
| 25 | raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target) |
| 26 | d.setVar("GRUB_TARGET", grubtarget) |
| 27 | d.setVar("GRUB_IMAGE", grubimage) |
| 28 | } |
| 29 | |
| 30 | inherit deploy |
| 31 | |
| 32 | CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN=" |
| 33 | EXTRA_OECONF += "--enable-efiemu=no" |
| 34 | |
| 35 | # ldm.c:114:7: error: trampoline generated for nested function 'hook' [-Werror=trampolines] |
| 36 | # and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo) |
| 37 | CFLAGS_append_class-native = " -Wno-error=trampolines" |
| 38 | |
| 39 | do_install_class-native() { |
| 40 | install -d ${D}${bindir} |
| 41 | install -m 755 grub-mkimage ${D}${bindir} |
| 42 | } |
| 43 | |
| 44 | do_install_append_class-target() { |
| 45 | # Remove build host references... |
| 46 | find "${D}" -name modinfo.sh -type f -exec \ |
| 47 | sed -i \ |
| 48 | -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ |
| 49 | -e 's|${DEBUG_PREFIX_MAP}||g' \ |
| 50 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ |
| 51 | {} + |
| 52 | } |
| 53 | |
| 54 | GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \ |
| 55 | efi_gop iso9660 search loadenv test" |
| 56 | |
| 57 | do_deploy() { |
| 58 | # Search for the grub.cfg on the local boot media by using the |
| 59 | # built in cfg file provided via this recipe |
| 60 | grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ |
| 61 | -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ |
| 62 | ${GRUB_BUILDIN} |
| 63 | install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} |
| 64 | } |
| 65 | |
| 66 | do_deploy_class-native() { |
| 67 | : |
| 68 | } |
| 69 | |
| 70 | addtask deploy after do_install before do_build |
| 71 | |
| 72 | FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \ |
| 73 | ${datadir}/grub \ |
| 74 | " |
| 75 | |
| 76 | # 64-bit binaries are expected for the bootloader with an x32 userland |
| 77 | INSANE_SKIP_${PN}_append_linux-gnux32 = " arch" |
| 78 | INSANE_SKIP_${PN}-dbg_append_linux-gnux32 = " arch" |
| 79 | INSANE_SKIP_${PN}_append_linux-muslx32 = " arch" |
| 80 | INSANE_SKIP_${PN}-dbg_append_linux-muslx32 = " arch" |
| 81 | |
| 82 | BBCLASSEXTEND = "native" |