2005-02-09 17:06:06 +01:00
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# tar to archive target filesystem
|
|
|
|
#
|
|
|
|
#############################################################
|
|
|
|
|
2008-12-08 09:15:58 +01:00
|
|
|
TAR_OPTS:=$(BR2_TARGET_ROOTFS_TAR_OPTIONS)
|
2006-04-07 22:30:43 +02:00
|
|
|
TAR_TARGET:=$(IMAGE).tar
|
|
|
|
|
2006-11-29 20:16:48 +01:00
|
|
|
TAR_COMPRESSOR:=
|
|
|
|
TAR_COMPRESSOR_EXT:=.none
|
|
|
|
ifeq ($(BR2_TARGET_ROOTFS_TAR_GZIP),y)
|
2006-11-29 20:28:41 +01:00
|
|
|
TAR_COMPRESSOR:=gzip -9 -c
|
2006-11-29 20:16:48 +01:00
|
|
|
TAR_COMPRESSOR_EXT:=gz
|
|
|
|
endif
|
|
|
|
ifeq ($(BR2_TARGET_ROOTFS_TAR_BZIP2),y)
|
2006-11-29 20:28:41 +01:00
|
|
|
TAR_COMPRESSOR:=bzip2 -9 -c
|
2006-11-29 20:16:48 +01:00
|
|
|
TAR_COMPRESSOR_EXT:=bz2
|
|
|
|
endif
|
|
|
|
ifeq ($(BR2_TARGET_ROOTFS_TAR_LZMA),y)
|
2006-11-29 20:28:41 +01:00
|
|
|
TAR_COMPRESSOR:=lzma -9 -c
|
2006-11-29 20:16:48 +01:00
|
|
|
TAR_COMPRESSOR_EXT:=lzma
|
|
|
|
endif
|
2008-12-08 10:06:59 +01:00
|
|
|
ROOTFS_TAR_COPYTO:=$(strip $(subst ",,$(BR2_TARGET_ROOTFS_TAR_COPYTO)))
|
2007-10-05 14:55:40 +02:00
|
|
|
# "))
|
2006-11-29 20:16:48 +01:00
|
|
|
|
2006-04-07 22:30:43 +02:00
|
|
|
tarroot: host-fakeroot makedevs
|
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)
|
2005-02-09 17:06:06 +01:00
|
|
|
@rm -rf $(TARGET_DIR)/usr/man
|
2007-08-21 16:32:38 +02:00
|
|
|
endif
|
|
|
|
ifneq ($(BR2_HAVE_INFOPAGES),y)
|
2005-02-09 17:06:06 +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)
|
2005-06-24 09:31:17 +02:00
|
|
|
# Use fakeroot to pretend all target binaries are owned by root
|
2007-08-16 20:19:42 +02:00
|
|
|
rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
|
|
|
|
touch $(PROJECT_BUILD_DIR)/.fakeroot.00000
|
|
|
|
cat $(PROJECT_BUILD_DIR)/.fakeroot* > $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
|
|
|
|
echo "chown -R 0:0 $(TARGET_DIR)" >> $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
|
2007-02-15 17:49:39 +01:00
|
|
|
ifneq ($(TARGET_DEVICE_TABLE),)
|
2005-06-24 09:31:17 +02:00
|
|
|
# Use fakeroot to pretend to create all needed device nodes
|
2006-04-11 00:49:48 +02:00
|
|
|
echo "$(STAGING_DIR)/bin/makedevs -d $(TARGET_DEVICE_TABLE) $(TARGET_DIR)" \
|
2007-08-16 20:19:42 +02:00
|
|
|
>> $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
|
2007-02-15 17:49:39 +01:00
|
|
|
endif
|
2005-08-04 08:32:52 +02:00
|
|
|
# Use fakeroot so tar believes the previous fakery
|
2006-04-11 00:49:48 +02:00
|
|
|
echo "tar -c$(TAR_OPTS)f $(TAR_TARGET) -C $(TARGET_DIR) ." \
|
2007-08-16 20:19:42 +02:00
|
|
|
>> $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
|
|
|
|
chmod a+x $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
|
|
|
|
$(STAGING_DIR)/usr/bin/fakeroot -- $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
|
2006-11-29 20:16:48 +01:00
|
|
|
ifneq ($(TAR_COMPRESSOR),)
|
|
|
|
-rm -f $(TAR_TARGET).$()
|
2006-11-29 20:28:41 +01:00
|
|
|
PATH="$(STAGING_DIR)/sbin:$(STAGING_DIR)/bin:$(STAGING_DIR)/usr/sbin:$(STAGING_DIR)/usr/bin:$(PATH)" $(TAR_COMPRESSOR) $(TAR_TARGET) > $(TAR_TARGET).$(TAR_COMPRESSOR_EXT)
|
2007-10-05 14:55:40 +02:00
|
|
|
endif
|
|
|
|
ifneq ($(ROOTFS_TAR_COPYTO),)
|
|
|
|
$(Q)cp -f $(TAR_TARGET) $(ROOTFS_TAR_COPYTO)
|
2006-11-29 20:16:48 +01:00
|
|
|
endif
|
2007-08-16 20:19:42 +02:00
|
|
|
-@rm -f $(PROJECT_BUILD_DIR)/_fakeroot.$(notdir $(TAR_TARGET))
|
2005-02-09 17:06:06 +01:00
|
|
|
|
|
|
|
tarroot-source:
|
|
|
|
|
|
|
|
tarroot-clean:
|
|
|
|
|
|
|
|
tarroot-dirclean:
|
2005-02-10 04:06:39 +01:00
|
|
|
|
|
|
|
#############################################################
|
|
|
|
#
|
|
|
|
# Toplevel Makefile options
|
|
|
|
#
|
|
|
|
#############################################################
|
2008-12-08 09:15:58 +01:00
|
|
|
ifeq ($(BR2_TARGET_ROOTFS_TAR),y)
|
2005-02-10 04:06:39 +01:00
|
|
|
TARGETS+=tarroot
|
|
|
|
endif
|