ubifs: Add UBI image generation support.
authorJulien Boibessot <julien.boibessot@armadeus.com>
Tue, 21 Dec 2010 17:38:07 +0000 (18:38 +0100)
committerPeter Korsgaard <jacmet@sunsite.dk>
Tue, 11 Jan 2011 21:39:05 +0000 (22:39 +0100)
UBI images are generated from UBIFS one (with ubinize tool) and are used by
bootloaders (eg U-Boot) to write UBIFS images directly on bare NAND FLASH
(see http://www.linux-mtd.infradead.org/faq/ubi.html).

[Peter: tweak help text]
Signed-off-by: Julien Boibessot <julien.boibessot@armadeus.com>
Signed-off-by: Nicolas Colombain <nicolas.colombain@armadeus.com>
Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
fs/ubifs/Config.in
fs/ubifs/ubi.mk [new file with mode: 0644]
fs/ubifs/ubinize.cfg [new file with mode: 0644]

index bcf409cad6e34879b591d27376e4556463e466ed..a5ef5f2b29cfc992b70082d2d2e467f38d4c08fa 100644 (file)
@@ -77,3 +77,24 @@ config BR2_TARGET_ROOTFS_UBIFS_LZMA
 
 endchoice
 
+config BR2_TARGET_ROOTFS_UBI
+       depends on BR2_TARGET_ROOTFS_UBIFS
+       bool "Embed into an UBI image"
+       help
+         Build an ubi image from the ubifs one (with ubinize).
+
+config BR2_TARGET_ROOTFS_UBI_PEBSIZE
+       hex "UBI physical erase block size"
+       depends on BR2_TARGET_ROOTFS_UBI
+       default 0x20000
+       help
+         Tells ubinize the physical eraseblock size of the flash chip
+         the ubi image is created for.
+
+config BR2_TARGET_ROOTFS_UBI_SUBSIZE
+       int "UBI sub-page size"
+       depends on BR2_TARGET_ROOTFS_UBI
+       default 512
+       help
+         Tells ubinize that the flash supports sub-pages and the sub-page
+         size. Use 0 if subpages are not supported on flash chip.
diff --git a/fs/ubifs/ubi.mk b/fs/ubifs/ubi.mk
new file mode 100644 (file)
index 0000000..c88e336
--- /dev/null
@@ -0,0 +1,23 @@
+#############################################################
+#
+# Embed the ubifs image into an ubi one
+#
+#############################################################
+
+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
+
+ROOTFS_UBI_DEPENDENCIES = rootfs-ubifs
+
+define ROOTFS_UBI_CMD
+       cp fs/ubifs/ubinize.cfg . ;\
+       echo "image=$$@fs" \
+               >> ./ubinize.cfg ;\
+       $(HOST_DIR)/usr/sbin/ubinize -o $$@ $(UBI_UBINIZE_OPTS) ubinize.cfg ;\
+       rm ubinize.cfg
+endef
+
+$(eval $(call ROOTFS_TARGET,ubi))
diff --git a/fs/ubifs/ubinize.cfg b/fs/ubifs/ubinize.cfg
new file mode 100644 (file)
index 0000000..6515271
--- /dev/null
@@ -0,0 +1,7 @@
+[ubifs]
+mode=ubi
+vol_id=0
+vol_type=dynamic
+vol_name=rootfs
+vol_alignment=1
+vol_flags=autoresize