980a6e372a315d80aa3e6b648bef39edba6b5990
[openwrt/openwrt.git] / package / boot / grub2 / Makefile
1 #
2 # Copyright (C) 2006-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=grub
12 PKG_CPE_ID:=cpe:/a:gnu:grub2
13 PKG_VERSION:=2.04
14 PKG_RELEASE:=1
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
17 PKG_SOURCE_URL:=@GNU/grub
18 PKG_HASH:=e5292496995ad42dabe843a0192cf2a2c502e7ffcc7479398232b10a472df77d
19
20 HOST_BUILD_PARALLEL:=1
21 PKG_BUILD_DEPENDS:=grub2/host
22
23 PKG_SSP:=0
24
25 PKG_FLAGS:=nonshared
26
27 include $(INCLUDE_DIR)/host-build.mk
28 include $(INCLUDE_DIR)/package.mk
29
30 define Package/grub2
31 CATEGORY:=Boot Loaders
32 SECTION:=boot
33 TITLE:=GRand Unified Bootloader
34 URL:=http://www.gnu.org/software/grub/
35 DEPENDS:=@TARGET_x86
36 endef
37
38 define Package/grub2-editenv
39 CATEGORY:=Utilities
40 SECTION:=utils
41 SUBMENU:=Boot Loaders
42 TITLE:=Grub2 Environment editor
43 URL:=http://www.gnu.org/software/grub/
44 DEPENDS:=@TARGET_x86
45 endef
46
47 define Package/grub2-editenv/description
48 Edit grub2 environment files.
49 endef
50
51 HOST_BUILD_PREFIX := $(STAGING_DIR_HOST)
52
53 CONFIGURE_VARS += \
54 grub_build_mkfont_excuse="don't want fonts"
55
56 CONFIGURE_ARGS += \
57 --target=$(REAL_GNU_TARGET_NAME) \
58 --disable-werror \
59 --disable-nls \
60 --disable-device-mapper \
61 --disable-libzfs \
62 --disable-grub-mkfont \
63 --with-platform=none
64
65 HOST_CONFIGURE_VARS += \
66 grub_build_mkfont_excuse="don't want fonts"
67
68 HOST_CONFIGURE_ARGS += \
69 --disable-grub-mkfont \
70 --target=$(REAL_GNU_TARGET_NAME) \
71 --sbindir="$(STAGING_DIR_HOST)/bin" \
72 --disable-werror \
73 --disable-libzfs \
74 --disable-nls
75
76 HOST_MAKE_FLAGS += \
77 TARGET_RANLIB=$(TARGET_RANLIB) \
78 LIBLZMA=$(STAGING_DIR_HOST)/lib/liblzma.a
79
80 define Host/Configure
81 $(SED) 's,(RANLIB),(TARGET_RANLIB),' $(HOST_BUILD_DIR)/grub-core/Makefile.in
82 $(Host/Configure/Default)
83 endef
84
85 define Host/Install
86 $(call Host/Install/Default)
87
88 $(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/grub/grub2-generic
89 $(STAGING_DIR_HOST)/bin/grub-mkimage \
90 -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \
91 -p /boot/grub \
92 -O i386-pc \
93 -c ./files/grub-early.cfg \
94 -o $(STAGING_DIR_HOST)/lib/grub/grub2-generic/core.img \
95 at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga
96
97 $(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/grub/grub2-iso
98 $(STAGING_DIR_HOST)/bin/grub-mkimage \
99 -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \
100 -p /boot/grub \
101 -O i386-pc \
102 -c ./files/grub-early.cfg \
103 -o $(STAGING_DIR_HOST)/lib/grub/grub2-iso/eltorito.img \
104 at_keyboard biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial vga
105
106 $(INSTALL_DIR) $(STAGING_DIR_HOST)/lib/grub/grub2-legacy
107 $(STAGING_DIR_HOST)/bin/grub-mkimage \
108 -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \
109 -p /boot/grub \
110 -O i386-pc \
111 -c ./files/grub-early.cfg \
112 -o $(STAGING_DIR_HOST)/lib/grub/grub2-legacy/core.img \
113 biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga
114 endef
115
116 define Package/grub2/install
117 $(INSTALL_DIR) $(1)/usr/sbin
118 $(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-bios-setup $(1)/usr/sbin/
119 endef
120
121 define Package/grub2-editenv/install
122 $(INSTALL_DIR) $(1)/usr/sbin
123 $(INSTALL_BIN) $(PKG_BUILD_DIR)/grub-editenv $(1)/usr/sbin/
124 endef
125
126 $(eval $(call HostBuild))
127 $(eval $(call BuildPackage,grub2))
128 $(eval $(call BuildPackage,grub2-editenv))