Skip to contentSkip to conversation

Allow creation of sub-filesystems from the whole target filesystem

RFC PATCH New David VomLehn 1 participant 1 message May 19, 2014

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Allow creation of sub-filesystems from the whole target filesystem

[I need this functionality and things look to be working as I intended, but is an RFC because I need other people's feedback to evaluate whether this is a reasonable interface. Please give it a quick whirl--thanks!]

An example: Say that there is a filesystem where:
o The root filesystem needs to be a cpio file for use as an initramfs
filesystems, recreated on each boot.
o Most of /home needs to be in NAND flash, but shouldn't be writeable.
o /home/user1 and /home/user2 need to be writeable filesystems in NAND
flash. A tar image of /home/user1 also needs to be generated so it can be reinitialized, if necessary.

This patch allow these three filesystem images to be created from the target directory, with contents specified as follows:
o cpio: /
o squashfs: /home
o JFFS2: /home/user1 /home/user2
o tar: home/user1

Five files will be generated:
rootfs.cpio root-homefs.squashfs root-home-user1fs.jffs2
root-home-user1fs.tar root-home-user2fs.jffs2

---
 Makefile                       |   2 +-
 fs/Config.in                   |  25 +++++
 fs/cloop/Config.in             |  12 +++
 fs/cloop/cloop-post.mk         |  13 +++
 fs/cloop/cloop-pre.mk          |   7 ++
 fs/common.mk                   | 222 +++++++++++++++++++++++++++++++++++++----
 fs/cpio/Config.in              |  12 +++
 fs/cpio/cpio-post.mk           |  43 ++++++++
 fs/cpio/cpio-pre.mk            |   7 ++
 fs/cramfs/Config.in            |  12 +++
 fs/cramfs/cramfs-post.mk       |  19 ++++
 fs/cramfs/cramfs-pre.mk        |   7 ++
 fs/ext2/Config.in              |  12 +++
 fs/ext2/ext2-post.mk           |  37 +++++++
 fs/ext2/ext2-pre.mk            |   6 ++
 fs/initramfs/initramfs-post.mk |  22 ++++
 fs/initramfs/initramfs-pre.mk  |   5 +
 fs/iso9660/iso9660-post.mk     |  51 ++++++++++
 fs/iso9660/iso9660-pre.mk      |   9 ++
 fs/jffs2/Config.in             |  12 +++
 fs/jffs2/jffs2-post.mk         |  49 +++++++++
 fs/jffs2/jffs2-pre.mk          |   7 ++
 fs/romfs/Config.in             |  12 +++
 fs/romfs/romfs-post.mk         |  15 +++
 fs/romfs/romfs-pre.mk          |   7 ++
 fs/squashfs/Config.in          |  12 +++
 fs/squashfs/squashfs-post.mk   |  29 ++++++
 fs/squashfs/squashfs-pre.mk    |   7 ++
 fs/tar/Config.in               |  12 +++
 fs/tar/tar-post.mk             |  13 +++
 fs/tar/tar-pre.mk              |   7 ++
 fs/ubifs/Config.in             |  12 +++
 fs/ubifs/ubi-post.mk           |  30 ++++++
 fs/ubifs/ubi-pre.mk            |   7 ++
 fs/ubifs/ubifs-post.mk         |  27 +++++
 fs/ubifs/ubifs-pre.mk          |   7 ++
 fs/yaffs2/Config.in            |  12 +++
 fs/yaffs2/yaffs-post.mk        |  13 +++
 fs/yaffs2/yaffs-pre.mk         |   7 ++
 39 files changed, 799 insertions(+), 21 deletions(-)
 create mode 100644 fs/cloop/cloop-post.mk
 create mode 100644 fs/cloop/cloop-pre.mk
 create mode 100644 fs/cpio/cpio-post.mk
 create mode 100644 fs/cpio/cpio-pre.mk
 create mode 100644 fs/cramfs/cramfs-post.mk
 create mode 100644 fs/cramfs/cramfs-pre.mk
 create mode 100644 fs/ext2/ext2-post.mk
 create mode 100644 fs/ext2/ext2-pre.mk
 create mode 100644 fs/initramfs/initramfs-post.mk
 create mode 100644 fs/initramfs/initramfs-pre.mk
 create mode 100644 fs/iso9660/iso9660-post.mk
 create mode 100644 fs/iso9660/iso9660-pre.mk
 create mode 100644 fs/jffs2/jffs2-post.mk
 create mode 100644 fs/jffs2/jffs2-pre.mk
 create mode 100644 fs/romfs/romfs-post.mk
 create mode 100644 fs/romfs/romfs-pre.mk
 create mode 100644 fs/squashfs/squashfs-post.mk
 create mode 100644 fs/squashfs/squashfs-pre.mk
 create mode 100644 fs/tar/tar-post.mk
 create mode 100644 fs/tar/tar-pre.mk
 create mode 100644 fs/ubifs/ubi-post.mk
 create mode 100644 fs/ubifs/ubi-pre.mk
 create mode 100644 fs/ubifs/ubifs-post.mk
 create mode 100644 fs/ubifs/ubifs-pre.mk
 create mode 100644 fs/yaffs2/yaffs-post.mk
 create mode 100644 fs/yaffs2/yaffs-pre.mk
Makefile +1 -1
index 4b93805..9856974 100644
@@ -332,7 +332,7 @@ TARGET_SKELETON = $(TOPDIR)/system/skeleton
 
 # Location of a file giving a big fat warning that output/target
 # should not be used as the root filesystem.
-TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
+TARGET_DIR_WARNING_FILE = THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
 
 ifeq ($(BR2_CCACHE),y)
 CCACHE := $(HOST_DIR)/usr/bin/ccache
fs/Config.in +25 -0
index 5853113..22df250 100644
@@ -1,5 +1,30 @@
 menu "Filesystem images"
 
+config BR2_BUILD_SUB_FILESYSTEMS
+	bool "Build sub-filesystems"
+	help
+	  Normally, all target files will be put into a single root filesystem.
+	  Choosing this option allows sub-directories of the root filesystem
+	  to be split into sub-filesystems, possible of different types.
+	  These filesystems can then be written to different devices and
+	  mounted at boot time to create the original view of the root
+	  filesystem.
+
+	  Note that this will split up the root filesystems based on the
+	  concatenation of filesystems listed under all filesystems types.
+	  So, if "/ and /usr" are listed under cpio and "/ /usr/share" are
+	  listed under JFFS2, four filesystem images will be created:
+	  o	rootfs.cpio: A cpio image containing everything under the
+	  	original root filesystem except for /usr
+	  o	rootfs.jffs:  A JFFS2 image with everything under the original
+	  	root filesystem except for /usr, i.e the same contents as
+	  	rootfs.cpio, but as a different filesystem image type.
+	  o	rootfs-usrfs.cpio: Everything under the original /usr directory
+	  	except for files under /usr/share, but including the /usr/share
+	  	directory.
+	  o	rootfs-usr-sharefs.jffs2: Everything under the original
+	  	/usr/share directory.
+
 source "fs/cloop/Config.in"
 source "fs/cpio/Config.in"
 source "fs/cramfs/Config.in"
fs/cloop/Config.in +12 -0
index 3e01067..5900cb2 100644
@@ -8,3 +8,15 @@ config BR2_TARGET_ROOTFS_CLOOP
 	  compressed filesystem like a block device and seamlessly
 	  decompress its data while accessing it.  The majority of the
 	  software on an LNX-BBC is accessed in this fashion.
+
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_CLOOP_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with cloop"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_CLOOP
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
fs/cloop/cloop-post.mk new file +13 -0
new file mode 100644
index 0000000..a3dd5d4
@@ -0,0 +1,13 @@
+################################################################################
+#
+# Build the compressed loop root filesystem image
+#
+################################################################################
+
+ROOTFS_CLOOP_DEPENDENCIES = host-cloop host-cdrkit
+
+define ROOTFS_CLOOP_CMD
+	$(HOST_DIR)/usr/bin/genisoimage -r $(1) | $(HOST_DIR)/usr/bin/create_compressed_fs - 65536 > $@
+endef
+
+$(eval $(call ROOTFS_TARGETS,cloop,$(CLOOP_SUBFS)))
fs/cloop/cloop-pre.mk new file +7 -0
new file mode 100644
index 0000000..ffef696
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define cloop filesystems
+#
+################################################################################
+
+CLOOP_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_CLOOP_SUB_FILESYSTEMS),/)
fs/common.mk +202 -20

