summaryrefslogtreecommitdiffstats
path: root/boot/grub/grub.mk
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2011-07-05 21:54:05 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2011-07-10 15:28:23 +0200
commita4f58506ac7b120f3c2414e1f4034965b7c57b4e (patch)
tree91b05dcfc3376d43dcdc3c9337ce2c198bb35b4d /boot/grub/grub.mk
parent5391de7771b1d8f9d6f6f6fad7bb8a39247e31e9 (diff)
downloadbuildroot-novena-a4f58506ac7b120f3c2414e1f4034965b7c57b4e.tar.gz
buildroot-novena-a4f58506ac7b120f3c2414e1f4034965b7c57b4e.zip
grub: convert to AUTOTARGETS
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'boot/grub/grub.mk')
-rw-r--r--boot/grub/grub.mk102
1 files changed, 39 insertions, 63 deletions
diff --git a/boot/grub/grub.mk b/boot/grub/grub.mk
index 9461d1cbd..49384169f 100644
--- a/boot/grub/grub.mk
+++ b/boot/grub/grub.mk
@@ -3,23 +3,17 @@
# grub
#
#############################################################
-GRUB_SOURCE:=grub_0.97.orig.tar.gz
-GRUB_PATCH:=grub_0.97-35.diff.gz
-GRUB_SITE:=http://snapshot.debian.org/archive/debian/20080329T000000Z/pool/main/g/grub/
-GRUB_PATCH_SITE:=$(GRUB_SITE)
-GRUB_CAT:=$(ZCAT)
-GRUB_DIR:=$(BUILD_DIR)/grub-0.97
-GRUB_BINARY:=grub/grub
-GRUB_TARGET_BINARY:=sbin/grub
-GRUB_SPLASHIMAGE=$(TOPDIR)/boot/grub/splash.xpm.gz
+GRUB_VERSION = 0.97
+GRUB_SOURCE = grub_$(GRUB_VERSION).orig.tar.gz
+GRUB_PATCH = grub_$(GRUB_VERSION)-35.diff.gz
+GRUB_SITE = http://snapshot.debian.org/archive/debian/20080329T000000Z/pool/main/g/grub/
GRUB_CFLAGS=-DSUPPORT_LOOPDEV
ifeq ($(BR2_LARGEFILE),)
GRUB_CFLAGS+=-U_FILE_OFFSET_BITS
endif
-
GRUB_CONFIG-$(BR2_TARGET_GRUB_SPLASH) += --enable-graphics
GRUB_CONFIG-$(BR2_TARGET_GRUB_DISKLESS) += --enable-diskless
GRUB_CONFIG-$(BR2_TARGET_GRUB_3c595) += --enable-3c595
@@ -44,69 +38,51 @@ GRUB_CONFIG-$(BR2_TARGET_GRUB_undi) += --enable-undi
GRUB_CONFIG-$(BR2_TARGET_GRUB_via_rhine) += --enable-via-rhine
GRUB_CONFIG-$(BR2_TARGET_GRUB_w89c840) += --enable-w89c840
-$(DL_DIR)/$(GRUB_SOURCE):
- $(call DOWNLOAD,$(GRUB_SITE),$(GRUB_SOURCE))
-
-$(DL_DIR)/$(GRUB_PATCH):
- $(call DOWNLOAD,$(GRUB_PATCH_SITE),$(GRUB_PATCH))
+define GRUB_DEBIAN_PATCHES
+ # Apply the patches from the Debian patch
+ (cd $(@D) ; for f in `cat debian/patches/00list | grep -v ^#` ; do \
+ cat debian/patches/$$f | patch -p1 ; \
+ done)
+endef
-grub-source: $(DL_DIR)/$(GRUB_SOURCE) $(DL_DIR)/$(GRUB_PATCH)
+GRUB_POST_PATCH_HOOKS += GRUB_DEBIAN_PATCHES
-$(GRUB_DIR)/.unpacked: $(DL_DIR)/$(GRUB_SOURCE) $(DL_DIR)/$(GRUB_PATCH)
- $(GRUB_CAT) $(DL_DIR)/$(GRUB_SOURCE) | tar -C $(BUILD_DIR) -xvf -
- toolchain/patch-kernel.sh $(GRUB_DIR) $(DL_DIR) $(GRUB_PATCH)
- for i in `grep -v "^#" $(GRUB_DIR)/debian/patches/00list`; do \
- cat $(GRUB_DIR)/debian/patches/$$i | patch -p1 -d $(GRUB_DIR); \
- done
- toolchain/patch-kernel.sh $(GRUB_DIR) boot/grub grub.\*.patch{,.bz2}
- touch $@
+GRUB_CONF_ENV = \
+ CFLAGS="$(TARGET_CFLAGS) $(GRUB_CFLAGS)"
-$(GRUB_DIR)/.configured: $(GRUB_DIR)/.unpacked
- (cd $(GRUB_DIR); rm -rf config.cache; \
- $(TARGET_CONFIGURE_OPTS) \
- CFLAGS="$(TARGET_CFLAGS)" \
- CPPFLAGS="$(GRUB_CFLAGS)" \
- ./configure $(QUIET) \
- --target=$(GNU_TARGET_NAME) \
- --host=$(GNU_TARGET_NAME) \
- --build=$(GNU_HOST_NAME) \
- --prefix=/ \
- --mandir=/usr/man \
- --infodir=/usr/info \
- --disable-auto-linux-mem-opt \
- $(GRUB_CONFIG-y) \
- )
- touch $@
+GRUB_CONF_OPT = \
+ --disable-auto-linux-mem-opt \
+ $(GRUB_CONFIG-y)
-$(GRUB_DIR)/$(GRUB_BINARY): $(GRUB_DIR)/.configured
- $(MAKE) CC="$(TARGET_CC)" -C $(GRUB_DIR)
- rm -f $(GRUB_DIR)/$(GRUB_BINARY)
- $(MAKE) CC="$(TARGET_CC)" CFLAGS+=-static -C $(GRUB_DIR)/grub grub
- mkdir -p $(dir $(STAGING_DIR)/$(GRUB_TARGET_BINARY))
- mv $(GRUB_DIR)/$(GRUB_BINARY) $(STAGING_DIR)/$(GRUB_TARGET_BINARY).static
- $(MAKE) CC="$(TARGET_CC)" -C $(GRUB_DIR)/grub
+define GRUB_INSTALL_STAGING_CMDS
+ install -m 0755 -D $(@D)/grub/grub $(STAGING_DIR)/sbin/grub
+endef
-$(GRUB_DIR)/.installed: $(GRUB_DIR)/$(GRUB_BINARY)
- cp $(GRUB_DIR)/$(GRUB_BINARY) $(TARGET_DIR)/$(GRUB_TARGET_BINARY)
- test -d $(TARGET_DIR)/boot/grub || mkdir -p $(TARGET_DIR)/boot/grub
- cp $(GRUB_DIR)/stage1/stage1 $(GRUB_DIR)/stage2/*1_5 $(GRUB_DIR)/stage2/stage2 $(TARGET_DIR)/boot/grub/
ifeq ($(BR2_TARGET_GRUB_SPLASH),y)
- test -f $(TARGET_DIR)/boot/grub/$(GRUB_SPLASHIMAGE) || \
- cp $(GRUB_SPLASHIMAGE) $(TARGET_DIR)/boot/grub/
+define GRUB_INSTALL_SPLASH
+ cp boot/grub/splash.xpm.gz $(TARGET_DIR)/boot/grub/
+endef
endif
- touch $@
-grub: $(GRUB_DIR)/.installed
+define GRUB_INSTALL_TARGET_CMDS
+ install -m 0755 -D $(@D)/grub/grub $(TARGET_DIR)/sbin/grub
+ mkdir -p $(TARGET_DIR)/boot/grub
+ cp $(@D)/stage1/stage1 $(TARGET_DIR)/boot/grub
+ cp $(@D)/stage2/*1_5 $(TARGET_DIR)/boot/grub
+ cp $(@D)/stage2/stage2 $(TARGET_DIR)/boot/grub
+ $(GRUB_INSTALL_SPLASH)
+endef
+
+define GRUB_UNINSTALL_STAGING_CMDS
+ rm -f $(STAGING_DIR)/sbin/grub
+endef
-grub-clean:
- $(MAKE) DESTDIR=$(TARGET_DIR) CC="$(TARGET_CC)" -C $(GRUB_DIR) uninstall
- -$(MAKE) -C $(GRUB_DIR) clean
- rm -f $(TARGET_DIR)/boot/grub/$(GRUB_SPLASHIMAGE) \
- $(TARGET_DIR)/sbin/$(GRUB_BINARY) \
- $(TARGET_DIR)/boot/grub/{stage{1,2},*1_5}
+define GRUB_UNINSTALL_TARGET_CMDS
+ rm -f $(TARGET_DIR)/sbin/grub
+ rm -rf $(TARGET_DIR)/boot/grub
+endef
-grub-dirclean:
- rm -rf $(GRUB_DIR)
+$(eval $(call AUTOTARGETS,boot,grub))
#############################################################
#