[FE training-materials-updates] Flash materials: clarify/correct -c option of mkfs.ubifs

Michael Opdenacker michael.opdenacker at free-electrons.com
Thu May 26 17:58:45 CEST 2016

Repository : git://git.free-electrons.com/training-materials.git
On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=705758a00da362d4f066ea1bcad20c26f11c47e1


commit 705758a00da362d4f066ea1bcad20c26f11c47e1
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Thu May 26 14:21:18 2016 +0200

    Flash materials: clarify/correct -c option of mkfs.ubifs
    Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>


 .../sysdev-flash-filesystems.tex                         | 16 ++++++++++++----
 .../sysdev-flash-filesystems.tex                         |  7 +++++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index 9135f75..0172113 100644
--- a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
+++ b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
@@ -64,10 +64,18 @@ ubiattach -m 5 /dev/ubi_ctrl
 Doing this, you will get details in the kernel log about the MTD minimum
-I/O size and the LEB size that UBI will use.
+I/O size and the LEB size that UBI will use\footnote{Note that this command
+could fail if you accidently wrote to the corresponding flash blocks.
+If this happens, go back to U-Boot and erase NAND sectors from the
+starting offset of this partition: \code{nand erase 0x660000 0xF9A0000}}.
-Using such information, prepare prepare a UBIFS filesystem
-image containing the files stored in the \code{www/upload/files} directory.
+Knowing that the \code{data} and \code{rootfs} UBI volumes will be 16
+MiB big, you can now divide their total size by the LEB size, to compute
+the maximum of LEBs that they will contain. That's the last parameter
+(\code{-c}) that you need to pass to \code{mkfs.ubifs}.
+You can now prepare a UBIFS filesystem image containing the files
+stored in the \code{www/upload/files} directory.
 Modify the \code{etc/init.d/rcS} file under \code{nfsroot} to mount a
 UBI volume called \code{data} \footnote{We will create it when
@@ -237,7 +245,7 @@ root filesystem:
   \item Boot on your new rootfs
-%TODO: provide a correction
+%TODO: provide a solution
 \subsection{Atomic update}
diff --git a/slides/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/slides/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index 1ab0304..b4fba37 100644
--- a/slides/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
+++ b/slides/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
@@ -705,8 +705,11 @@ vol_flags=autoresize
       \item \code{-e 258048}, logical erase block size (smaller than
                  PEB size, can be found in the kernel log after running
-      \item \code{-c 1000}, maximum number of logical erase
-        blocks. Details:
+      \item \code{-c 1000}, maximum size of the UBI volume the image
+        will be flashed into, in number of logical erase blocks.
+        Do not make this number unnecessary big, otherwise the UBIFS
+        data structures will be bigger than needed and performance
+        will be degraded. Details:
     \item Once created

More information about the training-materials-updates mailing list