2006-11-22 20:10:59 +01:00
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# cpio to archive target filesystem
|
|
|
|
#
|
|
|
|
#############################################################
|
|
|
|
|
2007-08-12 00:01:13 +02:00
|
|
|
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
|
|
|
|
|
2007-10-05 14:55:40 +02:00
|
|
|
ROOTFS_CPIO_COPYTO:=$(strip $(subst ",,$(BR2_TARGET_ROOTFS_CPIO_COPYTO)))
|
|
|
|
# "))
|
|
|
|
#
|
2006-11-22 20:10:59 +01:00
|
|
|
|
|
|
|
cpioroot-init:
|
2006-11-22 22:24:58 +01:00
|
|
|
rm -f $(TARGET_DIR)/init
|
2006-11-22 20:58:35 +01:00
|
|
|
ln -s sbin/init $(TARGET_DIR)/init
|
2006-11-22 20:10:59 +01:00
|
|
|
|
2007-08-12 00:01:13 +02:00
|
|
|
$(CPIO_BASE): host-fakeroot makedevs cpioroot-init
|
2007-10-01 18:15:31 +02:00
|
|
|
-@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true
|
2007-08-21 16:32:38 +02:00
|
|
|
ifneq ($(BR2_HAVE_MANPAGES),y)
|
2006-11-22 21:21:24 +01:00
|
|
|
@rm -rf $(TARGET_DIR)/usr/man
|
2007-08-21 16:32:38 +02:00
|
|
|
endif
|
|
|
|
ifneq ($(BR2_HAVE_INFOPAGES),y)
|
2006-11-22 21:21:24 +01:00
|
|
|
@rm -rf $(TARGET_DIR)/usr/info
|
2007-08-21 16:32:38 +02:00
|
|
|
endif
|
2007-08-25 13:13:20 +02:00
|
|
|
$(if $(TARGET_LDCONFIG),test -x $(TARGET_LDCONFIG) && $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null)
|
2006-11-22 21:21:24 +01:00
|
|
|
# Use fakeroot to pretend all target binaries are owned by root
|
2008-04-06 15:14:07 +02:00
|
|
|
rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
|
2007-08-16 20:19:42 +02:00
|
|
|
touch $(PROJECT_BUILD_DIR)/.fakeroot.00000
|
|
|
|
cat $(PROJECT_BUILD_DIR)/.fakeroot* > $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
|
|
|
|
echo "chown -R 0:0 $(TARGET_DIR)" >> $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
|
2007-02-15 17:49:39 +01:00
|
|
|
ifneq ($(TARGET_DEVICE_TABLE),)
|
2006-11-22 21:21:24 +01:00
|
|
|
# Use fakeroot to pretend to create all needed device nodes
|
|
|
|
echo "$(STAGING_DIR)/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" \
|
2007-08-16 20:19:42 +02:00
|
|
|
>> $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
|
2007-02-15 17:49:39 +01:00
|
|
|
endif
|
2006-11-22 21:21:24 +01:00
|
|
|
# Use fakeroot so tar believes the previous fakery
|
2007-08-12 00:01:13 +02:00
|
|
|
echo "cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $(CPIO_BASE)" \
|
2007-08-16 20:19:42 +02:00
|
|
|
>> $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
|
|
|
|
chmod a+x $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
|
|
|
|
$(STAGING_DIR)/usr/bin/fakeroot -- $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
|
|
|
|
#-@rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(CPIO_BASE))
|
2007-10-05 14:55:40 +02:00
|
|
|
ifeq ($(CPIO_ROOTFS_COMPRESSOR),)
|
|
|
|
ifneq ($(ROOTFS_CPIO_COPYTO),)
|
|
|
|
$(Q)cp -f $(CPIO_BASE) $(ROOTFS_CPIO_COPYTO)
|
|
|
|
endif
|
|
|
|
endif
|
2007-08-12 00:01:13 +02:00
|
|
|
|
|
|
|
ifneq ($(CPIO_ROOTFS_COMPRESSOR),)
|
|
|
|
$(CPIO_BASE).$(CPIO_ROOTFS_COMPRESSOR_EXT): $(CPIO_ROOTFS_COMPRESSOR_PREREQ) $(CPIO_BASE)
|
|
|
|
$(CPIO_ROOTFS_COMPRESSOR) $(CPIO_BASE) > $(CPIO_TARGET)
|
2007-10-05 14:55:40 +02:00
|
|
|
ifneq ($(ROOTFS_CPIO_COPYTO),)
|
|
|
|
$(Q)cp -f $(CPIO_BASE).$(CPIO_ROOTFS_COMPRESSOR_EXT) $(ROOTFS_CPIO_COPYTO).$(CPIO_ROOTFS_COMPRESSOR_EXT)
|
|
|
|
endif
|
2007-08-12 00:01:13 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
cpioroot: $(CPIO_TARGET)
|
2006-11-22 20:10:59 +01:00
|
|
|
|
|
|
|
cpioroot-source:
|
|
|
|
|
|
|
|
cpioroot-clean:
|
|
|
|
|
|
|
|
cpioroot-dirclean:
|
|
|
|
|
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# Toplevel Makefile options
|
|
|
|
#
|
|
|
|
#############################################################
|
2008-12-08 09:15:58 +01:00
|
|
|
ifeq ($(BR2_TARGET_ROOTFS_CPIO),y)
|
2006-11-22 20:10:59 +01:00
|
|
|
TARGETS+=cpioroot
|
|
|
|
endif
|