summaryrefslogtreecommitdiffstats
path: root/rules/grub.make
blob: 0ce3e8a4198a206c411a88f890addbbab821ad81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# -*-makefile-*-
# $Id$
#
# Copyright (C) 2002 by Pengutronix e.K., Hildesheim, Germany
# See CREDITS for details about who has contributed to this project. 
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_GRUB) += grub

#
# Paths and names 
#
GRUB_VERSION		= 0.97
GRUB			= grub-$(GRUB_VERSION)
GRUB_URL		= ftp://alpha.gnu.org/gnu/grub/$(GRUB).tar.gz
GRUB_SOURCE		= $(SRCDIR)/$(GRUB).tar.gz
GRUB_DIR		= $(BUILDDIR)/$(GRUB)

-include $(call package_depfile)

# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

grub_get: $(STATEDIR)/grub.get

$(STATEDIR)/grub.get: $(GRUB_SOURCE)
	@$(call targetinfo, $@)
	@$(call get_patches, $(GRUB))
	@$(call touch, $@)

$(GRUB_SOURCE):
	@$(call targetinfo, $@)
	@$(call get, $(GRUB_URL))

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

grub_extract: $(STATEDIR)/grub.extract

$(STATEDIR)/grub.extract: $(STATEDIR)/grub.get
	@$(call targetinfo, $@)
	@$(call clean, $(GRUB_DIR))
	@$(call extract, $(GRUB_SOURCE))
	@$(call patchin, $(GRUB))
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

grub_prepare: $(STATEDIR)/grub.prepare

GRUB_PATH	= PATH=$(CROSS_PATH)

# RSC: grub 0.93 decides to build without optimization when it detects
# non-standard CFLAGS. We can unset them here as grub is compiled
# standalone anyway (without Linux/glibc includes)

GRUB_ENV	= $(CROSS_ENV) CFLAGS=''

GRUB_AUTOCONF =  $(CROSS_AUTOCONF_USR)
GRUB_AUTOCONF += --target=$(PTXCONF_GNU_TARGET)
# FIXME FIXME FIXME
GRUB_AUTOCONF += --prefix=$(PTXCONF_PREFIX)

ifneq ("", "$(PTXCONF_GRUB_PRESET_MENU)")
GRUB_AUTOCONF += --enable-preset-menu=$(PTXCONF_GRUB_PRESET_MENU)
else
GRUB_AUTOCONF += --disable-preset-menu
endif
ifeq (y, $(PTXCONF_GRUB_FFS))
GRUB_AUTOCONF += --enable-ffs
else
GRUB_AUTOCONF += --disable-ffs
endif
ifeq (y, $(PTXCONF_GRUB_MINIXFS))
GRUB_AUTOCONF += --enable-minix
else
GRUB_AUTOCONF += --disable-minix
endif
ifeq (y, $(PTXCONF_GRUB_REISERFS))
GRUB_AUTOCONF += --enable-reiserfs
else
GRUB_AUTOCONF += --disable-reiserfs
endif
ifeq (y, $(PTXCONF_GRUB_VFTAFS))
GRUB_AUTOCONF += --enable-vstafs
else
GRUB_AUTOCONF += --disable-vstafs
endif
ifeq (y, $(PTXCONF_GRUB_JFS))
GRUB_AUTOCONF += --enable-jfs
else
GRUB_AUTOCONF += --disable-jfs
endif
ifeq (y, $(PTXCONF_GRUB_XFS))
GRUB_AUTOCONF += --enable-xfs
else
GRUB_AUTOCONF += --disable-xfs
endif
ifeq (y, $(PTXCONF_GRUB_MD5))
GRUB_AUTOCONF += --enable-md5-password
else
GRUB_AUTOCONF += --disable-md5-password
endif
ifeq (y, $(PTXCONF_GRUB_CS89X0))
GRUB_AUTOCONF += --enable-cs89x0
else
GRUB_AUTOCONF += --disable-cs89x0
endif
ifeq (y, $(PTXCONF_GRUB_EEPRO100))
GRUB_AUTOCONF += --enable-eepro100
else
GRUB_AUTOCONF += --disable-eepro100
endif
ifeq (y, $(PTXCONF_GRUB_RTL8139))
GRUB_AUTOCONF += --enable-rtl8139
else
GRUB_AUTOCONF += --disable-rtl8139
endif

grub_prepare_deps = \
	$(STATEDIR)/virtual-xchain.install \
	$(STATEDIR)/grub.extract

$(STATEDIR)/grub.prepare: $(grub_prepare_deps)
	@$(call targetinfo, $@)
	cd $(GRUB_DIR) && \
		$(GRUB_PATH) $(GRUB_ENV) ./configure $(GRUB_AUTOCONF)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

grub_compile: $(STATEDIR)/grub.compile

$(STATEDIR)/grub.compile: $(STATEDIR)/grub.prepare 
	@$(call targetinfo, $@)
	$(GRUB_PATH) make -C $(GRUB_DIR)
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

grub_install: $(STATEDIR)/grub.install

$(STATEDIR)/grub.install: $(STATEDIR)/grub.compile
	@$(call targetinfo, $@)
#	make -C $(GRUB_DIR) install
	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

grub_targetinstall: $(STATEDIR)/grub.targetinstall

$(STATEDIR)/grub.targetinstall: $(STATEDIR)/grub.install
	@$(call targetinfo, $@)

	@$(call install_init,default)
	@$(call install_fixup,PACKAGE,grub)
	@$(call install_fixup,PRIORITY,optional)
	@$(call install_fixup,VERSION,$(GRUB_VERSION))
	@$(call install_fixup,SECTION,base)
	@$(call install_fixup,AUTHOR,"Robert Schwebel <r.schwebel\@pengutronix.de>")
	@$(call install_fixup,DEPENDS,)
	@$(call install_fixup,DESCRIPTION,missing)

	@$(call install_copy, 0, 0, 0644, $(GRUB_DIR)/stage1/stage1, /boot/grub/stage1)
	@$(call install_copy, 0, 0, 0644, $(GRUB_DIR)/stage2/stage2, /boot/grub/stage2)
	@$(call install_copy, 0, 0, 0755, $(GRUB_DIR)/grub/grub, /usr/sbin/grub)

	@$(call install_finish)

	@$(call touch, $@)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

grub_clean: 
	rm -rf $(STATEDIR)/grub.* 
	rm -rf $(IMAGEDIR)/grub_* 
	rm -rf $(GRUB_DIR)

# vim: syntax=make