v2 Add UBI image generation support.
PATCH 1/1 v2 Add UBI image generation support.
From: Julien Boibessot <[email protected]>
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).
Changes since v1:
* change some comments/helps
* as requested by Thomas, merged fs/ubi/ in fs/ubifs/, but kept ubifs.mk and ubi.mk separated. (I don't know if it's really worth to merge them...)
--- fs/ubifs/Config.in | 22 ++++++++++++++++++++++ fs/ubifs/ubi.mk | 23 +++++++++++++++++++++++ fs/ubifs/ubinize.cfg | 7 +++++++ 3 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 fs/ubifs/ubi.mk create mode 100644 fs/ubifs/ubinize.cfg
fs/ubifs/Config.in +22 -0
@@ -77,3 +77,25 @@ 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 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 that sub-page + size is 512 bytes (by default). +
fs/ubifs/ubi.mk new file +23 -0
@@ -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))
fs/ubifs/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
Signature · 1 line
1.6.0.4
PATCH 1/1 v2 Add UBI image generation support.
Hello,
Thanks Julien for this UBI support, it's definitely good to have in Buildroot. This version looks good to me, but there is an alternate solution (patch below, merged into Julien's patch).
Peter, we need you to make a decision here, between those two solutions, because I have no strong opinion on which one is the best. To summarize:
* Julien's solution is to create a new root filesystem type, called "ubi", which depends on the "ubifs" filesystem to be generated. So at build time, the rootfs.ubifs image is first generated, and then the rootfs.ubi image is generated from rootfs.ubifs using ubinize. You end up with rootfs.ubifs and rootfs.ubi in $(O)/images.
* The other solution proposed below is to not add a new root filesystem type, but rather add a post-processing step to the rootfs.ubifs image when "Embed in UBI image" is selected. You end up with rootfs.ubifs in $(O)/images, regardless of whether it is a UBIFS filesystem image, or a complete UBI image.
I just implemented the second solution because it's how I would have implemented it if I had to do it, but I don't know if it's better or not than Julien's proposal.
Regards,
Thomas
PATCH 1/1 v2 Add UBI image generation support.
Hi,
Quoted 1 line · Thomas Petazzoni
Hello,
[...]
Quoted 5 lines
?* The other solution proposed below is to not add a new root ? filesystem type, but rather add a post-processing step to the ? rootfs.ubifs image when "Embed in UBI image" is selected. You end up ? with rootfs.ubifs in $(O)/images, regardless of whether it is a ? UBIFS filesystem image, or a complete UBI image.
How about using .ubi filename extension for UBI images (and .ubifs for UBIFS) so it's easy to spot what's what?
Best regards,
Bj?rn Forsman
PATCH 1/1 v2 Add UBI image generation support.
In reply to Thomas PetazzoniHello,
Thomas Petazzoni a ?crit :
Quoted 6 lines
* The other solution proposed below is to not add a new root filesystem type, but rather add a post-processing step to the rootfs.ubifs image when "Embed in UBI image" is selected. You end up with rootfs.ubifs in $(O)/images, regardless of whether it is a UBIFS filesystem image, or a complete UBI image.
I took (what I think is) the OpenEmbedded approch: generates both a .ubifs image and a .ubi one.
We (armadeus) are most of the time using the UBI image to update our systems from U-Boot, but I think people might be interested in having at the same time both UBI and UBIFS images in their tftpboot directory and know the difference by looking at the filename.
Regards,
Julien
PATCH 1/1 v2 Add UBI image generation support.
In reply to julien.boibessot at free.frHello,
Quoted 6 lines · On Tue, 21 Dec 2010 18:38:07 +0100 julien.boibessot at free.fr wrote:
From: Julien Boibessot <[email protected]>
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).
Quoted 7 lines
Changes since v1:
* change some comments/helps
* as requested by Thomas, mergedfs/ubi/infs/ubifs/, but kept ubifs.mk and ubi.mk separated. (I don't know if it's really worth to merge them...)Signed-off-by Julien Boibessot <[email protected]>Signed-off-by Nicolas Colombain <[email protected]>
After thinking about this a bit, I think having two separate images is better, as it is more clear for the user what the image actually is. Therefore, I think this version from Julien should be applied, and it gets my:
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 v2 Add UBI image generation support.
In reply to julien.boibessot at free.frQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"julien" == julien boibessot <[email protected]> writes:
julien> From: Julien Boibessot <[email protected]> julien> UBI images are generated from UBIFS one (with ubinize tool) and are used by julien> bootloaders (eg U-Boot) to write UBIFS images directly on bare NAND FLASH julien> (see http://www.linux-mtd.infradead.org/faq/ubi.html).
Committed, thanks!
julien> Changes since v1:
julien> * change some comments/helps
julien> * as requested by Thomas, merged fs/ubi/ in fs/ubifs/, but kept ubifs.mk and
julien> ubi.mk separated. (I don't know if it's really worth to merge them...)
These comments to reviewers (which shouldn't be part of the final commit message) normally goes after the '---' line, so 'git am' doesn't include them.
Same for the subject - The 'v2' should be in the [PATCH] square brackets so it doesn't get included.
Signature · 1 line
Bye, Peter Korsgaard