grub.mk 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. ################################################################################
  2. #
  3. # grub
  4. #
  5. ################################################################################
  6. GRUB_VERSION = 0.97
  7. GRUB_SOURCE = grub_$(GRUB_VERSION).orig.tar.gz
  8. GRUB_PATCH = grub_$(GRUB_VERSION)-67.diff.gz
  9. GRUB_SITE = http://snapshot.debian.org/archive/debian/20130129T225227Z/pool/main/g/grub
  10. GRUB_LICENSE = GPLv2+
  11. GRUB_LICENSE_FILES = COPYING
  12. # Passing -O0 since the default -O2 passed by Buildroot generates
  13. # non-working stage2. Passing --build-id=none to the linker, because
  14. # the ".note.gnu.build-id" ELF sections generated by default confuse
  15. # objcopy when generating raw binaries. Passing -fno-stack-protector
  16. # to avoid undefined references to __stack_chk_fail.
  17. GRUB_CFLAGS = \
  18. -DSUPPORT_LOOPDEV \
  19. -O0 -Wl,--build-id=none \
  20. -fno-stack-protector
  21. GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_SPLASH),--enable-graphics,--disable-graphics)
  22. GRUB_CONFIG-$(BR2_TARGET_GRUB_DISKLESS) += --enable-diskless
  23. GRUB_CONFIG-$(BR2_TARGET_GRUB_3c595) += --enable-3c595
  24. GRUB_CONFIG-$(BR2_TARGET_GRUB_3c90x) += --enable-3c90x
  25. GRUB_CONFIG-$(BR2_TARGET_GRUB_davicom) += --enable-davicom
  26. GRUB_CONFIG-$(BR2_TARGET_GRUB_e1000) += --enable-e1000
  27. GRUB_CONFIG-$(BR2_TARGET_GRUB_eepro100) += --enable-eepro100
  28. GRUB_CONFIG-$(BR2_TARGET_GRUB_epic100) += --enable-epic100
  29. GRUB_CONFIG-$(BR2_TARGET_GRUB_forcedeth) += --enable-forcedeth
  30. GRUB_CONFIG-$(BR2_TARGET_GRUB_natsemi) += --enable-natsemi
  31. GRUB_CONFIG-$(BR2_TARGET_GRUB_ns83820) += --enable-ns83820
  32. GRUB_CONFIG-$(BR2_TARGET_GRUB_ns8390) += --enable-ns8390
  33. GRUB_CONFIG-$(BR2_TARGET_GRUB_pcnet32) += --enable-pcnet32
  34. GRUB_CONFIG-$(BR2_TARGET_GRUB_pnic) += --enable-pnic
  35. GRUB_CONFIG-$(BR2_TARGET_GRUB_rtl8139) += --enable-rtl8139
  36. GRUB_CONFIG-$(BR2_TARGET_GRUB_r8169) += --enable-r8169
  37. GRUB_CONFIG-$(BR2_TARGET_GRUB_sis900) += --enable-sis900
  38. GRUB_CONFIG-$(BR2_TARGET_GRUB_tg3) += --enable-tg3
  39. GRUB_CONFIG-$(BR2_TARGET_GRUB_tulip) += --enable-tulip
  40. GRUB_CONFIG-$(BR2_TARGET_GRUB_tlan) += --enable-tlan
  41. GRUB_CONFIG-$(BR2_TARGET_GRUB_undi) += --enable-undi
  42. GRUB_CONFIG-$(BR2_TARGET_GRUB_via_rhine) += --enable-via-rhine
  43. GRUB_CONFIG-$(BR2_TARGET_GRUB_w89c840) += --enable-w89c840
  44. GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_EXT2),--enable-ext2fs,--disable-ext2fs)
  45. GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_FAT),--enable-fat,--disable-fat)
  46. GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_ISO9660),--enable-iso9660,--disable-iso9660)
  47. GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_JFS),--enable-jfs,--disable-jfs)
  48. GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_REISERFS),--enable-reiserfs,--disable-reiserfs)
  49. GRUB_CONFIG-y += $(if $(BR2_TARGET_GRUB_FS_XFS),--enable-xfs,--disable-xfs)
  50. GRUB_CONFIG-y += --disable-ffs --disable-ufs2 --disable-minix --disable-vstafs
  51. GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_EXT2),e2fs)
  52. GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_FAT),fat)
  53. GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_ISO9660),iso9660)
  54. GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_JFS),jfs)
  55. GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_REISERFS),reiserfs)
  56. GRUB_STAGE_1_5_TO_INSTALL += $(if $(BR2_TARGET_GRUB_FS_XFS),xfs)
  57. define GRUB_DEBIAN_PATCHES
  58. # Apply the patches from the Debian patch
  59. (cd $(@D) ; for f in `cat debian/patches/series | grep -v ^#` ; do \
  60. cat debian/patches/$$f | patch -g0 -p1 ; \
  61. done)
  62. endef
  63. GRUB_POST_PATCH_HOOKS += GRUB_DEBIAN_PATCHES
  64. GRUB_CONF_ENV = \
  65. $(HOST_CONFIGURE_OPTS) \
  66. CFLAGS="$(HOST_CFLAGS) $(GRUB_CFLAGS) -m32"
  67. GRUB_CONF_OPT = \
  68. --disable-auto-linux-mem-opt \
  69. $(GRUB_CONFIG-y)
  70. ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
  71. define GRUB_INSTALL_SPLASH
  72. cp boot/grub/splash.xpm.gz $(TARGET_DIR)/boot/grub/
  73. endef
  74. else
  75. define GRUB_INSTALL_SPLASH
  76. $(SED) '/^splashimage/d' $(TARGET_DIR)/boot/grub/menu.lst
  77. endef
  78. endif
  79. # We're cheating here as we're installing the grub binary not in the
  80. # target directory (where it is useless), but in the host
  81. # directory. This grub binary can be used to install grub into the MBR
  82. # of a disk or disk image.
  83. define GRUB_INSTALL_TARGET_CMDS
  84. install -m 0755 -D $(@D)/grub/grub $(HOST_DIR)/sbin/grub
  85. mkdir -p $(TARGET_DIR)/boot/grub
  86. cp $(@D)/stage1/stage1 $(TARGET_DIR)/boot/grub
  87. for f in $(GRUB_STAGE_1_5_TO_INSTALL) ; do \
  88. cp $(@D)/stage2/$${f}_stage1_5 $(TARGET_DIR)/boot/grub ; \
  89. done
  90. cp $(@D)/stage2/stage2 $(TARGET_DIR)/boot/grub
  91. cp boot/grub/menu.lst $(TARGET_DIR)/boot/grub
  92. $(GRUB_INSTALL_SPLASH)
  93. endef
  94. $(eval $(autotools-package))