Skip to contentSkip to conversation

Add UBI image generation support.

PATCH New julien.boibessot at free.fr 1 participant 2 messages Dec 21, 2010 UBI file system (UBIFS)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add UBI image generation support.

From: Julien Boibessot <[email protected]>

---
 fs/ubi/Config.in   |   22 ++++++++++++++++++++++
 fs/ubi/ubi.mk      |   24 ++++++++++++++++++++++++
 fs/ubi/ubinize.cfg |    7 +++++++
 fs/ubifs/Config.in |    2 ++
 4 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100644 fs/ubi/Config.in
 create mode 100644 fs/ubi/ubi.mk
 create mode 100644 fs/ubi/ubinize.cfg
fs/ubi/Config.in new file +22 -0
new file mode 100644
index 0000000..b4433f7
@@ -0,0 +1,22 @@
+config BR2_TARGET_ROOTFS_UBI
+	depends on BR2_TARGET_ROOTFS_UBIFS
+	bool "generate ubi image"
+	help
+	  Build a UBI image of the UBIFS root filesystem.
+
+config BR2_TARGET_ROOTFS_UBI_PEBSIZE
+	hex "UBI physical erase block size"
+	depends on BR2_TARGET_ROOTFS_UBI
+	default 0x20000
+	help
+	  Tells ubinize that physical eraseblock size of the flash chip the UBI
+	  image is created for is 0x20000 (by default).
+
+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 sub-page size is
+	  512 bytes (by default).
+
fs/ubi/ubi.mk new file +24 -0
new file mode 100644
index 0000000..71e41c3
@@ -0,0 +1,24 @@
+#############################################################
+#
+# Build the UBI root filesystem 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
+
+
+ROOTFS_UBI_DEPENDENCIES = rootfs-ubifs
+
+define ROOTFS_UBI_CMD
+	cp fs/ubi/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))
fs/ubi/ubinize.cfg new file +7 -0
new file mode 100644
index 0000000..6515271
@@ -0,0 +1,7 @@
+[ubifs]
+mode=ubi
+vol_id=0
+vol_type=dynamic
+vol_name=rootfs
+vol_alignment=1
+vol_flags=autoresize
fs/ubifs/Config.in +2 -0
index bcf409c..e150f9b 100644
@@ -77,3 +77,5 @@ config BR2_TARGET_ROOTFS_UBIFS_LZMA
 
 endchoice
 
+source "fs/ubi/Config.in"
+
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH 1/1 Add UBI image generation support.

sorry but the patch comment doesn't want to go inside the mail (my fault)... Here it is:

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)

julien.boibessot at free.fr a ?crit :

Quoted 97 lines

From: Julien Boibessot <[email protected]>

---
 fs/ubi/Config.in   |   22 ++++++++++++++++++++++
 fs/ubi/ubi.mk      |   24 ++++++++++++++++++++++++
 fs/ubi/ubinize.cfg |    7 +++++++
 fs/ubifs/Config.in |    2 ++
 4 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100644 fs/ubi/Config.in
 create mode 100644 fs/ubi/ubi.mk
 create mode 100644 fs/ubi/ubinize.cfg
fs/ubi/Config.in new file +22 -0
new file mode 100644
index 0000000..b4433f7
@@ -0,0 +1,22 @@
+config BR2_TARGET_ROOTFS_UBI
+	depends on BR2_TARGET_ROOTFS_UBIFS
+	bool "generate ubi image"
+	help
+	  Build a UBI image of the UBIFS root filesystem.
+
+config BR2_TARGET_ROOTFS_UBI_PEBSIZE
+	hex "UBI physical erase block size"
+	depends on BR2_TARGET_ROOTFS_UBI
+	default 0x20000
+	help
+	  Tells ubinize that physical eraseblock size of the flash chip the UBI
+	  image is created for is 0x20000 (by default).
+
+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 sub-page size is
+	  512 bytes (by default).
+
fs/ubi/ubi.mk new file +24 -0
new file mode 100644
index 0000000..71e41c3
@@ -0,0 +1,24 @@
+#############################################################
+#
+# Build the UBI root filesystem 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
+
+
+ROOTFS_UBI_DEPENDENCIES = rootfs-ubifs
+
+define ROOTFS_UBI_CMD
+	cp fs/ubi/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))
fs/ubi/ubinize.cfg new file +7 -0
new file mode 100644
index 0000000..6515271
@@ -0,0 +1,7 @@
+[ubifs]
+mode=ubi
+vol_id=0
+vol_type=dynamic
+vol_name=rootfs
+vol_alignment=1
+vol_flags=autoresize
fs/ubifs/Config.in +2 -0
index bcf409c..e150f9b 100644
@@ -77,3 +77,5 @@ config BR2_TARGET_ROOTFS_UBIFS_LZMA
 
 endchoice
 
+source "fs/ubi/Config.in"
+