261 lines not on this page · raw message

fs/cpio/Config.in +12 -0
index 206baca..7c79bd1 100644
@@ -5,6 +5,18 @@ config BR2_TARGET_ROOTFS_CPIO
 	  used for an initial RAM filesystem that is passed to the kernel
 	  by the bootloader.
 
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_CPIO_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with cpio"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_CPIO
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
+
 if BR2_TARGET_ROOTFS_CPIO
 
 choice
fs/cpio/cpio-post.mk new file +43 -0

43 lines not on this page · raw message

fs/cpio/cpio-pre.mk new file +7 -0
new file mode 100644
index 0000000..6792979
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define cpio filesystems
+#
+################################################################################
+
+CPIO_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_CPIO_SUB_FILESYSTEMS),/)
fs/cramfs/Config.in +12 -0
index 1a4e326..0ab687f 100644
@@ -4,3 +4,15 @@ config BR2_TARGET_ROOTFS_CRAMFS
 	  Build a cramfs root filesystem
 
 	  http://sourceforge.net/projects/cramfs/
+
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_CRAMFS_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with cramfs"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_CRAMFS
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
fs/cramfs/cramfs-post.mk new file +19 -0
new file mode 100644
index 0000000..aa27363
@@ -0,0 +1,19 @@
+################################################################################
+#
+# Build the cramfs root filesystem image
+#
+################################################################################
+
+ifeq ($(BR2_ENDIAN),"BIG")
+CRAMFS_OPTS = -b
+else
+CRAMFS_OPTS = -l
+endif
+
+define ROOTFS_CRAMFS_CMD
+ $(HOST_DIR)/usr/bin/mkcramfs $(CRAMFS_OPTS) $(1) $@
+endef
+
+ROOTFS_CRAMFS_DEPENDENCIES = host-cramfs
+
+$(eval $(call ROOTFS_TARGETS,cramfs,$(CRAMFS_SUBFS)))
fs/cramfs/cramfs-pre.mk new file +7 -0
new file mode 100644
index 0000000..3aff37c
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define cramfs filesystems
+#
+################################################################################
+
+CRAMFS_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_CRAMFS_SUB_FILESYSTEMS),/)
fs/ext2/Config.in +12 -0
index adba6f3..b2c18ee 100644
@@ -5,6 +5,18 @@ config BR2_TARGET_ROOTFS_EXT2
 	help
 	  Build an ext2/3/4 root filesystem
 
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_EXT2_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with ext2/3/4"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_EXT2
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
+
 if BR2_TARGET_ROOTFS_EXT2
 
 config BR2_TARGET_ROOTFS_EXT2_2
