summaryrefslogtreecommitdiff
path: root/target/cpio/cpioroot.mk
diff options
context:
space:
mode:
authorUlf Samuelsson <ulf.samuelsson@atmel.com>2007-08-11 22:01:13 +0000
committerUlf Samuelsson <ulf.samuelsson@atmel.com>2007-08-11 22:01:13 +0000
commit90b4498219622856e9b8c4c102dc39e2dd468f0a (patch)
tree067d9eb9892b7de8621277a0ada43a148a6d610c /target/cpio/cpioroot.mk
parent7d8c2838efc66fbd5aa65d09c4a112a1e8403917 (diff)
Allow compression of cpio targets
Diffstat (limited to 'target/cpio/cpioroot.mk')
-rw-r--r--target/cpio/cpioroot.mk53
1 files changed, 43 insertions, 10 deletions
diff --git a/target/cpio/cpioroot.mk b/target/cpio/cpioroot.mk
index e04cff3fd..7b14d2186 100644
--- a/target/cpio/cpioroot.mk
+++ b/target/cpio/cpioroot.mk
@@ -4,13 +4,39 @@
#
#############################################################
-CPIO_TARGET:=$(IMAGE).cpio
+CPIO_BASE:=$(IMAGE).cpio
+
+CPIO_ROOTFS_COMPRESSOR:=
+CPIO_ROOTFS_COMPRESSOR_EXT:=
+CPIO_ROOTFS_COMPRESSOR_PREREQ:=
+ifeq ($(BR2_TARGET_ROOTFS_CPIO_GZIP),y)
+CPIO_ROOTFS_COMPRESSOR:=gzip -9 -c
+CPIO_ROOTFS_COMPRESSOR_EXT:=gz
+#CPIO_ROOTFS_COMPRESSOR_PREREQ:= gzip-host
+endif
+ifeq ($(BR2_TARGET_ROOTFS_CPIO_BZIP2),y)
+CPIO_ROOTFS_COMPRESSOR:=bzip2 -9 -c
+CPIO_ROOTFS_COMPRESSOR_EXT:=bz2
+#CPIO_ROOTFS_COMPRESSOR_PREREQ:= bzip2-host
+endif
+ifeq ($(BR2_TARGET_ROOTFS_CPIO_LZMA),y)
+CPIO_ROOTFS_COMPRESSOR:=lzma -9 -c
+CPIO_ROOTFS_COMPRESSOR_EXT:=lzma
+CPIO_ROOTFS_COMPRESSOR_PREREQ:= lzma-host
+endif
+
+ifneq ($(CPIO_ROOTFS_COMPRESSOR),)
+CPIO_TARGET := $(CPIO_BASE).$(CPIO_ROOTFS_COMPRESSOR_EXT)
+else
+CPIO_TARGET := $(CPIO_BASE)
+endif
+
cpioroot-init:
rm -f $(TARGET_DIR)/init
ln -s sbin/init $(TARGET_DIR)/init
-cpioroot: host-fakeroot makedevs cpioroot-init
+$(CPIO_BASE): host-fakeroot makedevs cpioroot-init
-@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true;
@rm -rf $(TARGET_DIR)/usr/man
@rm -rf $(TARGET_DIR)/usr/info
@@ -18,19 +44,26 @@ cpioroot: host-fakeroot makedevs cpioroot-init
# Use fakeroot to pretend all target binaries are owned by root
rm -f $(STAGING_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
touch $(STAGING_DIR)/.fakeroot.00000
- cat $(STAGING_DIR)/.fakeroot* > $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
- echo "chown -R 0:0 $(TARGET_DIR)" >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ cat $(STAGING_DIR)/.fakeroot* > $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
+ echo "chown -R 0:0 $(TARGET_DIR)" >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
ifneq ($(TARGET_DEVICE_TABLE),)
# Use fakeroot to pretend to create all needed device nodes
echo "$(STAGING_DIR)/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" \
- >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
endif
# Use fakeroot so tar believes the previous fakery
- echo "cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $(CPIO_TARGET)" \
- >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
- chmod a+x $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
- $(STAGING_DIR)/usr/bin/fakeroot -- $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
- #-@rm -f $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_TARGET))
+ echo "cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $(CPIO_BASE)" \
+ >> $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
+ chmod a+x $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
+ $(STAGING_DIR)/usr/bin/fakeroot -- $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
+ #-@rm -f $(STAGING_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
+
+ifneq ($(CPIO_ROOTFS_COMPRESSOR),)
+$(CPIO_BASE).$(CPIO_ROOTFS_COMPRESSOR_EXT): $(CPIO_ROOTFS_COMPRESSOR_PREREQ) $(CPIO_BASE)
+ $(CPIO_ROOTFS_COMPRESSOR) $(CPIO_BASE) > $(CPIO_TARGET)
+endif
+
+cpioroot: $(CPIO_TARGET)
cpioroot-source: