[FE training-materials-updates] Update flash storage labs

Boris Brezillon boris.brezillon at free-electrons.com
Fri May 15 16:28:49 CEST 2015


Repository : git://git.free-electrons.com/training-materials.git

On branch  : mtd-rework-WIP
Link       : http://git.free-electrons.com/training-materials/commit/?id=a9b13ddae2e135b494f640518bca58c11975d040

>---------------------------------------------------------------

commit a9b13ddae2e135b494f640518bca58c11975d040
Author: Boris Brezillon <boris.brezillon at free-electrons.com>
Date:   Fri May 15 16:27:35 2015 +0200

    Update flash storage labs
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>


>---------------------------------------------------------------

a9b13ddae2e135b494f640518bca58c11975d040
 labs/sysdev-flash-filesystems/flash-map.dia        | 559 ++++++++-------------
 .../sysdev-flash-filesystems.tex                   | 238 +++++++--
 2 files changed, 410 insertions(+), 387 deletions(-)

diff --git a/labs/sysdev-flash-filesystems/flash-map.dia b/labs/sysdev-flash-filesystems/flash-map.dia
index 4c0c06a..15cfa21 100644
--- a/labs/sysdev-flash-filesystems/flash-map.dia
+++ b/labs/sysdev-flash-filesystems/flash-map.dia
@@ -597,55 +597,26 @@ backup#</dia:string>
         <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Box" version="0" id="O18">
+    <dia:object type="Standard - Text" version="1" id="O18">
       <dia:attribute name="obj_pos">
-        <dia:point val="30.5,17"/>
-      </dia:attribute>
-      <dia:attribute name="obj_bb">
-        <dia:rectangle val="30.45,16.95;33.55,21.05"/>
-      </dia:attribute>
-      <dia:attribute name="elem_corner">
-        <dia:point val="30.5,17"/>
-      </dia:attribute>
-      <dia:attribute name="elem_width">
-        <dia:real val="3"/>
-      </dia:attribute>
-      <dia:attribute name="elem_height">
-        <dia:real val="4"/>
-      </dia:attribute>
-      <dia:attribute name="border_width">
-        <dia:real val="0.10000000149011612"/>
-      </dia:attribute>
-      <dia:attribute name="border_color">
-        <dia:color val="#868686"/>
-      </dia:attribute>
-      <dia:attribute name="inner_color">
-        <dia:color val="#e5e5e5"/>
-      </dia:attribute>
-      <dia:attribute name="show_background">
-        <dia:boolean val="true"/>
-      </dia:attribute>
-    </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O19">
-      <dia:attribute name="obj_pos">
-        <dia:point val="32,19"/>
+        <dia:point val="40.5,23.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="31.3388,18.6262;32.6613,19.3737"/>
+        <dia:rectangle val="39.55,23.2688;41.45,23.7312"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#DTB#</dia:string>
+            <dia:string>#0x860000#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
-            <dia:font family="sans" style="0" name="Helvetica"/>
+            <dia:font family="monospace" style="0" name="Courier"/>
           </dia:attribute>
           <dia:attribute name="height">
-            <dia:real val="0.80000000000000004"/>
+            <dia:real val="0.49388886988162994"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="32,19.2212"/>
+            <dia:point val="40.5,23.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -658,22 +629,19 @@ backup#</dia:string>
       <dia:attribute name="valign">
         <dia:enum val="2"/>
       </dia:attribute>
-      <dia:connections>
-        <dia:connection handle="0" to="O18" connection="8"/>
-      </dia:connections>
     </dia:object>
-    <dia:object type="Standard - Box" version="0" id="O20">
+    <dia:object type="Standard - Box" version="0" id="O19">
       <dia:attribute name="obj_pos">
-        <dia:point val="33.5,17"/>
+        <dia:point val="30.5,17"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="33.45,16.95;36.55,21.05"/>
+        <dia:rectangle val="30.45,16.95;49.55,21.05"/>
       </dia:attribute>
       <dia:attribute name="elem_corner">
-        <dia:point val="33.5,17"/>
+        <dia:point val="30.5,17"/>
       </dia:attribute>
       <dia:attribute name="elem_width">
-        <dia:real val="3"/>
+        <dia:real val="19"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
         <dia:real val="4"/>
@@ -691,52 +659,16 @@ backup#</dia:string>
         <dia:boolean val="true"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O21">
+    <dia:object type="Standard - Line" version="0" id="O20">
       <dia:attribute name="obj_pos">
