fs/ubifs: spin-off ubi to be its own filesystem
authorYann E. MORIN <yann.morin.1998@free.fr>
Thu, 28 Dec 2017 10:40:31 +0000 (11:40 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 3 Jan 2018 20:57:49 +0000 (21:57 +0100)
Currently, the ubifs-in-ubi-image ("UBI image" thereafter) filesystem
is half an option of the ubifs filesystem, half a filesystem on its
own: the config options are options of the ubifs filesystem, but the
.mk code is in a separate .mk and registers a real filesystem.

Make it a full filesystem on its own, in its own directory tree.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
fs/Config.in
fs/ubi/Config.in [new file with mode: 0644]
fs/ubi/ubi.mk [new file with mode: 0644]
fs/ubi/ubinize.cfg [new file with mode: 0644]
fs/ubifs/Config.in
fs/ubifs/ubi.mk [deleted file]
fs/ubifs/ubinize.cfg [deleted file]

index 51ccf28169efebe225550c80f80524e6e639c47a..c25b01c3de083dc8c52be8c1ceccaee8c6f530c3 100644 (file)
@@ -11,6 +11,7 @@ source "fs/jffs2/Config.in"
 source "fs/romfs/Config.in"
 source "fs/squashfs/Config.in"
 source "fs/tar/Config.in"
+source "fs/ubi/Config.in"
 source "fs/ubifs/Config.in"
 source "fs/yaffs2/Config.in"
 
diff --git a/fs/ubi/Config.in b/fs/ubi/Config.in
new file mode 100644 (file)
index 0000000..5fa2f1f
--- /dev/null
@@ -0,0 +1,51 @@
+config BR2_TARGET_ROOTFS_UBI
+       bool "ubi image containing an ubifs root filesystem"
+       select BR2_TARGET_ROOTFS_UBIFS
+       help
+         Build an ubi image from the ubifs one (with ubinize).
+
+if BR2_TARGET_ROOTFS_UBI
+
+config BR2_TARGET_ROOTFS_UBI_PEBSIZE
+       hex "physical eraseblock size"
+       default 0x20000
+       help
+         Tells ubinize the physical eraseblock (PEB) size of the
+         flash chip the ubi image is created for. The value provided
+         here is passed to the -p/--peb-size option of ubinize.
+
+config BR2_TARGET_ROOTFS_UBI_SUBSIZE
+       int "sub-page size"
+       default 512
+       help
+         Tells ubinize that the flash supports sub-pages and the sub-page
+         size. Use 0 if sub-pages are not supported on flash chip.
+         The value provided here is passed to the -s/--sub-page-size
+         option of ubinize.
+
+config BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG
+       bool "Use custom config file"
+       help
+         Select this option to use a custom ubinize configuration file,
+         rather than the default configuration used by Buildroot (which
+         defines a single dynamic volume marked as auto-resize).  Passing
+         a custom ubinize configuration file allows you to create several
+         volumes, specify volume types, etc.
+
+         As a convenience, buildroot replaces the string
+         "BR2_ROOTFS_UBIFS_PATH" with the path to the built ubifs file.
+         So the volume defined for the root filesystem can specify the
+         image path as:  image=BR2_ROOTFS_UBIFS_PATH
+
+config BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE
+       string "Configuration file path"
+       depends on BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG
+       help
+         Path to the ubinize configuration file.
+
+config BR2_TARGET_ROOTFS_UBI_OPTS
+       string "Additional ubinize options"
+       help
+         Any additional ubinize options you may want to include.
+
+endif # BR2_TARGET_ROOTFS_UBI
diff --git a/fs/ubi/ubi.mk b/fs/ubi/ubi.mk
new file mode 100644 (file)
index 0000000..b71a555
--- /dev/null
@@ -0,0 +1,32 @@
+################################################################################
+#
+# 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/ubi/ubinize.cfg
+endif
+
+# don't use sed -i as it misbehaves on systems with SELinux enabled when this is
+# executed through fakeroot (see #9386)
+define ROOTFS_UBI_CMD
+       sed 's;BR2_ROOTFS_UBIFS_PATH;$@fs;' \
+               $(UBINIZE_CONFIG_FILE_PATH) > $(BUILD_DIR)/ubinize.cfg
+       $(HOST_DIR)/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) $(BUILD_DIR)/ubinize.cfg
+       rm $(BUILD_DIR)/ubinize.cfg
+endef
+
+$(eval $(call ROOTFS_TARGET,ubi))
diff --git a/fs/ubi/ubinize.cfg b/fs/ubi/ubinize.cfg
new file mode 100644 (file)
index 0000000..b0aace7
--- /dev/null
@@ -0,0 +1,8 @@
+[ubifs]
+mode=ubi
+vol_id=0
+vol_type=dynamic
+vol_name=rootfs
+vol_alignment=1
+vol_flags=autoresize
+image=BR2_ROOTFS_UBIFS_PATH
index ff604c5c383992bb132d9cfdf4e8495d42bfed72..e79ab9a17ea82fde05ecb81bbfb54af7753646cd 100644 (file)
@@ -95,55 +95,4 @@ config BR2_TARGET_ROOTFS_UBIFS_OPTS
        help
          Any additional mkfs.ubifs options you may want to include.
 