fs/ext2/ext2-post.mk new file +37 -0
new file mode 100644
index 0000000..a577b56
@@ -0,0 +1,37 @@
+################################################################################
+#
+# Build the ext2 root filesystem image
+#
+################################################################################
+
+EXT2_OPTS :=
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)),0)
+EXT2_OPTS += -b $(BR2_TARGET_ROOTFS_EXT2_BLOCKS)
+endif
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_INODES)),0)
+EXT2_OPTS += -N $(BR2_TARGET_ROOTFS_EXT2_INODES)
+endif
+
+ifneq ($(strip $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)),0)
+EXT2_OPTS += -m $(BR2_TARGET_ROOTFS_EXT2_RESBLKS)
+endif
+
+ROOTFS_EXT2_DEPENDENCIES = host-genext2fs host-e2fsprogs
+
+EXT2_ENV  = GEN=$(BR2_TARGET_ROOTFS_EXT2_GEN)
+EXT2_ENV += REV=$(BR2_TARGET_ROOTFS_EXT2_REV)
+
+define ROOTFS_EXT2_CMD
+	PATH=$(BR_PATH) $(EXT2_ENV) fs/ext2/genext2fs.sh -d $(1) $(EXT2_OPTS) $@
+endef
+
+rootfs-ext2-symlink:
+	ln -sf rootfs.ext2$(ROOTFS_EXT2_COMPRESS_EXT) $(BINARIES_DIR)/rootfs.ext$(BR2_TARGET_ROOTFS_EXT2_GEN)$(ROOTFS_EXT2_COMPRESS_EXT)
+
+ifneq ($(BR2_TARGET_ROOTFS_EXT2_GEN),2)
+ROOTFS_EXT2_POST_TARGETS += rootfs-ext2-symlink
+endif
+
+$(eval $(call ROOTFS_TARGETS,ext2,$(EXT2_SUBFS)))
fs/ext2/ext2-pre.mk new file +6 -0
new file mode 100644
index 0000000..5c937f4
@@ -0,0 +1,6 @@
+################################################################################
+#
+# Define ext2/3/4 filesystems
+#
+################################################################################
+EXT2_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_EXT2_SUB_FILESYSTEMS),/)
fs/initramfs/initramfs-post.mk new file +22 -0
new file mode 100644
index 0000000..5d3ea89
@@ -0,0 +1,22 @@
+################################################################################
+#
+# Build a kernel with an integrated initial ramdisk
+# filesystem based on cpio.
+#
+################################################################################
+
+ROOTFS_INITRAMFS_DEPENDENCIES += rootfs-cpio
+
+ROOTFS_INITRAMFS_POST_TARGETS += linux26-rebuild-with-initramfs
+
+
+# The generic fs infrastructure isn't very useful here.
+
+rootfs-initramfs: $(ROOTFS_INITRAMFS_DEPENDENCIES) $(ROOTFS_INITRAMFS_POST_TARGETS)
+
+rootfs-initramfs-show-depends:
+	@echo $(ROOTFS_INITRAMFS_DEPENDENCIES)
+
+ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
+TARGETS_ROOTFS += rootfs-initramfs
+endif
fs/initramfs/initramfs-pre.mk new file +5 -0
new file mode 100644
index 0000000..e637d4b
@@ -0,0 +1,5 @@
+################################################################################
+#
+# Define initramfs filesystems, which doesn't really fit in quite right
+#
+################################################################################
fs/iso9660/iso9660-post.mk new file +51 -0