-        <dia:point val="35,19"/>
-      </dia:attribute>
-      <dia:attribute name="obj_bb">
-        <dia:rectangle val="33.9937,18.6262;36.0063,19.3737"/>
-      </dia:attribute>
-      <dia:attribute name="text">
-        <dia:composite type="text">
-          <dia:attribute name="string">
-            <dia:string>#Kernel#</dia:string>
-          </dia:attribute>
-          <dia:attribute name="font">
-            <dia:font family="sans" style="0" name="Helvetica"/>
-          </dia:attribute>
-          <dia:attribute name="height">
-            <dia:real val="0.80000000000000004"/>
-          </dia:attribute>
-          <dia:attribute name="pos">
-            <dia:point val="35,19.2212"/>
-          </dia:attribute>
-          <dia:attribute name="color">
-            <dia:color val="#000000"/>
-          </dia:attribute>
-          <dia:attribute name="alignment">
-            <dia:enum val="1"/>
-          </dia:attribute>
-        </dia:composite>
-      </dia:attribute>
-      <dia:attribute name="valign">
-        <dia:enum val="2"/>
-      </dia:attribute>
-      <dia:connections>
-        <dia:connection handle="0" to="O20" connection="8"/>
-      </dia:connections>
-    </dia:object>
-    <dia:object type="Standard - Line" version="0" id="O22">
-      <dia:attribute name="obj_pos">
-        <dia:point val="33.5,21"/>
+        <dia:point val="49.5,21"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="33.475,20.975;33.525,23.025"/>
+        <dia:rectangle val="49.475,20.975;49.525,23.025"/>
       </dia:attribute>
       <dia:attribute name="conn_endpoints">
-        <dia:point val="33.5,21"/>
-        <dia:point val="33.5,23"/>
+        <dia:point val="49.5,21"/>
+        <dia:point val="49.5,23"/>
       </dia:attribute>
       <dia:attribute name="numcp">
         <dia:int val="1"/>
@@ -745,20 +677,20 @@ backup#</dia:string>
         <dia:real val="0.05000000074505806"/>
       </dia:attribute>
       <dia:connections>
-        <dia:connection handle="0" to="O18" connection="7"/>
+        <dia:connection handle="0" to="O19" connection="7"/>
       </dia:connections>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O23">
+    <dia:object type="Standard - Text" version="1" id="O21">
       <dia:attribute name="obj_pos">
-        <dia:point val="33.5,23.5"/>
+        <dia:point val="49.5,23.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="32.55,23.2688;34.45,23.7312"/>
+        <dia:rectangle val="48.3125,23.2688;50.6875,23.7312"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#0x160000#</dia:string>
+            <dia:string>#0x10000000#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="monospace" style="0" name="Courier"/>
@@ -767,7 +699,7 @@ backup#</dia:string>
             <dia:real val="0.49388886988162994"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="33.5,23.6363"/>
+            <dia:point val="49.5,23.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -781,26 +713,30 @@ backup#</dia:string>
         <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O24">
+    <dia:object type="Standard - Text" version="1" id="O22">
       <dia:attribute name="obj_pos">
-        <dia:point val="36.5,23.5"/>
+        <dia:point val="40,19"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="35.55,23.2688;37.45,23.7312"/>
+        <dia:rectangle val="39.4513,16.9982;40.5674,21.0018"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#0x660000#</dia:string>
+            <dia:string>#
+
+
+
+UBI#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
-            <dia:font family="monospace" style="0" name="Courier"/>
+            <dia:font family="sans" style="0" name="Helvetica"/>
           </dia:attribute>
           <dia:attribute name="height">
-            <dia:real val="0.49388886988162994"/>
+            <dia:real val="0.80000000000000004"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="36.5,23.6363"/>
+            <dia:point val="40,17.6119"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -813,69 +749,21 @@ backup#</dia:string>
       <dia:attribute name="valign">
         <dia:enum val="2"/>
       </dia:attribute>
-    </dia:object>
-    <dia:object type="Standard - Line" version="0" id="O25">
-      <dia:attribute name="obj_pos">
-        <dia:point val="36.5,21"/>
-      </dia:attribute>
-      <dia:attribute name="obj_bb">
-        <dia:rectangle val="36.475,20.975;36.525,23.025"/>
-      </dia:attribute>
-      <dia:attribute name="conn_endpoints">
-        <dia:point val="36.5,21"/>
-        <dia:point val="36.5,23"/>
-      </dia:attribute>
-      <dia:attribute name="numcp">
-        <dia:int val="1"/>
-      </dia:attribute>
-      <dia:attribute name="line_width">
-        <dia:real val="0.05000000074505806"/>
-      </dia:attribute>
       <dia:connections>
-        <dia:connection handle="0" to="O20" connection="7"/>
+        <dia:connection handle="0" to="O19" connection="8"/>
       </dia:connections>
     </dia:object>
-    <dia:object type="Standard - Box" version="0" id="O26">
-      <dia:attribute name="obj_pos">
-        <dia:point val="36.5,17"/>
-      </dia:attribute>
-      <dia:attribute name="obj_bb">
-        <dia:rectangle val="36.45,16.95;40.55,21.05"/>
-      </dia:attribute>
-      <dia:attribute name="elem_corner">
-        <dia:point val="36.5,17"/>
-      </dia:attribute>
-      <dia:attribute name="elem_width">
-        <dia:real val="4"/>
-      </dia:attribute>
-      <dia:attribute name="elem_height">
-        <dia:real val="4"/>
-      </dia:attribute>
-      <dia:attribute name="border_width">
-        <dia:real val="0.10000000149011612"/>
-      </dia:attribute>
-      <dia:attribute name="border_color">
-        <dia:color val="#868686"/>
-      </dia:attribute>
-      <dia:attribute name="inner_color">
-        <dia:color val="#e5e5e5"/>
-      </dia:attribute>
-      <dia:attribute name="show_background">
-        <dia:boolean val="true"/>
-      </dia:attribute>
-    </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O27">
+    <dia:object type="Standard - Text" version="1" id="O23">
       <dia:attribute name="obj_pos">
-        <dia:point val="38.5,19"/>
+        <dia:point val="20,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="36.8088,18.2263;40.1913,19.7737"/>
+        <dia:rectangle val="20,15.905;20,16.6525"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#Root
-Filesystem#</dia:string>
+            <dia:string>##</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="sans" style="0" name="Helvetica"/>
@@ -884,55 +772,31 @@ Filesystem#</dia:string>
             <dia:real val="0.80000000000000004"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="38.5,18.8212"/>
+            <dia:point val="20,16.5"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
           </dia:attribute>
           <dia:attribute name="alignment">
-            <dia:enum val="1"/>
+            <dia:enum val="0"/>
           </dia:attribute>
         </dia:composite>
       </dia:attribute>
       <dia:attribute name="valign">
-        <dia:enum val="2"/>
-      </dia:attribute>
-      <dia:connections>
-        <dia:connection handle="0" to="O26" connection="8"/>
-      </dia:connections>
-    </dia:object>
-    <dia:object type="Standard - Line" version="0" id="O28">
-      <dia:attribute name="obj_pos">
-        <dia:point val="40.5,21"/>
-      </dia:attribute>
-      <dia:attribute name="obj_bb">
-        <dia:rectangle val="40.475,20.975;40.525,23.025"/>
-      </dia:attribute>
-      <dia:attribute name="conn_endpoints">
-        <dia:point val="40.5,21"/>
-        <dia:point val="40.5,23"/>
-      </dia:attribute>
-      <dia:attribute name="numcp">
-        <dia:int val="1"/>
-      </dia:attribute>
-      <dia:attribute name="line_width">
-        <dia:real val="0.05000000074505806"/>
+        <dia:enum val="3"/>
       </dia:attribute>
-      <dia:connections>
-        <dia:connection handle="0" to="O26" connection="7"/>
-      </dia:connections>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O29">
+    <dia:object type="Standard - Text" version="1" id="O24">
       <dia:attribute name="obj_pos">
-        <dia:point val="40.5,23.5"/>
+        <dia:point val="19.5,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="39.55,23.2688;41.45,23.7312"/>
+        <dia:rectangle val="19.025,16.2688;19.975,16.7312"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#0x860000#</dia:string>
+            <dia:string>#256k#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="monospace" style="0" name="Courier"/>
@@ -941,7 +805,7 @@ Filesystem#</dia:string>
             <dia:real val="0.49388886988162994"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="40.5,23.6363"/>
+            <dia:point val="19.5,16.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -955,67 +819,17 @@ Filesystem#</dia:string>
         <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Box" version="0" id="O30">
+    <dia:object type="Standard - Text" version="1" id="O25">
       <dia:attribute name="obj_pos">
-        <dia:point val="40.5,17"/>
-      </dia:attribute>
-      <dia:attribute name="obj_bb">
-        <dia:rectangle val="40.45,16.95;49.55,21.05"/>
-      </dia:attribute>
-      <dia:attribute name="elem_corner">
-        <dia:point val="40.5,17"/>
-      </dia:attribute>
-      <dia:attribute name="elem_width">
-        <dia:real val="9"/>
-      </dia:attribute>
-      <dia:attribute name="elem_height">
-        <dia:real val="4"/>
-      </dia:attribute>
-      <dia:attribute name="border_width">
-        <dia:real val="0.10000000149011612"/>
-      </dia:attribute>
-      <dia:attribute name="border_color">
-        <dia:color val="#868686"/>
-      </dia:attribute>
-      <dia:attribute name="inner_color">
-        <dia:color val="#e5e5e5"/>
-      </dia:attribute>
-      <dia:attribute name="show_background">
-        <dia:boolean val="true"/>
-      </dia:attribute>
-    </dia:object>
-    <dia:object type="Standard - Line" version="0" id="O31">
-      <dia:attribute name="obj_pos">
-        <dia:point val="49.5,21"/>
-      </dia:attribute>
-      <dia:attribute name="obj_bb">
-        <dia:rectangle val="49.475,20.975;49.525,23.025"/>
-      </dia:attribute>
-      <dia:attribute name="conn_endpoints">
-        <dia:point val="49.5,21"/>
-        <dia:point val="49.5,23"/>
-      </dia:attribute>
-      <dia:attribute name="numcp">
-        <dia:int val="1"/>
-      </dia:attribute>
-      <dia:attribute name="line_width">
-        <dia:real val="0.05000000074505806"/>
-      </dia:attribute>
-      <dia:connections>
-        <dia:connection handle="0" to="O30" connection="7"/>
-      </dia:connections>
-    </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O32">
-      <dia:attribute name="obj_pos">
-        <dia:point val="49.5,23.5"/>
+        <dia:point val="26,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="48.3125,23.2688;50.6875,23.7312"/>
+        <dia:rectangle val="25.525,16.2688;26.475,16.7312"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#0x10000000#</dia:string>
+            <dia:string>#256k#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="monospace" style="0" name="Courier"/>
@@ -1024,7 +838,7 @@ Filesystem#</dia:string>
             <dia:real val="0.49388886988162994"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="49.5,23.6363"/>
