blob: 128da162d04661f35d628b3fff4e0022980b33ec [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001require grub2.inc
2
3GRUBPLATFORM = "efi"
4
5DEPENDS_append_class-target = " grub-efi-native"
6RDEPENDS_${PN}_class-target = "diffutils freetype"
7
8SRC_URI += " \
9 file://cfg \
10 "
11
12S = "${WORKDIR}/grub-${PV}"
13
14# Determine the target arch for the grub modules
15python __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
30inherit deploy
31
32CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN="
33EXTRA_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)
37CFLAGS_append_class-native = " -Wno-error=trampolines"
38
39do_install_class-native() {
40 install -d ${D}${bindir}
41 install -m 755 grub-mkimage ${D}${bindir}
42}
43
44do_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
54GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \
55 efi_gop iso9660 search loadenv test"
56
57do_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
66do_deploy_class-native() {
67 :
68}
69
70addtask deploy after do_install before do_build
71
72FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \
73 ${datadir}/grub \
74 "
75
76# 64-bit binaries are expected for the bootloader with an x32 userland
77INSANE_SKIP_${PN}_append_linux-gnux32 = " arch"
78INSANE_SKIP_${PN}-dbg_append_linux-gnux32 = " arch"
79INSANE_SKIP_${PN}_append_linux-muslx32 = " arch"
80INSANE_SKIP_${PN}-dbg_append_linux-muslx32 = " arch"
81
82BBCLASSEXTEND = "native"