Add UBI image generation support. 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)
PATCH 1/1 Add UBI image generation support. 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)
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
@@ -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
@@ -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
@@ -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
@@ -77,3 +77,5 @@ config BR2_TARGET_ROOTFS_UBIFS_LZMA endchoice +source "fs/ubi/Config.in" +
Signature · 1 line
1.6.0.4
PATCH 1/1 Add UBI image generation support. 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)
Hello,
Thanks for this feature, it is definitely much appreciated.
First issue: the log of your patch. There should be one small line, like:
"Add UBI image generation support"
and then after one empty line, the rest of the description. Some comments below.
Quoted 7 lines
Signed-off-by Julien Boibessot <[email protected]>Signed-off-by Nicolas Colombain <[email protected]>--- fs/ubi/Config.in | 22 ++++++++++++++++++++++ fs/ubi/ubi.mk | 24 ++++++++++++++++++++++++ fs/ubi/ubinize.cfg | 7 +++++++ fs/ubifs/Config.in | 2 ++
I am not sure it should be a separate filesystem included into the ubifs-related options. I think I'd prefer to see something inside the UBIFS filesystem options, like:
[ ] Embed into a UBI image
and then have the code directly in fs/ubifs/ubifs.mk do the job of calling ubinize if needed.
Regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com