+            <dia:point val="26,16.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1038,26 +852,26 @@ Filesystem#</dia:string>
         <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O33">
+    <dia:object type="Standard - Text" version="1" id="O26">
       <dia:attribute name="obj_pos">
-        <dia:point val="45,19"/>
+        <dia:point val="29,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="42.4438,18.6262;47.5562,19.3737"/>
+        <dia:rectangle val="28.525,16.2688;29.475,16.7312"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#Data Filesystem#</dia:string>
+            <dia:string>#256k#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
-            <dia:font family="sans" style="0" name="Helvetica"/>
+            <dia:font family="monospace" style="0" name="Courier"/>
           </dia:attribute>
           <dia:attribute name="height">
-            <dia:real val="0.80000000000000004"/>
+            <dia:real val="0.49388886988162994"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="45,19.2212"/>
+            <dia:point val="29,16.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1070,54 +884,51 @@ Filesystem#</dia:string>
       <dia:attribute name="valign">
         <dia:enum val="2"/>
       </dia:attribute>
-      <dia:connections>
-        <dia:connection handle="0" to="O30" connection="8"/>
-      </dia:connections>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O34">
+    <dia:object type="Standard - Text" version="1" id="O27">
       <dia:attribute name="obj_pos">
-        <dia:point val="20,16.5"/>
+        <dia:point val="23,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="20,15.905;20,16.6525"/>
+        <dia:rectangle val="22.525,16.2688;23.475,16.7312"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>##</dia:string>
+            <dia:string>#512k#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
-            <dia:font family="sans" style="0" name="Helvetica"/>
+            <dia:font family="monospace" style="0" name="Courier"/>
           </dia:attribute>
           <dia:attribute name="height">
-            <dia:real val="0.80000000000000004"/>
+            <dia:real val="0.49388886988162994"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="20,16.5"/>
+            <dia:point val="23,16.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
           </dia:attribute>
           <dia:attribute name="alignment">
-            <dia:enum val="0"/>
+            <dia:enum val="1"/>
           </dia:attribute>
         </dia:composite>
       </dia:attribute>
       <dia:attribute name="valign">
-        <dia:enum val="3"/>
+        <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O35">
+    <dia:object type="Standard - Text" version="1" id="O28">
       <dia:attribute name="obj_pos">
-        <dia:point val="19.5,16.5"/>
+        <dia:point val="38.5,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="19.025,16.2514;19.9866,16.7486"/>
+        <dia:rectangle val="37.9062,16.2514;39.1053,16.7486"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#256k#</dia:string>
+            <dia:string>#~127M#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="monospace" style="0" name="Courier"/>
@@ -1126,7 +937,7 @@ Filesystem#</dia:string>
             <dia:real val="0.49388886988162994"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="19.5,16.6305"/>
+            <dia:point val="38.5,16.6305"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1140,59 +951,55 @@ Filesystem#</dia:string>
         <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O36">
+    <dia:object type="Standard - Box" version="0" id="O29">
       <dia:attribute name="obj_pos">
-        <dia:point val="26,16.5"/>
+        <dia:point val="31,17.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="25.5134,16.2514;26.475,16.7486"/>
+        <dia:rectangle val="30.95,17.45;33.05,20.05"/>
       </dia:attribute>
-      <dia:attribute name="text">
-        <dia:composite type="text">
-          <dia:attribute name="string">
-            <dia:string>#256k#</dia:string>
-          </dia:attribute>
-          <dia:attribute name="font">
-            <dia:font family="monospace" style="0" name="Courier"/>
-          </dia:attribute>
-          <dia:attribute name="height">
-            <dia:real val="0.49388886988162994"/>
-          </dia:attribute>
-          <dia:attribute name="pos">
-            <dia:point val="26,16.6305"/>
-          </dia:attribute>
-          <dia:attribute name="color">
-            <dia:color val="#000000"/>
-          </dia:attribute>
-          <dia:attribute name="alignment">
-            <dia:enum val="1"/>
-          </dia:attribute>
-        </dia:composite>
+      <dia:attribute name="elem_corner">
+        <dia:point val="31,17.5"/>
       </dia:attribute>
-      <dia:attribute name="valign">
-        <dia:enum val="2"/>
+      <dia:attribute name="elem_width">
+        <dia:real val="2"/>
+      </dia:attribute>
+      <dia:attribute name="elem_height">
+        <dia:real val="2.5"/>
+      </dia:attribute>
+      <dia:attribute name="border_width">
+        <dia:real val="0.10000000149011612"/>
+      </dia:attribute>
+      <dia:attribute name="border_color">
+        <dia:color val="#6cf39e"/>
+      </dia:attribute>
+      <dia:attribute name="inner_color">
+        <dia:color val="#9deac1"/>
+      </dia:attribute>
+      <dia:attribute name="show_background">
+        <dia:boolean val="true"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O37">
+    <dia:object type="Standard - Text" version="1" id="O30">
       <dia:attribute name="obj_pos">