51 lines not on this page · raw message

fs/iso9660/iso9660-pre.mk new file +9 -0
new file mode 100644
index 0000000..f1edaf5
@@ -0,0 +1,9 @@
+################################################################################
+#
+# Build ISO9660 filesystems
+#
+# Cannot be converted to the ROOTFS_TARGET infrastructure, because of
+# the temporary construction in ISO9660_TARGET_DIR.
+#
+################################################################################
+
fs/jffs2/Config.in +12 -0
index e2a3ee9..2e8a008 100644
@@ -3,6 +3,18 @@ config BR2_TARGET_ROOTFS_JFFS2
 	help
 	  Build a jffs2 root filesystem
 
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_JFFS2_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with JFFS2"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_JFFS2
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
+
 if BR2_TARGET_ROOTFS_JFFS2
 
 choice
fs/jffs2/jffs2-post.mk new file +49 -0

49 lines not on this page · raw message

fs/jffs2/jffs2-pre.mk new file +7 -0
new file mode 100644
index 0000000..e647cce
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define JFFS2 filesystems
+#
+################################################################################
+
+JFFS2_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_JFFS2_SUB_FILESYSTEMS),/)
fs/romfs/Config.in +12 -0
index 84944a0..5db5c3b 100644
@@ -2,3 +2,15 @@ config BR2_TARGET_ROOTFS_ROMFS
 	bool "romfs root filesystem"
 	help
 	  Build a romfs image of the root filesystem.
+
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_ROMFS_SUB_FILESYSTEMS
+	string "Sub-filesystems to build as a ROMFS filesystem"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_ROMFS
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
fs/romfs/romfs-post.mk new file +15 -0
new file mode 100644
index 0000000..2c93740
@@ -0,0 +1,15 @@
+################################################################################
+#
+# Build the romfs root filesystem image
+#
+################################################################################
+
+ROMFS_TARGET=$(IMAGE).romfs
+
+ROOTFS_ROMFS_DEPENDENCIES = host-genromfs
+
+define ROOTFS_ROMFS_CMD
+	$(HOST_DIR)/usr/bin/genromfs -d $(1) -f $@
+endef
+
+$(eval $(call ROOTFS_TARGETS,romfs,$(ROMFS_SUBFS)))
fs/romfs/romfs-pre.mk new file +7 -0
new file mode 100644
index 0000000..ce5d279
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define romfs filesystems
+#
+################################################################################
+
+ROMFS_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_ROMFS_SUB_FILESYSTEMS),/)
fs/squashfs/Config.in +12 -0
index 817909d..f4b27c0 100644
@@ -3,6 +3,18 @@ config BR2_TARGET_ROOTFS_SQUASHFS
 	help
 	  Build a squashfs root filesystem
 
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_SQUASHFS_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with squashfs"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_SQUASHFS
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
+
 if BR2_TARGET_ROOTFS_SQUASHFS
 
 choice