-config BR2_TARGET_ROOTFS_UBI
-       bool "Embed into an UBI image"
-       help
-         Build an ubi image from the ubifs one (with ubinize).
-
-if BR2_TARGET_ROOTFS_UBI
-
-config BR2_TARGET_ROOTFS_UBI_PEBSIZE
-       hex "physical eraseblock size"
-       default 0x20000
-       help
-         Tells ubinize the physical eraseblock (PEB) size of the
-         flash chip the ubi image is created for. The value provided
-         here is passed to the -p/--peb-size option of ubinize.
-
-config BR2_TARGET_ROOTFS_UBI_SUBSIZE
-       int "sub-page size"
-       default 512
-       help
-         Tells ubinize that the flash supports sub-pages and the sub-page
-         size. Use 0 if sub-pages are not supported on flash chip.
-         The value provided here is passed to the -s/--sub-page-size
-         option of ubinize.
-
-config BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG
-       bool "Use custom config file"
-       help
-         Select this option to use a custom ubinize configuration file,
-         rather than the default configuration used by Buildroot (which
-         defines a single dynamic volume marked as auto-resize).  Passing
-         a custom ubinize configuration file allows you to create several
-         volumes, specify volume types, etc.
-
-         As a convenience, buildroot replaces the string
-         "BR2_ROOTFS_UBIFS_PATH" with the path to the built ubifs file.
-         So the volume defined for the root filesystem can specify the
-         image path as:  image=BR2_ROOTFS_UBIFS_PATH
-
-config BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE
-       string "Configuration file path"
-       depends on BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG
-       help
-         Path to the ubinize configuration file.
-
-config BR2_TARGET_ROOTFS_UBI_OPTS
-       string "Additional ubinize options"
-       help
-         Any additional ubinize options you may want to include.
-
-endif # BR2_TARGET_ROOTFS_UBI
-
 endif # BR2_TARGET_ROOTFS_UBIFS
diff --git a/fs/ubifs/ubi.mk b/fs/ubifs/ubi.mk
deleted file mode 100644 (file)
index 2baece5..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-################################################################################
-#
-# 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
-
-# don't use sed -i as it misbehaves on systems with SELinux enabled when this is
-# executed through fakeroot (see #9386)
-define ROOTFS_UBI_CMD
-       sed 's;BR2_ROOTFS_UBIFS_PATH;$@fs;' \
-               $(UBINIZE_CONFIG_FILE_PATH) > $(BUILD_DIR)/ubinize.cfg
-       $(HOST_DIR)/sbin/ubinize -o $@ $(UBI_UBINIZE_OPTS) $(BUILD_DIR)/ubinize.cfg
-       rm $(BUILD_DIR)/ubinize.cfg
-endef
-
-$(eval $(call ROOTFS_TARGET,ubi))
diff --git a/fs/ubifs/ubinize.cfg b/fs/ubifs/ubinize.cfg
deleted file mode 100644 (file)
index b0aace7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-[ubifs]
-mode=ubi
-vol_id=0
-vol_type=dynamic
-vol_name=rootfs
-vol_alignment=1
-vol_flags=autoresize
-image=BR2_ROOTFS_UBIFS_PATH