-        <dia:point val="29,16.5"/>
+        <dia:point val="32,18.75"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="28.5134,16.2514;29.475,16.7486"/>
+        <dia:rectangle val="31.3388,18.3762;32.6613,19.1237"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#256k#</dia:string>
+            <dia:string>#DTB#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
-            <dia:font family="monospace" style="0" name="Courier"/>
+            <dia:font family="sans" style="0" name="Helvetica"/>
           </dia:attribute>
           <dia:attribute name="height">
-            <dia:real val="0.49388886988162994"/>
+            <dia:real val="0.80000000000000004"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="29,16.6305"/>
+            <dia:point val="32,18.9712"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1205,60 +1012,59 @@ Filesystem#</dia:string>
       <dia:attribute name="valign">
         <dia:enum val="2"/>
       </dia:attribute>
+      <dia:connections>
+        <dia:connection handle="0" to="O29" connection="8"/>
+      </dia:connections>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O38">
+    <dia:object type="Standard - Box" version="0" id="O31">
       <dia:attribute name="obj_pos">
-        <dia:point val="23,16.5"/>
+        <dia:point val="33.5,17.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="22.525,16.2514;23.4866,16.7486"/>
+        <dia:rectangle val="33.45,17.45;37.05,20.05"/>
       </dia:attribute>
-      <dia:attribute name="text">
-        <dia:composite type="text">
-          <dia:attribute name="string">
-            <dia:string>#512k#</dia:string>
-          </dia:attribute>
-          <dia:attribute name="font">
-            <dia:font family="monospace" style="0" name="Courier"/>
-          </dia:attribute>
-          <dia:attribute name="height">
-            <dia:real val="0.49388886988162994"/>
-          </dia:attribute>
-          <dia:attribute name="pos">
-            <dia:point val="23,16.6305"/>
-          </dia:attribute>
-          <dia:attribute name="color">
-            <dia:color val="#000000"/>
-          </dia:attribute>
-          <dia:attribute name="alignment">
-            <dia:enum val="1"/>
-          </dia:attribute>
-        </dia:composite>
+      <dia:attribute name="elem_corner">
+        <dia:point val="33.5,17.5"/>
       </dia:attribute>
-      <dia:attribute name="valign">
-        <dia:enum val="2"/>
+      <dia:attribute name="elem_width">
+        <dia:real val="3.5"/>
+      </dia:attribute>
+      <dia:attribute name="elem_height">
+        <dia:real val="2.5"/>
+      </dia:attribute>
+      <dia:attribute name="border_width">
+        <dia:real val="0.10000000149011612"/>
+      </dia:attribute>
+      <dia:attribute name="border_color">
+        <dia:color val="#6cf39e"/>
+      </dia:attribute>
+      <dia:attribute name="inner_color">
+        <dia:color val="#9deac1"/>
+      </dia:attribute>
+      <dia:attribute name="show_background">
+        <dia:boolean val="true"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O39">
+    <dia:object type="Standard - Text" version="1" id="O32">
       <dia:attribute name="obj_pos">
-        <dia:point val="32,16.5"/>
+        <dia:point val="35.25,18.75"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="31.525,16.2514;32.4866,16.7486"/>
+        <dia:rectangle val="34.2437,18.3762;36.2563,19.1237"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#128k#</dia:string>
+            <dia:string>#Kernel#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
-            <dia:font family="monospace" style="0" name="Courier"/>
+            <dia:font family="sans" style="0" name="Helvetica"/>
           </dia:attribute>
           <dia:attribute name="height">
-            <dia:real val="0.49388886988162994"/>
+            <dia:real val="0.80000000000000004"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="32,16.6305"/>
+            <dia:point val="35.25,18.9712"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1271,27 +1077,60 @@ Filesystem#</dia:string>
       <dia:attribute name="valign">
         <dia:enum val="2"/>
       </dia:attribute>
+      <dia:connections>
+        <dia:connection handle="0" to="O31" connection="8"/>
+      </dia:connections>
+    </dia:object>
+    <dia:object type="Standard - Box" version="0" id="O33">
+      <dia:attribute name="obj_pos">
+        <dia:point val="37.5,17.5"/>
+      </dia:attribute>
+      <dia:attribute name="obj_bb">
+        <dia:rectangle val="37.45,17.45;42.05,20.05"/>
+      </dia:attribute>
+      <dia:attribute name="elem_corner">
+        <dia:point val="37.5,17.5"/>
+      </dia:attribute>
+      <dia:attribute name="elem_width">
+        <dia:real val="4.5"/>
+      </dia:attribute>
+      <dia:attribute name="elem_height">
+        <dia:real val="2.5"/>
+      </dia:attribute>
+      <dia:attribute name="border_width">
+        <dia:real val="0.10000000149011612"/>
+      </dia:attribute>
+      <dia:attribute name="border_color">
+        <dia:color val="#6cf39e"/>
+      </dia:attribute>
+      <dia:attribute name="inner_color">
+        <dia:color val="#9deac1"/>
+      </dia:attribute>
+      <dia:attribute name="show_background">
+        <dia:boolean val="true"/>
+      </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O40">
+    <dia:object type="Standard - Text" version="1" id="O34">
       <dia:attribute name="obj_pos">