fs/squashfs/squashfs-post.mk new file +29 -0
new file mode 100644
index 0000000..9c8fe3f
@@ -0,0 +1,29 @@
+################################################################################
+#
+# Build the squashfs root filesystem image
+#
+################################################################################
+
+ROOTFS_SQUASHFS_DEPENDENCIES = host-squashfs
+
+ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZO),y)
+ROOTFS_SQUASHFS_ARGS += -comp lzo
+else
+ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZMA),y)
+ROOTFS_SQUASHFS_ARGS += -comp lzma
+else
+ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_XZ),y)
+ROOTFS_SQUASHFS_ARGS += -comp xz
+else
+ROOTFS_SQUASHFS_ARGS += -comp gzip
+endif
+endif
+endif
+
+define ROOTFS_SQUASHFS_CMD
+	$(HOST_DIR)/usr/bin/mksquashfs $(1) $@ -noappend \
+		$(ROOTFS_SQUASHFS_ARGS) && \
+	chmod 0644 $@
+endef
+
+$(eval $(call ROOTFS_TARGETS,squashfs,$(SQUASHFS_SUBFS)))
fs/squashfs/squashfs-pre.mk new file +7 -0
new file mode 100644
index 0000000..be95a96
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define squashfs filesystems
+#
+################################################################################
+
+SQUASHFS_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_SQUASHFS_SUB_FILESYSTEMS),/)
fs/tar/Config.in +12 -0
index 63663ec..e65b3fa 100644
@@ -4,6 +4,18 @@ config BR2_TARGET_ROOTFS_TAR
 	help
 	  Build a tar archive of the root filesystem
 
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_TAR_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with tar"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_TAR
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
+
 choice
 	prompt "Compression method"
 	default BR2_TARGET_ROOTFS_TAR_NONE
fs/tar/tar-post.mk new file +13 -0
new file mode 100644
index 0000000..9acf8d4
@@ -0,0 +1,13 @@
+################################################################################
+#
+# tar to archive target filesystem
+#
+################################################################################
+
+TAR_OPTS := $(BR2_TARGET_ROOTFS_TAR_OPTIONS)
+
+define ROOTFS_TAR_CMD
+ tar -c$(TAR_OPTS)f $@ -C $(1) .
+endef
+
+$(eval $(call ROOTFS_TARGETS,tar,$(TAR_SUBFS)))
fs/tar/tar-pre.mk new file +7 -0
new file mode 100644
index 0000000..771c5c4
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define tar-archived filesystems
+#
+################################################################################
+
+TAR_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_TAR_SUB_FILESYSTEMS),/)
fs/ubifs/Config.in +12 -0
index ff604c5..1aeca86 100644
@@ -3,6 +3,18 @@ config BR2_TARGET_ROOTFS_UBIFS
 	help
 	  Build a ubifs root filesystem
 
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_UBIFS_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with ubifs"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_UBIFS
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
+
 if BR2_TARGET_ROOTFS_UBIFS
 
 config BR2_TARGET_ROOTFS_UBIFS_LEBSIZE
