- Patch from Thomas Lundquist to support lzma compressed ext2 rootfs.
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sat, 4 Nov 2006 19:15:56 +0000 (19:15 -0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sat, 4 Nov 2006 19:15:56 +0000 (19:15 -0000)
package/lzma/Config.in
package/lzma/lzma.mk
target/ext2/Config.in
target/ext2/ext2root.mk

index a977b32f49508495576b6180e5c41f5b0e1c78e0..774d7711b696ccefaeba340fdaba3aebb766de8c 100644 (file)
@@ -1,14 +1,22 @@
-config BR2_PACKAGE_LZMA
-       bool "lzma"
+config BR2_PACKAGE_LZMA_TARGET
+       bool "Install lzma for the target system"
        default n
        help
-         Compression utility.
+         lzma utils on the target
 
          http://tukaani.org/lzma/
 
 config BR2_PACKAGE_LZMA_TARGET_HEADERS
        bool "lzma headers in target"
        default n
-       depends on BR2_PACKAGE_LZMA
+       depends on BR2_PACKAGE_LZMA_TARGET
        help
          Put headers files in the target.
+
+config BR2_PACKAGE_LZMA_HOST
+       bool "Install lzma for the host/build system"
+       default n
+       help
+         lzma utils on the host
+
+         http://tukaani.org/lzma/
index 5b29ab490a5f95832284d590ec81d6d1682890e9..d0f223434c0cbda816c5b5aab62f127e3e13dc37 100644 (file)
@@ -6,7 +6,8 @@
 LZMA_VER:=4.32.0beta3
 LZMA_SOURCE:=lzma-$(LZMA_VER).tar.gz
 LZMA_SITE:=http://tukaani.org/lzma/
-LZMA_DIR:=$(BUILD_DIR)/lzma-$(LZMA_VER)
+LZMA_HOST_DIR:=$(TOOL_BUILD_DIR)/lzma-$(LZMA_VER)
+LZMA_TARGET_DIR:=$(BUILD_DIR)/lzma-$(LZMA_VER)
 LZMA_CFLAGS:=$(TARGET_CFLAGS)
 ifeq ($(BR2_LARGEFILE),y)
 LZMA_CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
@@ -18,13 +19,47 @@ endif
 $(DL_DIR)/$(LZMA_SOURCE):
        $(WGET) -P $(DL_DIR) $(LZMA_SITE)/$(LZMA_SOURCE)
 
-$(LZMA_DIR)/.source: $(DL_DIR)/$(LZMA_SOURCE)
-       $(ZCAT) $(DL_DIR)/$(LZMA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
-       toolchain/patch-kernel.sh $(LZMA_DIR) package/lzma/ lzma\*.patch
-       touch $(LZMA_DIR)/.source
+######################################################################
+#
+# lzma host
+#
+######################################################################
+
+$(LZMA_HOST_DIR)/.source: $(DL_DIR)/$(LZMA_SOURCE)
+       zcat $(DL_DIR)/$(LZMA_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
+       toolchain/patch-kernel.sh $(LZMA_HOST_DIR) package/lzma/ lzma\*.patch
+       touch $(LZMA_HOST_DIR)/.source
+
+$(LZMA_HOST_DIR)/.configured: $(LZMA_HOST_DIR)/.source
+       (cd $(LZMA_HOST_DIR); rm -f config.cache ;\
+               CC="$(HOSTCC)" \
+               ./configure \
+               --prefix=/ \
+       );
+       touch $(LZMA_HOST_DIR)/.configured;
+
+$(LZMA_HOST_DIR)/src/lzma/lzma: $(LZMA_HOST_DIR)/.configured
+       $(MAKE) -C $(LZMA_HOST_DIR) all
+       touch -c $@
+
+$(STAGING_DIR)/bin/lzma: $(LZMA_HOST_DIR)/src/lzma/lzma
+       $(MAKE) DESTDIR=$(STAGING_DIR) -C $(LZMA_HOST_DIR) install
 
-$(LZMA_DIR)/.configured: $(LZMA_DIR)/.source
-       (cd $(LZMA_DIR); rm -f config.cache ;\
+lzma-host: uclibc $(STAGING_DIR)/bin/lzma
+
+######################################################################
+#
+# lzma target
+#
+######################################################################
+
+$(LZMA_TARGET_DIR)/.source: $(DL_DIR)/$(LZMA_SOURCE)
+       zcat $(DL_DIR)/$(LZMA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+       toolchain/patch-kernel.sh $(LZMA_TARGET_DIR) package/lzma/ lzma\*.patch
+       touch $(LZMA_TARGET_DIR)/.source
+
+$(LZMA_TARGET_DIR)/.configured: $(LZMA_TARGET_DIR)/.source
+       (cd $(LZMA_TARGET_DIR); rm -f config.cache ;\
                $(TARGET_CONFIGURE_OPTS) \
                CFLAGS="$(TARGET_CFLAGS) $(LZMA_CFLAGS)" \
                ac_cv_func_malloc_0_nonnull=yes \
@@ -33,37 +68,33 @@ $(LZMA_DIR)/.configured: $(LZMA_DIR)/.source
                --host=$(GNU_TARGET_NAME) \
                --build=$(GNU_HOST_NAME) \
                --prefix=/usr \
-               --exec-prefix=$(STAGING_DIR)/usr/bin \
-               --libdir=$(STAGING_DIR)/lib \
-               --includedir=$(STAGING_DIR)/include \
+               --exec-prefix=$(TARGET_DIR)/usr/bin \
+               --libdir=$(TARGET_DIR)/lib \
+               --includedir=$(TARGET_DIR)/include \
                --disable-debug \
                $(DISABLE_NLS) \
                $(LZMA_LARGEFILE) \
        );
-       touch $(LZMA_DIR)/.configured;
+       touch $(LZMA_TARGET_DIR)/.configured;
 
-$(LZMA_DIR)/src/lzma/lzma: $(LZMA_DIR)/.configured
-       $(MAKE) -C $(LZMA_DIR) all
+$(LZMA_TARGET_DIR)/src/lzma/lzma: $(LZMA_TARGET_DIR)/.configured
+       $(MAKE) -C $(LZMA_TARGET_DIR) all
        touch -c $@
 
-$(STAGING_DIR)/bin/lzma: $(LZMA_DIR)/src/lzma/lzma
-       -cp -dpf $(LZMA_DIR)/src/lzma/lzma $(STAGING_DIR)/bin/;
-       touch -c $(STAGING_DIR)/bin/lzma
-
-$(TARGET_DIR)/bin/lzma: $(STAGING_DIR)/bin/lzma
-       cp -dpf $(STAGING_DIR)/bin/lzma $(TARGET_DIR)/bin/;
+$(TARGET_DIR)/usr/bin/lzma: $(LZMA_TARGET_DIR)/src/lzma/lzma
+       -cp -dpf $(LZMA_TARGET_DIR)/src/lzma/lzma $(TARGET_DIR)/bin/;
        -$(STRIP) --strip-unneeded $(TARGET_DIR)/bin/lzma
        touch -c $(TARGET_DIR)/bin/lzma
 
 #lzma-headers: $(TARGET_DIR)/bin/lzma
 
-lzma: uclibc $(TARGET_DIR)/bin/lzma
+lzma-target: uclibc $(TARGET_DIR)/usr/bin/lzma
 
 lzma-source: $(DL_DIR)/$(LZMA_SOURCE)
 
 lzma-clean:
-       rm -f $(TARGET_DIR)/bin/lzma
-       -$(MAKE) -C $(LZMA_DIR) clean
+       rm -f $(TARGET_DIR)/usr/bin/lzma
+       -$(MAKE) -C $(LZMA_TARGET_DIR) clean
 
 lzma-dirclean:
        rm -rf $(LZMA_DIR)
@@ -73,9 +104,14 @@ lzma-dirclean:
 # Toplevel Makefile options
 #
 #############################################################
-ifeq ($(strip $(BR2_PACKAGE_LZMA)),y)
-TARGETS+=lzma
+ifeq ($(strip $(BR2_PACKAGE_LZMA_HOST)),y)
+TARGETS+=lzma-host
+endif
+
+ifeq ($(strip $(BR2_PACKAGE_LZMA_TARGET)),y)
+TARGETS+=lzma-target
 endif
+
 #ifeq ($(strip $(BR2_PACKAGE_LZMA_TARGET_HEADERS)),y)
 #TARGETS+=lzma-headers
 #endif
index 7671caa81921afc89fa8ed936ca9fc2ed1460c57..7f15884ffac40c7f8ca477221d2985c26999b1cc 100644 (file)
@@ -34,6 +34,13 @@ config BR2_TARGET_ROOTFS_EXT2_GZ
        depends on      BR2_TARGET_ROOTFS_EXT2
        default n
 
+config BR2_TARGET_ROOTFS_EXT2_LZMA
+       bool "lzma the output file" 
+       depends on      BR2_TARGET_ROOTFS_EXT2 
+       select          BR2_PACKAGE_LZMA_HOST
+       default n
+
+
 config BR2_TARGET_ROOTFS_EXT2_COPYTO
        string "also copy the image to..."
        depends on      BR2_TARGET_ROOTFS_EXT2
index c7c7cb20055664f73e0ff4b9ef9d5c7c2746f8ab..c88437f2b75a62bd423d9258ddd3c8dbd65183a0 100644 (file)
@@ -66,6 +66,10 @@ else
 EXT2_TARGET := $(EXT2_BASE)
 endif
 
+ifeq ($(strip $(BR2_TARGET_ROOTFS_EXT2_LZMA)),y)
+EXT2_TARGET := $(EXT2_BASE).lzma
+endif
+
 $(EXT2_BASE): host-fakeroot makedevs genext2fs
        -@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true;
        @rm -rf $(TARGET_DIR)/usr/man
@@ -102,6 +106,9 @@ endif
 $(EXT2_BASE).gz: $(EXT2_BASE)
        @gzip --best -fv $(EXT2_BASE)
 
+$(EXT2_BASE).lzma: lzma-host $(EXT2_BASE)
+       @$(STAGING_DIR)/bin/lzma -vc $(EXT2_BASE) > $(EXT2_BASE).lzma
+
 EXT2_COPYTO := $(strip $(subst ",,$(BR2_TARGET_ROOTFS_EXT2_COPYTO)))
 # " stupid syntax highlighting does not like unmatched quote from above line