blob: 5a0dc954a3bf97bc2e770549de2e1224a04c7afb [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require grub2.inc
2
3DEPENDS_class-target = "grub-efi-native"
4RDEPENDS_${PN}_class-target = "diffutils freetype"
5PR = "r3"
6
7SRC_URI += " \
8 file://cfg \
9 "
10
11S = "${WORKDIR}/grub-${PV}"
12
13# Determine the target arch for the grub modules
14python __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
29inherit deploy
30
31CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN="
32EXTRA_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 Williamsd8c66bc2016-06-20 12:57:21 -050036EXTRA_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)
40CFLAGS_append_class-native = " -Wno-error=trampolines"
41
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042do_install_class-native() {
43 install -d ${D}${bindir}
44 install -m 755 grub-mkimage ${D}${bindir}
45}
46
47GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal efi_gop iso9660 search"
48
49do_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
58do_deploy_class-native() {
59 :
60}
61
62addtask deploy after do_install before do_build
63
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \
65 ${datadir}/grub \
66 "
67
68BBCLASSEXTEND = "native"
69