grub-efi_2.02.bb 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. require grub2.inc
  2. GRUBPLATFORM = "efi"
  3. DEPENDS_append_class-target = " grub-efi-native"
  4. RDEPENDS_${PN}_class-target = "diffutils freetype grub-common virtual/grub-bootconf"
  5. SRC_URI += " \
  6. file://cfg \
  7. "
  8. S = "${WORKDIR}/grub-${PV}"
  9. # Determine the target arch for the grub modules
  10. python __anonymous () {
  11. import re
  12. target = d.getVar('TARGET_ARCH')
  13. if target == "x86_64":
  14. grubtarget = 'x86_64'
  15. grubimage = "grub-efi-bootx64.efi"
  16. elif re.match('i.86', target):
  17. grubtarget = 'i386'
  18. grubimage = "grub-efi-bootia32.efi"
  19. else:
  20. raise bb.parse.SkipRecipe("grub-efi is incompatible with target %s" % target)
  21. d.setVar("GRUB_TARGET", grubtarget)
  22. d.setVar("GRUB_IMAGE", grubimage)
  23. }
  24. inherit deploy
  25. CACHED_CONFIGUREVARS += "ac_cv_path_HELP2MAN="
  26. EXTRA_OECONF += "--enable-efiemu=no"
  27. # ldm.c:114:7: error: trampoline generated for nested function 'hook' [-Werror=trampolines]
  28. # and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo)
  29. CFLAGS_append_class-native = " -Wno-error=trampolines"
  30. do_mkimage() {
  31. cd ${B}
  32. # Search for the grub.cfg on the local boot media by using the
  33. # built in cfg file provided via this recipe
  34. grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
  35. -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
  36. ${GRUB_BUILDIN}
  37. }
  38. addtask mkimage before do_install after do_compile
  39. do_mkimage_class-native() {
  40. :
  41. }
  42. do_install_append_class-target() {
  43. install -d ${D}/boot
  44. install -d ${D}/boot/EFI
  45. install -d ${D}/boot/EFI/BOOT
  46. install -m 644 ${B}/${GRUB_IMAGE} ${D}/boot/EFI/BOOT/
  47. }
  48. do_install_class-native() {
  49. install -d ${D}${bindir}
  50. install -m 755 grub-mkimage ${D}${bindir}
  51. }
  52. do_install_class-target() {
  53. oe_runmake 'DESTDIR=${D}' -C grub-core install
  54. # Remove build host references...
  55. find "${D}" -name modinfo.sh -type f -exec \
  56. sed -i \
  57. -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
  58. -e 's|${DEBUG_PREFIX_MAP}||g' \
  59. -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
  60. {} +
  61. }
  62. GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \
  63. efi_gop iso9660 configfile search loadenv test"
  64. do_deploy() {
  65. install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
  66. }
  67. do_deploy_class-native() {
  68. :
  69. }
  70. addtask deploy after do_install before do_build
  71. FILES_${PN} = "${libdir}/grub/${GRUB_TARGET}-efi \
  72. ${datadir}/grub \
  73. /boot/EFI/BOOT/${GRUB_IMAGE} \
  74. "
  75. # 64-bit binaries are expected for the bootloader with an x32 userland
  76. INSANE_SKIP_${PN}_append_linux-gnux32 = " arch"
  77. INSANE_SKIP_${PN}-dbg_append_linux-gnux32 = " arch"
  78. INSANE_SKIP_${PN}_append_linux-muslx32 = " arch"
  79. INSANE_SKIP_${PN}-dbg_append_linux-muslx32 = " arch"
  80. BBCLASSEXTEND = "native"