grub2.mk 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #############################################################
  2. #
  3. # grub2
  4. #
  5. # TODO
  6. #
  7. # * grub2's autogen uses ruby, which isn't part of the core Debian
  8. # installation. So either decide it is a requirement for Buildroot,
  9. # or build it for the host.
  10. #
  11. # * improve the installation procedure. For the moment, it just
  12. # installs everything in $(TARGET_DIR).
  13. #
  14. #############################################################
  15. GRUB2_SOURCE:=grub2_1.98.orig.tar.gz
  16. GRUB2_PATCH:=grub2_1.98-1.diff.gz
  17. GRUB2_SITE=$(BR2_DEBIAN_MIRROR)/debian/pool/main/g/grub2
  18. GRUB2_PATCH_SITE:=$(GRUB2_SITE)
  19. GRUB2_CAT:=$(ZCAT)
  20. GRUB2_DIR:=$(BUILD_DIR)/grub-1.98
  21. GRUB2_CFLAGS=-DSUPPORT_LOOPDEV
  22. ifeq ($(BR2_LARGEFILE),)
  23. GRUB2_CFLAGS+=-U_FILE_OFFSET_BITS
  24. endif
  25. $(DL_DIR)/$(GRUB2_SOURCE):
  26. $(call DOWNLOAD,$(GRUB2_SITE),$(GRUB2_SOURCE))
  27. $(DL_DIR)/$(GRUB2_PATCH):
  28. $(call DOWNLOAD,$(GRUB2_PATCH_SITE),$(GRUB2_PATCH))
  29. grub2-source: $(DL_DIR)/$(GRUB2_SOURCE) $(DL_DIR)/$(GRUB2_PATCH)
  30. $(GRUB2_DIR)/.unpacked: $(DL_DIR)/$(GRUB2_SOURCE) $(DL_DIR)/$(GRUB2_PATCH)
  31. mkdir -p $(@D)
  32. $(GRUB2_CAT) $(DL_DIR)/$(GRUB2_SOURCE) | tar $(TAR_STRIP_COMPONENTS)=1 -C $(@D) -xvf -
  33. toolchain/patch-kernel.sh $(@D) $(DL_DIR) $(GRUB2_PATCH)
  34. for i in `grep -v "^#" $(@D)/debian/patches/00list`; do \
  35. cat $(@D)/debian/patches/$$i | patch -p1 -d $(@D); \
  36. done
  37. toolchain/patch-kernel.sh $(@D) boot/grub2 grub-\*.patch
  38. touch $@
  39. $(GRUB2_DIR)/.configured: $(GRUB2_DIR)/.unpacked
  40. (cd $(GRUB2_DIR); rm -rf config.cache; \
  41. $(TARGET_CONFIGURE_OPTS) ; \
  42. ./autogen.sh ; \
  43. $(TARGET_CONFIGURE_OPTS) \
  44. $(TARGET_CONFIGURE_ARGS) \
  45. CPPFLAGS="$(GRUB2_CFLAGS)" \
  46. grub_cv_i386_check_nested_functions=no \
  47. ./configure $(QUIET) \
  48. --target=$(GNU_TARGET_NAME) \
  49. --host=$(GNU_TARGET_NAME) \
  50. --build=$(GNU_HOST_NAME) \
  51. --prefix=/ \
  52. --mandir=/usr/man \
  53. --infodir=/usr/info \
  54. --disable-grub-mkfont \
  55. --disable-grub-fstest \
  56. --disable-grub-emu-usb \
  57. --disable-werror \
  58. $(DISABLE_LARGEFILE) \
  59. $(GRUB2_CONFIG-y) \
  60. )
  61. touch $@
  62. $(GRUB2_DIR)/.compiled: $(GRUB2_DIR)/.configured
  63. $(MAKE) CC="$(TARGET_CC)" -C $(@D)
  64. touch $@
  65. $(GRUB2_DIR)/.installed: $(GRUB2_DIR)/.compiled
  66. $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) install
  67. touch $@
  68. grub2: host-automake host-autoconf $(GRUB2_DIR)/.installed
  69. grub2-clean:
  70. $(MAKE) DESTDIR=$(TARGET_DIR) CC="$(TARGET_CC)" -C $(GRUB2_DIR) uninstall
  71. -$(MAKE) -C $(GRUB2_DIR) clean
  72. grub2-dirclean:
  73. rm -rf $(GRUB2_DIR)
  74. #############################################################
  75. #
  76. # Toplevel Makefile options
  77. #
  78. #############################################################
  79. ifeq ($(BR2_TARGET_GRUB2),y)
  80. TARGETS+=grub2
  81. endif