| package/grub/Makefile |
| 1 | 1 | # |
| 2 | | # Copyright (C) 2006-2009 OpenWrt.org |
| 2 | # Copyright (C) 2006-2010 OpenWrt.org |
| 3 | 3 | # |
| 4 | 4 | # This is free software, licensed under the GNU General Public License v2. |
| 5 | 5 | # See /LICENSE for more information. |
| ... | ... | |
| 10 | 10 | |
| 11 | 11 | PKG_NAME:=grub |
| 12 | 12 | PKG_VERSION:=0.97 |
| 13 | | PKG_RELEASE:=2 |
| 13 | PKG_RELEASE:=3 |
| 14 | 14 | |
| 15 | 15 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz |
| 16 | 16 | PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub |
| 17 | 17 | PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884 |
| 18 | 18 | |
| 19 | | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/grub-$(PKG_VERSION) |
| 20 | | PKG_TARGETS:=bin |
| 19 | PKG_BUILD_DEPENDS:= grub/host |
| 20 | PKG_INSTALL:=1 |
| 21 | 21 | |
| 22 | include $(INCLUDE_DIR)/host-build.mk |
| 22 | 23 | include $(INCLUDE_DIR)/package.mk |
| 23 | 24 | |
| 24 | | export grub_cv_prog_objcopy_absolute=yes |
| 25 | | |
| 26 | 25 | define Package/grub |
| 27 | | SECTION:=boot |
| 28 | | DEPENDS:=@TARGET_x86 |
| 29 | | CATEGORY:=Boot Loaders |
| 26 | SUBMENU:=Boot Loaders |
| 27 | CATEGORY:=Utilities |
| 28 | SECTION:=utils |
| 30 | 29 | TITLE:=GRand Unified Bootloader |
| 31 | 30 | URL:=http://www.gnu.org/software/grub/ |
| 31 | DEPENDS:=@TARGET_x86 |
| 32 | 32 | endef |
| 33 | 33 | |
| 34 | | CONFIGURE_FLAGS:= \ |
| 35 | | --target=$(GNU_TARGET_NAME) \ |
| 36 | | --host=$(GNU_TARGET_NAME) \ |
| 37 | | --build=$(GNU_HOST_NAME) |
| 38 | | |
| 39 | | ifneq ($(HOST_OS),Darwin) |
| 40 | | define Build/Configure |
| 41 | | (cd $(PKG_BUILD_DIR); \ |
| 42 | | LDFLAGS="-static" \ |
| 43 | | ./configure \ |
| 44 | | $(CONFIGURE_FLAGS) \ |
| 45 | | --program-prefix="" \ |
| 46 | | --program-suffix="" \ |
| 47 | | --prefix=/usr \ |
| 48 | | --exec-prefix=/usr \ |
| 49 | | --bindir=/usr/bin \ |
| 50 | | --sbindir=/usr/sbin \ |
| 51 | | --libexecdir=/usr/lib \ |
| 52 | | --sysconfdir=/etc \ |
| 53 | | --datadir=/usr/share \ |
| 54 | | --localstatedir=/var \ |
| 55 | | --mandir=/usr/man \ |
| 56 | | --infodir=/usr/info \ |
| 57 | | $(DISABLE_NLS) \ |
| 58 | | --disable-auto-linux-mem-opt \ |
| 59 | | ) |
| 60 | | endef |
| 34 | MY_CONFIGURE_ARGS += \ |
| 35 | --disable-auto-linux-mem-opt \ |
| 36 | --disable-hercules \ |
| 61 | 37 | |
| 62 | | # |
| 63 | | # ./configure detects whether the host compiler supports |
| 64 | | # -fno-stack-protector but only sets STAGE2_CFLAGS accordingly |
| 65 | | # |
| 66 | | define Build/Compile |
| 67 | | $(MAKE) -C $(PKG_BUILD_DIR) \ |
| 68 | | GRUB_CFLAGS="\$$$$(STAGE2_CFLAGS)" \ |
| 69 | | STAGE1_CFLAGS="\$$$$(STAGE2_CFLAGS)" |
| 70 | | endef |
| 38 | MY_CONFIGURE_VARS += \ |
| 39 | grub_cv_prog_objcopy_absolute=yes \ |
| 40 | |
| 41 | CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) |
| 42 | |
| 43 | CONFIGURE_VARS += $(MY_CONFIGURE_VARS) |
| 44 | |
| 45 | HOST_CFLAGS += $(call host-cc-option,-fno-stack-protector) |
| 46 | HOST_CFLAGS += $(call host-cc-option,-U_FORTIFY_SOURCE) |
| 47 | |
| 48 | HOST_CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) \ |
| 49 | --sbindir="$(STAGING_DIR_HOST)/bin" \ |
| 50 | --disable-graphics \ |
| 51 | |
| 52 | HOST_CONFIGURE_VARS += $(MY_CONFIGURE_VARS) |
| 71 | 53 | |
| 72 | 54 | define Build/InstallDev |
| 73 | | $(MAKE) -C $(PKG_BUILD_DIR) \ |
| 74 | | DESTDIR="$(STAGING_DIR_HOST)" \ |
| 75 | | install |
| 76 | | mv $(STAGING_DIR_HOST)/usr/sbin/grub $(STAGING_DIR_HOST)/bin |
| 55 | $(INSTALL_DIR) $(1)/usr/lib |
| 56 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/grub $(1)/usr/lib/ |
| 57 | endef |
| 58 | |
| 59 | define Package/grub/install |
| 60 | $(INSTALL_DIR) $(1)/usr/bin |
| 61 | $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ |
| 62 | $(INSTALL_DIR) $(1)/usr/lib |
| 63 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/ |
| 64 | $(INSTALL_DIR) $(1)/usr/sbin |
| 65 | $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ |
| 77 | 66 | endef |
| 78 | | endif |
| 79 | 67 | |
| 68 | $(eval $(call HostBuild)) |
| 80 | 69 | $(eval $(call BuildPackage,grub)) |
| target/linux/x86/image/Makefile |
| 56 | 56 | # left here because the image builder doesnt need these |
| 57 | 57 | $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub |
| 58 | 58 | $(CP) \ |
| 59 | | $(KDIR)/*stage* \ |
| 59 | $(KDIR)/stage1 \ |
| 60 | $(KDIR)/stage2 \ |
| 61 | $(KDIR)/e2fs_stage1_5 \ |
| 60 | 62 | $(KDIR)/root.grub/boot/grub/ |
| 61 | 63 | $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz |
| 62 | 64 | sed \ |
| ... | ... | |
| 74 | 76 | define Image/Prepare/grub |
| 75 | 77 | # for the image builder |
| 76 | 78 | $(CP) \ |
| 77 | | $(STAGING_DIR_HOST)/usr/lib/grub/i386-*/stage1 \ |
| 78 | | $(STAGING_DIR_HOST)/usr/lib/grub/i386-*/stage2 \ |
| 79 | | $(STAGING_DIR_HOST)/usr/lib/grub/i386-*/e2fs_stage1_5 \ |
| 79 | $(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage1 \ |
| 80 | $(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage2 \ |
| 81 | $(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage2_eltorito \ |
| 82 | $(STAGING_DIR)/usr/lib/grub/i386-openwrt/e2fs_stage1_5 \ |
| 80 | 83 | $(KDIR)/ |
| 81 | 84 | endef |
| 82 | 85 | |
| ... | ... | |
| 135 | 138 | define Image/Build/iso |
| 136 | 139 | $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub |
| 137 | 140 | $(CP) \ |
| 138 | | $(STAGING_DIR_HOST)/usr/lib/grub/i386-openwrt/stage2_eltorito \ |
| 139 | | $(KDIR)/root.grub/boot/grub/stage2_eltorito |
| 141 | $(KDIR)/stage2_eltorito \ |
| 142 | $(KDIR)/root.grub/boot/grub/ |
| 140 | 143 | sed \ |
| 141 | 144 | -e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \ |
| 142 | 145 | -e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \ |