Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(ADK_TOPDIR)/rules.mk
  4. PKG_NAME:= grub
  5. PKG_VERSION:= git
  6. PKG_RELEASE:= 1
  7. PKG_DESCR:= multiboot boot loader
  8. PKG_SECTION:= base/boot
  9. PKG_BUILDDEP:= bison-host grub-host
  10. PKG_URL:= http://www.gnu.org/software/grub
  11. PKG_SITES:= git://git.savannah.gnu.org/grub.git
  12. PKG_NOPARALLEL:= 1
  13. PKG_ARCH_DEPENDS:= x86 x86_64 mips mips64
  14. PKG_SUBPKGS:= GRUB GRUB_TOOLS
  15. PKGSD_GRUB_TOOLS:= grub2 tools
  16. PKG_CHOICES_GRUB:= PC EFI_X86 EFI_X86_64 ARC
  17. PKGCD_PC:= build for PC BIOS
  18. PKGCD_EFI_X86:= build for EFI x86
  19. PKGCD_EFI_X86_64:= build for EFI x86_64
  20. PKGCD_ARC:= build for MIPS/MIPS64 ARC
  21. include $(ADK_TOPDIR)/mk/host.mk
  22. include $(ADK_TOPDIR)/mk/package.mk
  23. $(eval $(call HOST_template,GRUB,grub,$(PKG_VERSION)-${PKG_RELEASE}))
  24. $(eval $(call PKG_template,GRUB,grub,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
  25. $(eval $(call PKG_template,GRUB_TOOLS,grub-tools,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
  26. TARGET_CFLAGS:=$(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
  27. TARGET_CFLAGS:=$(filter-out -flto,$(TARGET_CFLAGS))
  28. AUTOTOOL_STYLE:= autogen
  29. GRUB2_BOOT_PARTITION:= hd0,msdos1
  30. ifeq ($(ADK_PACKAGE_GRUB_ARC),y)
  31. GRUB2_ARCH:= mips-arc
  32. CONFIGURE_ARGS+= --with-platform=arc
  33. GRUB2_IMAGE = $(FW_DIR)/grub.img
  34. GRUB2_CFG = $(TARGET_DIR)/boot/grub/grub.cfg
  35. GRUB2_PREFIX = ($(GRUB2_BOOT_PARTITION))/boot/grub
  36. GRUB2_TARGET = mips
  37. GRUB2_PLATFORM = arc
  38. GRUB2_MODULES = boot linux ext2 fat part_msdos part_gpt normal biosdisk
  39. endif
  40. ifeq ($(ADK_PACKAGE_GRUB_PC),y)
  41. GRUB2_ARCH:= i386-pc
  42. CONFIGURE_ARGS+= --with-platform=pc
  43. HOST_CONFIGURE_ARGS+= --with-platform=pc
  44. GRUB2_IMAGE = $(FW_DIR)/grub.img
  45. GRUB2_CFG = $(TARGET_DIR)/boot/grub/grub.cfg
  46. GRUB2_PREFIX = ($(GRUB2_BOOT_PARTITION))/boot/grub
  47. GRUB2_TARGET = i386
  48. GRUB2_PLATFORM = pc
  49. GRUB2_MODULES = boot linux ext2 fat part_msdos part_gpt normal biosdisk
  50. endif
  51. ifeq ($(ADK_PACKAGE_GRUB_EFI_X86),y)
  52. GRUB2_ARCH:= x86_64-efi
  53. CONFIGURE_ARGS+= --with-platform=efi
  54. HOST_CONFIGURE_ARGS+= --with-platform=efi
  55. GRUB2_IMAGE = $(FW_DIR)/efi-part/EFI/BOOT/bootia32.efi
  56. GRUB2_CFG = $(FW_DIR)/efi-part/EFI/BOOT/grub.cfg
  57. GRUB2_PREFIX = /EFI/BOOT
  58. GRUB2_TARGET = i386
  59. GRUB2_PLATFORM = efi
  60. GRUB2_MODULES = boot linux ext2 fat part_msdos part_gpt normal efi_gop
  61. endif
  62. ifeq ($(ADK_PACKAGE_GRUB_EFI_X86_64),y)
  63. GRUB2_ARCH:= x86_64-efi
  64. CONFIGURE_ARGS+= --with-platform=efi
  65. HOST_CONFIGURE_ARGS+= --with-platform=efi
  66. GRUB2_IMAGE = $(FW_DIR)/efi-part/EFI/BOOT/bootx64.efi
  67. GRUB2_CFG = $(FW_DIR)/efi-part/EFI/BOOT/grub.cfg
  68. GRUB2_PREFIX = /EFI/BOOT
  69. GRUB2_TARGET = x86_64
  70. GRUB2_PLATFORM = efi
  71. GRUB2_MODULES = boot linux ext2 fat part_msdos part_gpt normal efi_gop
  72. endif
  73. HOST_CONFIGURE_ARGS+= --enable-efiemu=no \
  74. --disable-grub-mkfont \
  75. --enable-device-mapper=no \
  76. --enable-libzfs=no \
  77. --disable-werror
  78. CONFIGURE_ARGS+= --disable-grub-mkfont \
  79. --enable-efiemu=no \
  80. --enable-device-mapper=no \
  81. --enable-libzfs=no \
  82. --disable-werror
  83. XAKE_FLAGS+= GCC_HONOUR_COPTS=s
  84. grub-install:
  85. ifeq ($(ADK_PACKAGE_GRUB_EFI_X86)$(ADK_PACKAGE_GRUB_EFI_X86_64),y)
  86. $(INSTALL_DIR) $(FW_DIR)/efi-part/EFI/BOOT
  87. ${CP} ${WRKINST}/usr/lib/grub/${GRUB2_ARCH} \
  88. $(FW_DIR)/efi-part/EFI/BOOT
  89. endif
  90. $(STAGING_HOST_DIR)/usr/bin/grub-mkimage \
  91. -d $(WRKINST)/usr/lib/grub/$(GRUB2_ARCH) \
  92. -O $(GRUB2_ARCH) \
  93. -o $(GRUB2_IMAGE) \
  94. -p "$(GRUB2_PREFIX)" \
  95. $(GRUB2_MODULES)
  96. $(CP) ./files/grub.cfg $(GRUB2_CFG)
  97. grub-tools-install:
  98. ${INSTALL_DIR} $(IDIR_GRUB_TOOLS)/usr/{sbin,bin,share,lib}
  99. ${INSTALL_BIN} ${WRKINST}/usr/sbin/grub-install \
  100. $(IDIR_GRUB_TOOLS)/usr/sbin
  101. ${INSTALL_BIN} ${WRKINST}/usr/sbin/grub-probe \
  102. $(IDIR_GRUB_TOOLS)/usr/sbin
  103. ${INSTALL_BIN} ${WRKINST}/usr/sbin/grub-bios-setup \
  104. $(IDIR_GRUB_TOOLS)/usr/sbin
  105. ${INSTALL_BIN} ${WRKINST}/usr/bin/grub-editenv \
  106. $(IDIR_GRUB_TOOLS)/usr/bin
  107. ${INSTALL_BIN} ${WRKINST}/usr/bin/grub-mkrelpath \
  108. $(IDIR_GRUB_TOOLS)/usr/bin
  109. ${INSTALL_BIN} ${WRKINST}/usr/bin/grub-mkimage \
  110. $(IDIR_GRUB_TOOLS)/usr/bin
  111. ${CP} ${WRKINST}/usr/lib/grub \
  112. $(IDIR_GRUB_TOOLS)/usr/lib
  113. ${CP} ${WRKINST}/usr/share/grub \
  114. $(IDIR_GRUB_TOOLS)/usr/share
  115. include ${ADK_TOPDIR}/mk/host-bottom.mk
  116. include ${ADK_TOPDIR}/mk/pkg-bottom.mk