-        <dia:point val="35,16.5"/>
+        <dia:point val="39.75,18.75"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="34.7625,16.2514;35.2491,16.7486"/>
+        <dia:rectangle val="38.0588,17.9763;41.4413,19.5237"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#5M#</dia:string>
+            <dia:string>#Root
+Filesystem#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
-            <dia:font family="monospace" style="0" name="Courier"/>
+            <dia:font family="sans" style="0" name="Helvetica"/>
           </dia:attribute>
           <dia:attribute name="height">
-            <dia:real val="0.49388886988162994"/>
+            <dia:real val="0.80000000000000004"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="35,16.6305"/>
+            <dia:point val="39.75,18.5712"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1304,27 +1143,60 @@ Filesystem#</dia:string>
       <dia:attribute name="valign">
         <dia:enum val="2"/>
       </dia:attribute>
+      <dia:connections>
+        <dia:connection handle="0" to="O33" connection="8"/>
+      </dia:connections>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O41">
+    <dia:object type="Standard - Box" version="0" id="O35">
       <dia:attribute name="obj_pos">
-        <dia:point val="38.5,16.5"/>
+        <dia:point val="42.5,17.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="38.2625,16.2514;38.7491,16.7486"/>
+        <dia:rectangle val="42.45,17.45;49.05,20.05"/>
+      </dia:attribute>
+      <dia:attribute name="elem_corner">
+        <dia:point val="42.5,17.5"/>
+      </dia:attribute>
+      <dia:attribute name="elem_width">
+        <dia:real val="6.5"/>
+      </dia:attribute>
+      <dia:attribute name="elem_height">
+        <dia:real val="2.5"/>
+      </dia:attribute>
+      <dia:attribute name="border_width">
+        <dia:real val="0.10000000149011612"/>
+      </dia:attribute>
+      <dia:attribute name="border_color">
+        <dia:color val="#6cf39e"/>
+      </dia:attribute>
+      <dia:attribute name="inner_color">
+        <dia:color val="#9deac1"/>
+      </dia:attribute>
+      <dia:attribute name="show_background">
+        <dia:boolean val="true"/>
+      </dia:attribute>
+    </dia:object>
+    <dia:object type="Standard - Text" version="1" id="O36">
+      <dia:attribute name="obj_pos">
+        <dia:point val="45.75,18.75"/>
+      </dia:attribute>
+      <dia:attribute name="obj_bb">
+        <dia:rectangle val="44.0588,17.9763;47.4413,19.5237"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#2M#</dia:string>
+            <dia:string>#DATA
+Filesystem#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
-            <dia:font family="monospace" style="0" name="Courier"/>
+            <dia:font family="sans" style="0" name="Helvetica"/>
           </dia:attribute>
           <dia:attribute name="height">
-            <dia:real val="0.49388886988162994"/>
+            <dia:real val="0.80000000000000004"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="38.5,16.6305"/>
+            <dia:point val="45.75,18.5712"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1337,6 +1209,9 @@ Filesystem#</dia:string>
       <dia:attribute name="valign">
         <dia:enum val="2"/>
       </dia:attribute>
+      <dia:connections>
+        <dia:connection handle="0" to="O35" connection="8"/>
+      </dia:connections>
     </dia:object>
   </dia:layer>
 </dia:diagram>
diff --git a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index 961f534..f6b0fdd 100644
--- a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
+++ b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
@@ -1,4 +1,4 @@
-\subchapter{Filesystems - Flash file systems}{Objective: Understand flash file systems usage and their integration on the target}
+\subchapter{Storage - Flash devices}{Objective: Understand flash and flash file systems usage and their integration on the target}
 
 After this lab, you will be able to:
 \begin{itemize}
@@ -9,18 +9,25 @@ After this lab, you will be able to:
 \section{Setup}
 
 Stay in \code{$HOME/embedded-linux-labs/tinysystem}. Install the
-\code{mtd-utils} package, which will be useful to create JFFS2
-filesystem images.
+\code{mtd-utils} package, which will be useful to create UBIFS and
+UBI images.
 
 \section{Goals}
 
 Instead of using an external MMC card as in the previous lab, we will
 make our system use its internal flash storage.
 
-The root filesystem will still be in a read-only filesystem, put on an
-MTD partition.  Read/write data will be stored in a JFFS2 filesystem
-in another MTD partition. The layout of the internal NAND flash will
-be:
+Create an MTD partition to be attached to the UBI layer (the partitions
+previously used to store the kernel image and the DTB should be merged
+with this UBI partition).
+Kernel and DTB images will should be stored in two separate static
+(read-only) UBI volumes.
+The root filesystem will be a UBIFS volume (still mounted in a read-only).
+Read/write data will be stored in a UBIFS file system too.
+As for the kernel and DTB images, the root and data filesystems will be
+placed in a UBI volumes (this time we will use dynamic volumes).
+
+Which gives the following layout:
 
 \begin{center}
   \includegraphics[width=\textwidth]{labs/sysdev-flash-filesystems/flash-map.pdf}
@@ -28,35 +35,95 @@ be:
 
 \section{Enabling NAND flash and filesystems}
 