fs/ubifs/ubi-post.mk new file +30 -0
new file mode 100644
index 0000000..aa9af24
@@ -0,0 +1,30 @@
+################################################################################
+#
+# Embed the ubifs image into an ubi image
+#
+################################################################################
+
+UBI_UBINIZE_OPTS := -m $(BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE)
+UBI_UBINIZE_OPTS += -p $(BR2_TARGET_ROOTFS_UBI_PEBSIZE)
+ifneq ($(BR2_TARGET_ROOTFS_UBI_SUBSIZE),0)
+UBI_UBINIZE_OPTS += -s $(BR2_TARGET_ROOTFS_UBI_SUBSIZE)
+endif
+
+UBI_UBINIZE_OPTS += $(call qstrip,$(BR2_TARGET_ROOTFS_UBI_OPTS))
+
+ROOTFS_UBI_DEPENDENCIES = rootfs-ubifs
+
+ifeq ($(BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG),y)
+UBINIZE_CONFIG_FILE_PATH = $(call qstrip,$(BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE))
+else
+UBINIZE_CONFIG_FILE_PATH = fs/ubifs/ubinize.cfg
+endif
+
+define ROOTFS_UBI_CMD
+	$(INSTALL) -m 0644 $(UBINIZE_CONFIG_FILE_PATH) $(BUILD_DIR)/ubinize.cfg ;\
+	$(SED) 's;BR2_ROOTFS_UBIFS_PATH;$@fs;' $(BUILD_DIR)/ubinize.cfg ;\
+	$(HOST_DIR)/usr/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) $(BUILD_DIR)/ubinize.cfg ;\
+	rm $(BUILD_DIR)/ubinize.cfg
+endef
+
+$(eval $(call ROOTFS_TARGETS,ubi,$(UBI_SUBFS)))
fs/ubifs/ubi-pre.mk new file +7 -0
new file mode 100644
index 0000000..da6b800
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define embedded UBI filesystems
+#
+################################################################################
+
+UBI_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_UBI_SUB_FILESYSTEMS),/)
fs/ubifs/ubifs-post.mk new file +27 -0
new file mode 100644
index 0000000..7e5d88e
@@ -0,0 +1,27 @@
+################################################################################
+#
+# Build the ubifs root filesystem image
+#
+################################################################################
+
+UBIFS_OPTS := -e $(BR2_TARGET_ROOTFS_UBIFS_LEBSIZE) -c $(BR2_TARGET_ROOTFS_UBIFS_MAXLEBCNT) -m $(BR2_TARGET_ROOTFS_UBIFS_MINIOSIZE)
+
+ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_ZLIB),y)
+UBIFS_OPTS += -x zlib
+endif
+ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_LZO),y)
+UBIFS_OPTS += -x lzo
+endif
+ifeq ($(BR2_TARGET_ROOTFS_UBIFS_RT_NONE),y)
+UBIFS_OPTS += -x none
+endif
+
+UBIFS_OPTS += $(call qstrip,$(BR2_TARGET_ROOTFS_UBIFS_OPTS))
+
+ROOTFS_UBIFS_DEPENDENCIES = host-mtd
+
+define ROOTFS_UBIFS_CMD
+	$(HOST_DIR)/usr/sbin/mkfs.ubifs -d $(1) $(UBIFS_OPTS) -o $@
+endef
+
+$(eval $(call ROOTFS_TARGETS,ubifs,$(UBIFS_SUBFS)))
fs/ubifs/ubifs-pre.mk new file +7 -0
new file mode 100644
index 0000000..25a8fde
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define ubifs filesystems
+#
+################################################################################
+
+UBIFS_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_UBIFS_SUB_FILESYSTEMS),/)
fs/yaffs2/Config.in +12 -0
index 27da4ba..23fe6fb 100644
@@ -2,3 +2,15 @@ config BR2_TARGET_ROOTFS_YAFFS2
 	bool "yaffs2 root filesystem"
 	help
 	  Build a yaffs2 root filesystem
+
+if BR2_BUILD_SUB_FILESYSTEMS
+config BR2_YAFFS2_SUB_FILESYSTEMS
+	string "Sub-filesystems to build with YAFFS2"
+	default "/"
+	depends on BR2_TARGET_ROOTFS_YAFFS2
+	help
+	  Provide a space-separated list of the root directories of all
+	  filesystems. For example to build a root filesystem with a
+	  separate /usr filesystem, enter:
+	    / /usr
+endif # BR2_BUILD_SUB_FILESYSTEMS
fs/yaffs2/yaffs-post.mk new file +13 -0
new file mode 100644
index 0000000..84a1072
@@ -0,0 +1,13 @@
+################################################################################
+#
+# Build the yaffs2 root filesystem image
+#
+################################################################################
+
+ROOTFS_YAFFS2_DEPENDENCIES = host-yaffs2utils
+
+define ROOTFS_YAFFS2_CMD
+	$(HOST_DIR)/usr/bin/mkyaffs2 --all-root $(1) $@
+endef
+
+$(eval $(call ROOTFS_TARGETS,yaffs2,$(YAFFS2_SUBFS)))
fs/yaffs2/yaffs-pre.mk new file +7 -0
new file mode 100644
index 0000000..2f96b95
@@ -0,0 +1,7 @@
+################################################################################
+#
+# Define YAFFS2 filesystems
+#
+################################################################################
+
+YAFFS2_SUBFS = $(if $(BR2_BUILD_SUB_FILESYSTEMS),$(BR2_YAFFS2_SUB_FILESYSTEMS),/)
Signature · 1 line
1.8.5.1