summaryrefslogtreecommitdiffstats
path: root/target/cpio
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
parent7d8c2838efc66fbd5aa65d09c4a112a1e8403917 (diff)
downloadbuildroot-90b4498219622856e9b8c4c102dc39e2dd468f0a.tar.gz
buildroot-90b4498219622856e9b8c4c102dc39e2dd468f0a.zip
Allow compression of cpio targets
Diffstat (limited to 'target/cpio')
-rw-r--r--target/cpio/Config.in35
-rw-r--r--target/cpio/cpioroot.mk53
2 files changed, 78 insertions, 10 deletions
diff --git a/target/cpio/Config.in b/target/cpio/Config.in
index 7769388871..496a4da0fb 100644
--- a/target/cpio/Config.in
+++ b/target/cpio/Config.in
@@ -5,3 +5,38 @@ config BR2_TARGET_ROOTFS_CPIO
help
Build a cpio archive of the root filesystem
+choice
+ prompt "Compression method"
+ default BR2_TARGET_ROOTFS_CPIO_NONE
+ depends on BR2_TARGET_ROOTFS_CPIO
+ help
+ Select compressor for cpio filesystem of the root filesystem
+
+config BR2_TARGET_ROOTFS_CPIO_NONE
+ bool "no compression"
+ help
+ Do not compress the cpio filesystem.
+
+config BR2_TARGET_ROOTFS_CPIO_GZIP
+ bool "gzip"
+ help
+ Do compress the cpio filesystem with gzip.
+ Note that you either have to have gzip installed on your host
+ or select to build a gzip for your host. See the packages submenu.
+
+config BR2_TARGET_ROOTFS_CPIO_BZIP2
+ bool "bzip2"
+ help
+ Do compress the cpio filesystem with bzip2.
+ Note that you either have to have bzip2 installed on your host
+ or select to build a bzip2 for your host. See the packages submenu.
+
+config BR2_TARGET_ROOTFS_CPIO_LZMA
+ bool "lzma"
+ help
+ Do compress the cpio filesystem with lzma.
+ Note that you either have to have lzma installed on your host
+ or select to build a lzma for your host. See the packages submenu.
+
+endchoice
+
diff --git a/target/cpio/cpioroot.mk b/target/cpio/cpioroot.mk
index e04cff3fd9..7b14d2186c 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:
OpenPOWER on IntegriCloud