-First, recompile your kernel with support for JFFS2 and for support
-for MTD partitions specified in the kernel command line
+First, recompile your kernel with support for UBI and UBIFS, and enable
+the option allowing us to pass the partition table through the cmdline:
 (\code{CONFIG_MTD_CMDLINE_PARTS}).
 
-Last but not least, disable \code{CONFIG_PROVE_LOCKING}. This option
-is currently causing problems with the JFFS2 filesystem. This option
-is in \code{Kernel Hacking} $\rightarrow$ \code{Lock debugging: prove
-  locking correctness}.
-
 Recompile your kernel, and we will update your kernel image on flash
 in the next section.
 
 \section{Filesystem image preparation}
 
-Find the erase block size of the NAND flash device in your board.
+Find the erase block size of the NAND flash device soldered on your
+board.
 
-Prepare a JFFS2 filesystem image from the \code{/www/upload/files}
+Prepare a UBIFS filesystem image from the \code{/www/upload/files}
 directory from the previous lab.
 
 Now, we will get back to the root filesystem contents in the
-\code{nfsroot} directory, and will generate a JFFS2 image from them.
+\code{nfsroot} directory, and will generate a UBIFS image from them.
+
+First enable the ubi tools in busybox (\code{ubiattach},
+\code{ubidetach}, \code{ubimkvol}, ...), then recompile and reinstall
+\code{busybox} in you rootfs directory.
+
+Now, modify the \code{/etc/init.d/rcS} file to mount a UBIFS filesystem
+on the \code{data} volume (we will declare UBI volumes in the next
+section), instead of an ext3 filesystem on the third MMC disk partition.
+
+Once done, create a UBIFS image for your root filesystem, with the same
+options as for the data filesystem.
 
-In this directory, modify the \code{/etc/init.d/rcS} file to
-mount a JFFS2 filesystem on the eighth flash partition
-(we will declare flash partitions in the next section),
-instead of an ext3 filesystem on the third MMC disk partition.
+\section{UBI image preparation}
 
-Create a JFFS2 image for your root filesystem, with the same options
-as for the data filesystem.
+Create a ubinize config file where you will define the 4 volumes
+described above, then use the \code{ubinize} tool to generate your
+UBI image.
+Warning: do not use the autoresize flag (\code{vol_flags=autoresize})
+(U-Boot corrupts the UBI metadata when trying to resize expand the
+volume).
+
+Remember that some of these volumes are static (read-only) and some are
+not.
+
+%Creating UBIFS images:
+%
+%mkfs.ubifs -d <rootfs-directory-path> -o <rootfs-image-path> -e 124KiB -m 2048 -c 1024
+%mkfs.ubifs -d <data-directory-path> -o <data-image-path> -e 124KiB -m 2048 -c 1024
+%
+
+%
+% ubi config file content
+%
+%[kernel]
+%mode=ubi
+%image=<zImage-path>
+%vol_id=1
+%vol_type=static
+%vol_name=kernel
+%vol_alignment=1
+%
+%[dtb]
+%mode=ubi
+%image=<dtb-path>
+%vol_id=2
+%vol_type=static
+%vol_name=dtb
+%vol_alignment=1
+%
+%[root]
+%mode=ubi
+%image=<rootfs-image-path>
+%vol_id=3
+%vol_type=dynamic
+%vol_size=10MiB
+%vol_name=root
+%vol_alignment=1
+%
+%[data]
+%mode=ubi
+%image=<data-image-path>
+%vol_id=4
+%vol_type=dynamic
+%vol_name=data
+%vol_alignment=1
+%
+
+%
+% Creating UBI images:
+%
+% # ubinize -o test.ubi -p 128KiB -m 2048 ubi.ini 
+%
 
 \section{MTD partitioning and flashing}
 
@@ -68,26 +135,20 @@ However, they do not match the way we wish to organize our flash
 storage. Therefore, we will define our own partitions at boot time,
 on the kernel command line.
 
-Enter the U-Boot shell and erase NAND flash, from offset \code{0x160000},
-up to the end of the NAND flash storage. You'll have to compute the
-remaining size of the flash, from \code{0x160000} to the end. Remember
-that you can look at U-Boot booting messages to find what the size of
-the NAND flash is.
-
-The DTB (device tree blob) has been already written in the NAND flash
-and it didn't change so we keep it.
+Redefine the partition in U-Boot using the \code{mtdids} and
+\code{mtdparts} environment variables.
+Once done, execute the \code{mtdparts} command and check the partition
+definitions.
 
-Using the \code{tftp} command, download and flash the new kernel
-image at the correct location.
+You can now safely erase the UBI partition without risking any
+corruption on other partitions.
 
-Using the \code{tftp} command, download and flash the JFFS2 image
-of the root filesystem the correct location.
+Download the UBI image (using \code{tftp}) you have created in the
+previous section and flash it on the UBI partition.
 
