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 | |
| 36 | do_install_class-native() { |
| 37 | install -d ${D}${bindir} |
| 38 | install -m 755 grub-mkimage ${D}${bindir} |
| 39 | } |
| 40 | |
| 41 | GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search" |
| 42 | |
| 43 | do_deploy() { |
| 44 | # Search for the grub.cfg on the local boot media by using the |
| 45 | # built in cfg file provided via this recipe |
| 46 | grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ |
| 47 | -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ |
| 48 | ${GRUB_BUILDIN} |
| 49 | install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} |
| 50 | } |
| 51 | |
| 52 | do_deploy_class-native() { |
| 53 | : |
| 54 | } |
| 55 | |
| 56 | addtask deploy after do_install before do_build |
| 57 | |
| 58 | FILES_${PN}-dbg += "${libdir}/grub/${GRUB_TARGET}-efi/.debug \ |
| 59 | /boot/efi/EFI/BOOT/${GRUB_TARGET}-efi/.debug \ |
| 60 | " |
| 61 | FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \ |
| 62 | ${datadir}/grub \ |
| 63 | " |
| 64 | |
| 65 | BBCLASSEXTEND = "native" |
| 66 | |