Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | require grub2.inc |
| 2 | |
| 3 | DEPENDS_class-target = "grub-efi-native" |
| 4 | RDEPENDS_${PN}_class-target = "diffutils freetype" |
| 5 | PR = "r3" |
| 6 | |
| 7 | SRC_URI += " \ |
| 8 | file://cfg \ |
| 9 | " |
| 10 | |
| 11 | S = "${WORKDIR}/grub-${PV}" |
| 12 | |
| 13 | # Determine the target arch for the grub modules |
| 14 | python __anonymous () { |
| 15 | import re |
| 16 | target = d.getVar('TARGET_ARCH', True) |
| 17 | if target == "x86_64": |
| 18 | grubtarget = 'x86_64' |
| 19 | grubimage = "bootx64.efi" |
| 20 | elif re.match('i.86', target): |
| 21 | grubtarget = 'i386' |
| 22 | grubimage = "bootia32.efi" |
| 23 | else: |
| 24 | raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target) |
| 25 | d.setVar("GRUB_TARGET", grubtarget) |
| 26 | d.setVar("GRUB_IMAGE", grubimage) |
| 27 | } |
| 28 | |
| 29 | inherit deploy |
| 30 | |
| 31 | CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN=" |
| 32 | EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \ |
| 33 | --enable-efiemu=no --program-prefix='' \ |
| 34 | --enable-liblzma=no --enable-device-mapper=no --enable-libzfs=no" |
| 35 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame^] | 36 | EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', '--enable-largefile', '--disable-largefile', d)}" |
| 37 | |
| 38 | # ldm.c:114:7: error: trampoline generated for nested function 'hook' [-Werror=trampolines] |
| 39 | # and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo) |
| 40 | CFLAGS_append_class-native = " -Wno-error=trampolines" |
| 41 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | do_install_class-native() { |
| 43 | install -d ${D}${bindir} |
| 44 | install -m 755 grub-mkimage ${D}${bindir} |
| 45 | } |
| 46 | |
| 47 | GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search" |
| 48 | |
| 49 | do_deploy() { |
| 50 | # Search for the grub.cfg on the local boot media by using the |
| 51 | # built in cfg file provided via this recipe |
| 52 | grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ |
| 53 | -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ |
| 54 | ${GRUB_BUILDIN} |
| 55 | install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} |
| 56 | } |
| 57 | |
| 58 | do_deploy_class-native() { |
| 59 | : |
| 60 | } |
| 61 | |
| 62 | addtask deploy after do_install before do_build |
| 63 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 64 | FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \ |
| 65 | ${datadir}/grub \ |
| 66 | " |
| 67 | |
| 68 | BBCLASSEXTEND = "native" |
| 69 | |