-Using the \code{tftp} command, download and flash the JFFS2 image of
-the data filesystem at the correction location.
-
-Use the \code{trimffs} version of the command \code{nand write} for
-the JFFS2 image. \footnote{The command \code{nand write.trimffs} skips
+When flashing the UBI image, use the \code{trimffs} version of the
+command \code{nand write}.
+\footnote{The command \code{nand write.trimffs} skips
   the blank sectors instead of writing them. It is needed because the
   algorithm used by the hardware ECC for the SAMA5D3 SoC generates a
   checksum with bytes different of 0xFF if the page is blank. Linux
@@ -96,13 +157,26 @@ the JFFS2 image. \footnote{The command \code{nand write.trimffs} skips
   not recommended writing more than one time on a page and its OOB
   even if the page is blank.}
 
+\section{loading kernel and DTB images from UBI and booting it}
+
+Attach the UBI partition to the UBI layer and verify that all the
+UBI volumes are present.
+
+Now, retrieve the kernel and DTB images from their respective UBI
+volumes and try to boot them. If it works, you can modify your
+\code{bootcmd} accordingly.
+
+
 Don't forget that you can write U-Boot scripts to automate these
 procedures. This is very handy to avoid mistakes when typing commands!
 
 Set the \code{bootargs} variable so that:
 
 \begin{itemize}
-\item You define the 8 MTD partitions, as detailed previously
+\item The \code{mtdparts} environment variable content is passed to
+  the kernel through cmdline
+\item The UBI partition is automatically attached to the UBI layer at
+  boot time
 \item The root filesystem is mounted from the 7\textsuperscript{th}
   partition, and is mounted read-only (kernel parameter
   \code{ro}).
@@ -114,7 +188,81 @@ Set the \code{bootargs} variable so that:
   \end{itemize}
 \end{itemize}
 
-Boot the target, check that MTD partitions are well configured, and
-that your system still works as expected. Your root filesystem should
-be mounted read-only, while the data filesystem should be mounted
-read-write, allowing you to upload data using the web server.
+Boot the target, check that MTD partitions and UBI volumes are correctly
+configured, and that your system still works as expected. Your root
+filesystem should be mounted read-only, while the data filesystem should
+be mounted read-write, allowing you to upload data using the web server.
+
+%Useful u-boot environment variables
+%mtdids=nand0=atmel_nand
+%mtdparts=mtdparts=atmel_nand:256k(bootstrap),512k(u-boot),256k(u-boot-env1),256k(u-boot-env2),-(UBI)
+%bootargs_base=console=ttyS0,115200 rootfstype=ubifs root=ubi0:root ip=dhcp ubi.mtd=4 rw
+%bootcmd=mtdparts; ubi part UBI; ubi readvol 0x21000000 kernel; ubi readvol 0x22000000 dtb; setenv bootargs $bootargs_base $mtdparts; bootz 0x21000000 - 0x22000000
+%flash=mtdparts; nand erase.part UBI; tftp 0x21000000 test.ubi; nand write.trimffs 0x21000000 UBI $filesize
+
+\section{Resizing an existing volume and creating a new one}
+
+In some cases you might want to adpat your NAND partitioning without
+re-flashing everything. Thanks to UBI this is possible.
+
+Resize the \code{data} volume to occupy the remaining 50MiB.
+
+Create a new \code{log} volume of 16MiB
+Mount this volume as a UBIFS filesystem and see what happens.
+
+Update your init script to mount the UBI \code{log} volume on /var/log.
+Reboot your system and check that the \code{log} is correcly mounted.
+
+% Hints:
+%
+%ubirsvol /dev/ubi0 -n 4 -s 50MiB
+%ubimkvol /dev/ubi0 -N log -s 16MiB
+%mount -t ubifs ubi0:log /var/log
+%
+
+
+\section{Going further}
+
+UBI also provide and atomic update feature, which is particularly useful
+if you need to safely upgrade sensitive parts your system (kernel, DTB or
+rootfs).
+
+Duplicate the kernel volume and create a U-Boot script to fallback on
+the second kernel volume if the first one is corrupted:
+\begin{itemize}
+  \item First create a new static volume to store your kernel backup
+  \item Flash a valid kernel on the backup volume
+  \item Modify your bootcmd to fallback to the backup volume if the first one
+    is corrupted
+  \item Now try to update the kernel volume and interrupt the process before
+    it has finished and see what happens (unplug the platform)
+  \item Create a shell script to automate kernel updates (executed in Linux).
+    Be careful, this script should also handle the case where the backup
+    volume has been corrupted (copy the content of the kernel volume into
+    the backup one)
+\end{itemize}
+
+%TODO: provide a correction
+
+\section{Going even further}
+
+Root filesystems are often a sensitive part of your system, and you don't
+want it to be corrupted, hence some people decide to use read-only
+file system for their rootfs and use another file system to store their
+auxiliary data.
+
+\code{squashfs} is one of these read-only file systems, the problem is:
+it expects to be mounted on a block device.
+
+Use the ubiblk layer to emulate a read-only block device on top of a static
+UBI volume to mount a rootfs squashfs filesystem:
+\begin{itemize}
+  \item First Create a squashfs image with your rootfs content
+  \item Then create a new static volume to store your squashfs and update it with
+    your squashfs image
+  \item Enable and setup the ubiblk layer
+  \item Boot on your new rootfs
+\end{itemize}
+
+%TODO: provide a correction
+



More information about the training-materials-updates mailing list