[BL training-materials-updates] labs/sysdev-flash-filesystems: change how to get the LEB size

Thomas Petazzoni thomas.petazzoni at bootlin.com
Thu Apr 19 13:54:17 CEST 2018

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


commit 8ba471221769829faa78f21de4ee627d0e7426ab
Author: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Date:   Thu Apr 19 11:55:37 2018 +0200

    labs/sysdev-flash-filesystems: change how to get the LEB size
    Running ubiattach on an unitialized partition, while we haven't yet
    done the partitioning of our flash, just for the sake of getting the
    LEB size, seems a bit weird.
    It seems a lot more logical to look at the NAND flash characteristics,
    and use the explanations from the slides that allow to understand how
    the LEB size is calculated from the PEB size, the page size and
    sub-page size.
    So we use "nand info" in U-Boot, and then explain how to convert those
    details into the LEB size.
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>


 .../sysdev-flash-filesystems.tex                   | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index 6ce0671..998e3f8 100644
--- a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
+++ b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
@@ -53,21 +53,21 @@ card during the previous lab. We will get back to the filesystem sources
 that you have in \code{$HOME/embedded-linux-labs/tinysystem/nfsroot}.
 To run \code{mkfs.ubifs}, you will need to find the Logical Erase
-Block (LEB) size that UBI will use.
+Block (LEB) size that UBI will use. To find out this information,
+simply run \code{nand info} in U-Boot:
-A solution to get such information is to list default MTD partitions
-on the target (\code{cat /proc/mtd}), and attach the last partition
-to UBI. In case, the last partition is \code{mtd5}, you will run:
+\item The \code{Erase size} is 128KB, which is the size of the {\em
+    Physical Erase Block}
-ubiattach -m 5 /dev/ubi_ctrl
+\item Both the \code{Page size} and \code{subpagesize} are 2KB, which
+  means this NAND doesn't support sub-pages.
-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\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}}.
+Therefore, the size of one {\em LEB} is the size of the {\em PEB}
+minus the size of two pages: 128 KB - 2 * 2 KB, i.e {\bf 124 KB}.
 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

More information about the training-materials-updates mailing list