diff options
Diffstat (limited to 'recipes-bsp/grub/grub-efi_2.02.bb')
-rw-r--r-- | recipes-bsp/grub/grub-efi_2.02.bb | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/recipes-bsp/grub/grub-efi_2.02.bb b/recipes-bsp/grub/grub-efi_2.02.bb new file mode 100644 index 0000000..13ee220 --- /dev/null +++ b/recipes-bsp/grub/grub-efi_2.02.bb | |||
@@ -0,0 +1,90 @@ | |||
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 | elif re.match('aarch64', target): | ||
25 | grubtarget = 'arm64' | ||
26 | grubimage = "grub-efi-bootaa64.efi" | ||
27 | else: | ||
28 | raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target) | ||
29 | d.setVar("GRUB_TARGET", grubtarget) | ||
30 | d.setVar("GRUB_IMAGE", grubimage) | ||
31 | } | ||
32 | |||
33 | inherit deploy | ||
34 | |||
35 | CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN=" | ||
36 | EXTRA_OECONF += "--enable-efiemu=no" | ||
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 | |||
42 | do_install_class-native() { | ||
43 | install -d ${D}${bindir} | ||
44 | install -m 755 grub-mkimage ${D}${bindir} | ||
45 | } | ||
46 | |||
47 | do_install_append_class-target() { | ||
48 | # Remove build host references... | ||
49 | find "${D}" -name modinfo.sh -type f -exec \ | ||
50 | sed -i \ | ||
51 | -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ | ||
52 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
53 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ | ||
54 | {} + | ||
55 | } | ||
56 | |||
57 | GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \ | ||
58 | efi_gop iso9660 search loadenv test" | ||
59 | |||
60 | |||
61 | do_deploy() { | ||
62 | # Search for the grub.cfg on the local boot media by using the | ||
63 | # built in cfg file provided via this recipe | ||
64 | grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \ | ||
65 | -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \ | ||
66 | ${GRUB_BUILDIN} | ||
67 | install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR} | ||
68 | |||
69 | # generate startup.nsh used by EFI to autoload grub | ||
70 | grubname=`echo ${GRUB_IMAGE} | sed -e "s/^grub-efi-//"` | ||
71 | printf 'FS0:\EFI\BOOT\%s\n' "$grubname" > ${DEPLOYDIR}/startup.nsh | ||
72 | } | ||
73 | |||
74 | do_deploy_class-native() { | ||
75 | : | ||
76 | } | ||
77 | |||
78 | addtask deploy after do_install before do_build | ||
79 | |||
80 | FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \ | ||
81 | ${datadir}/grub \ | ||
82 | " | ||
83 | |||
84 | # 64-bit binaries are expected for the bootloader with an x32 userland | ||
85 | INSANE_SKIP_${PN}_append_linux-gnux32 = " arch" | ||
86 | INSANE_SKIP_${PN}-dbg_append_linux-gnux32 = " arch" | ||
87 | INSANE_SKIP_${PN}_append_linux-muslx32 = " arch" | ||
88 | INSANE_SKIP_${PN}-dbg_append_linux-muslx32 = " arch" | ||
89 | |||
90 | BBCLASSEXTEND = "native" | ||