+
+endif
+
+ifneq ($(CONFIG_TARGET_ROOTFS_CPIOGZ),)
+ define Image/mkfs/cpiogz
+ ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9 >$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
+ endef
+endif
+
+ifneq ($(CONFIG_TARGET_ROOTFS_TARGZ),)
+ define Image/mkfs/targz
+ # Preserve permissions (-p) when building as non-root user
+ $(TAR) -czpf $(BIN_DIR)/$(IMG_PREFIX)-rootfs.tar.gz --numeric-owner --owner=0 --group=0 -C $(TARGET_DIR)/ .
+ endef
+endif
+
+ifneq ($(CONFIG_TARGET_ROOTFS_EXT4FS),)
+ E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024)))
+
+ define Image/mkfs/ext4
+# generate an ext2 fs
+ $(STAGING_DIR_HOST)/bin/genext2fs -U -b $(E2SIZE) -N $(CONFIG_TARGET_ROOTFS_MAXINODE) -d $(TARGET_DIR)/ $(KDIR)/root.ext4
+# convert it to ext4
+ $(STAGING_DIR_HOST)/bin/tune2fs -O extents,uninit_bg,dir_index $(KDIR)/root.ext4
+# fix it up
+ $(STAGING_DIR_HOST)/bin/e2fsck -fy $(KDIR)/root.ext4
+ $(call Image/Build,ext4)
+ endef
+endif
+
+ifneq ($(CONFIG_TARGET_ROOTFS_ISO),)
+ define Image/mkfs/iso
+ $(call Image/Build,iso)
+ endef