[FE training-materials-updates] Flash filesystems labs rework

Boris Brezillon boris.brezillon at free-electrons.com
Wed May 27 09:38:12 CEST 2015


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

On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=0924675dd5a92c277f5b606a6adeff7e3c6d5b1d

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

commit 0924675dd5a92c277f5b606a6adeff7e3c6d5b1d
Author: Boris Brezillon <boris.brezillon at free-electrons.com>
Date:   Wed May 27 09:34:13 2015 +0200

    Flash filesystems labs rework
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>


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

0924675dd5a92c277f5b606a6adeff7e3c6d5b1d
 labs/sysdev-flash-filesystems/flash-map.dia        | 550 +++++++++++----------
 .../sysdev-flash-filesystems.tex                   | 258 +++++++---
 2 files changed, 491 insertions(+), 317 deletions(-)

diff --git a/labs/sysdev-flash-filesystems/flash-map.dia b/labs/sysdev-flash-filesystems/flash-map.dia
index 4c0c06a..9a785c3 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,26 +659,47 @@ backup#</dia:string>
         <dia:boolean val="true"/>
       </dia:attribute>
     </dia:object>
+    <dia:object type="Standard - Line" version="0" id="O20">
+      <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="O19" connection="7"/>
+      </dia:connections>
+    </dia:object>
     <dia:object type="Standard - Text" version="1" id="O21">
       <dia:attribute name="obj_pos">
-        <dia:point val="35,19"/>
+        <dia:point val="49.5,23.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="33.9937,18.6262;36.0063,19.3737"/>
+        <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>#Kernel#</dia:string>
+            <dia:string>#0x10000000#</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="35,19.2212"/>
+            <dia:point val="49.5,23.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -723,75 +712,91 @@ backup#</dia:string>
       <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:object type="Standard - Text" version="1" id="O22">
       <dia:attribute name="obj_pos">
-        <dia:point val="33.5,21"/>
+        <dia:point val="40,19"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="33.475,20.975;33.525,23.025"/>
-      </dia:attribute>
-      <dia:attribute name="conn_endpoints">
-        <dia:point val="33.5,21"/>
-        <dia:point val="33.5,23"/>
+        <dia:rectangle val="39.4513,17.0262;40.5487,20.9737"/>
       </dia:attribute>
-      <dia:attribute name="numcp">
-        <dia:int val="1"/>
+      <dia:attribute name="text">
+        <dia:composite type="text">
+          <dia:attribute name="string">
+            <dia:string>#
+
+
+
+UBI#</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="40,17.6212"/>
+          </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="line_width">
-        <dia:real val="0.05000000074505806"/>
+      <dia:attribute name="valign">
+        <dia:enum val="2"/>
       </dia:attribute>
       <dia:connections>
-        <dia:connection handle="0" to="O18" connection="7"/>
+        <dia:connection handle="0" to="O19" connection="8"/>
       </dia:connections>
     </dia:object>
     <dia:object type="Standard - Text" version="1" id="O23">
       <dia:attribute name="obj_pos">
-        <dia:point val="33.5,23.5"/>
+        <dia:point val="20,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="32.55,23.2688;34.45,23.7312"/>
+        <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>#0x160000#</dia:string>
+            <dia:string>##</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="33.5,23.6363"/>
+            <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:enum val="3"/>
       </dia:attribute>
     </dia:object>
     <dia:object type="Standard - Text" version="1" id="O24">
       <dia:attribute name="obj_pos">
-        <dia:point val="36.5,23.5"/>
+        <dia:point val="19.5,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="35.55,23.2688;37.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>#0x660000#</dia:string>
+            <dia:string>#256k#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="monospace" style="0" name="Courier"/>
@@ -800,7 +805,7 @@ backup#</dia:string>
             <dia:real val="0.49388886988162994"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="36.5,23.6363"/>
+            <dia:point val="19.5,16.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -814,77 +819,92 @@ backup#</dia:string>
         <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Line" version="0" id="O25">
+    <dia:object type="Standard - Text" version="1" id="O25">
       <dia:attribute name="obj_pos">
-        <dia:point val="36.5,21"/>
+        <dia:point val="26,16.5"/>
       </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:rectangle val="25.525,16.2688;26.475,16.7312"/>
       </dia:attribute>
-      <dia:attribute name="numcp">
-        <dia:int val="1"/>
+      <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.6363"/>
+          </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="line_width">
-        <dia:real val="0.05000000074505806"/>
+      <dia:attribute name="valign">
+        <dia:enum val="2"/>
       </dia:attribute>
-      <dia:connections>
-        <dia:connection handle="0" to="O20" connection="7"/>
-      </dia:connections>
     </dia:object>
-    <dia:object type="Standard - Box" version="0" id="O26">
+    <dia:object type="Standard - Text" version="1" id="O26">
       <dia:attribute name="obj_pos">
-        <dia:point val="36.5,17"/>
+        <dia:point val="29,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="36.45,16.95;40.55,21.05"/>
+        <dia:rectangle val="28.525,16.2688;29.475,16.7312"/>
       </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 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="29,16.6363"/>
+          </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="show_background">
-        <dia:boolean val="true"/>
+      <dia:attribute name="valign">
+        <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
     <dia:object type="Standard - Text" version="1" id="O27">
       <dia:attribute name="obj_pos">
-        <dia:point val="38.5,19"/>
+        <dia:point val="23,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="36.8088,18.2263;40.1913,19.7737"/>
+        <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>#Root
-Filesystem#</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="38.5,18.8212"/>
+            <dia:point val="23,16.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -897,42 +917,18 @@ Filesystem#</dia:string>
       <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: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="O28">
       <dia:attribute name="obj_pos">
-        <dia:point val="40.5,23.5"/>
+        <dia:point val="38.5,16.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="39.55,23.2688;41.45,23.7312"/>
+        <dia:rectangle val="37.9062,16.2688;39.0938,16.7312"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#0x860000#</dia:string>
+            <dia:string>#~127M#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="monospace" style="0" name="Courier"/>
@@ -941,7 +937,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="38.5,16.6363"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -955,76 +951,55 @@ Filesystem#</dia:string>
         <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Box" version="0" id="O30">
+    <dia:object type="Standard - Box" version="0" id="O29">
       <dia:attribute name="obj_pos">
-        <dia:point val="40.5,17"/>
+        <dia:point val="31,17.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="40.45,16.95;49.55,21.05"/>
+        <dia:rectangle val="30.95,17.45;33.05,20.05"/>
       </dia:attribute>
       <dia:attribute name="elem_corner">
-        <dia:point val="40.5,17"/>
+        <dia:point val="31,17.5"/>
       </dia:attribute>
       <dia:attribute name="elem_width">
-        <dia:real val="9"/>
+        <dia:real val="2"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
-        <dia:real val="4"/>
+        <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="#868686"/>
+        <dia:color val="#6cf39e"/>
       </dia:attribute>
       <dia:attribute name="inner_color">
-        <dia:color val="#e5e5e5"/>
+        <dia:color val="#9deac1"/>
       </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:object type="Standard - Text" version="1" id="O30">
       <dia:attribute name="obj_pos">
-        <dia:point val="49.5,23.5"/>
+        <dia:point val="32,18.4"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="48.3125,23.2688;50.6875,23.7312"/>
+        <dia:rectangle val="31.3388,18.0263;32.6613,18.7738"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#0x10000000#</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="49.5,23.6363"/>
+            <dia:point val="32,18.6213"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1038,17 +1013,46 @@ Filesystem#</dia:string>
         <dia:enum val="2"/>
       </dia:attribute>
     </dia:object>
-    <dia:object type="Standard - Text" version="1" id="O33">
+    <dia:object type="Standard - Box" version="0" id="O31">
+      <dia:attribute name="obj_pos">
+        <dia:point val="33.5,17.5"/>
+      </dia:attribute>
+      <dia:attribute name="obj_bb">
+        <dia:rectangle val="33.45,17.45;37.05,20.05"/>
+      </dia:attribute>
+      <dia:attribute name="elem_corner">
+        <dia:point val="33.5,17.5"/>
+      </dia:attribute>
+      <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="O32">
       <dia:attribute name="obj_pos">
-        <dia:point val="45,19"/>
+        <dia:point val="35.2,18.4"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="42.4438,18.6262;47.5562,19.3737"/>
+        <dia:rectangle val="34.1938,18.0263;36.2063,18.7738"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#Data Filesystem#</dia:string>
+            <dia:string>#Kernel#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="sans" style="0" name="Helvetica"/>
@@ -1057,7 +1061,7 @@ Filesystem#</dia:string>
             <dia:real val="0.80000000000000004"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="45,19.2212"/>
+            <dia:point val="35.2,18.6213"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1070,21 +1074,48 @@ 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 - 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="O34">
       <dia:attribute name="obj_pos">
-        <dia:point val="20,16.5"/>
+        <dia:point val="39.8,18.4"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="20,15.905;20,16.6525"/>
+        <dia:rectangle val="38.1088,17.6263;41.4913,19.1738"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>##</dia:string>
+            <dia:string>#Root
+Filesystem#</dia:string>
           </dia:attribute>
           <dia:attribute name="font">
             <dia:font family="sans" style="0" name="Helvetica"/>
@@ -1093,73 +1124,70 @@ Filesystem#</dia:string>
             <dia:real val="0.80000000000000004"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="20,16.5"/>
+            <dia:point val="39.8,18.2213"/>
           </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 - Box" version="0" id="O35">
       <dia:attribute name="obj_pos">
-        <dia:point val="19.5,16.5"/>
+        <dia:point val="42.5,17.5"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="19.025,16.2514;19.9866,16.7486"/>
+        <dia:rectangle val="42.45,17.45;49.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="19.5,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="42.5,17.5"/>
       </dia:attribute>
-      <dia:attribute name="valign">
-        <dia:enum val="2"/>
+      <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="26,16.5"/>
+        <dia:point val="45.8,18.4"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="25.5134,16.2514;26.475,16.7486"/>
+        <dia:rectangle val="44.1088,17.6263;47.4913,19.1738"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#256k#</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="26,16.6305"/>
+            <dia:point val="45.8,18.2213"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1175,24 +1203,24 @@ Filesystem#</dia:string>
     </dia:object>
     <dia:object type="Standard - Text" version="1" id="O37">
       <dia:attribute name="obj_pos">
-        <dia:point val="29,16.5"/>
+        <dia:point val="32,19.6"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="28.5134,16.2514;29.475,16.7486"/>
+        <dia:rectangle val="31.42,19.3525;32.58,19.8475"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#256k#</dia:string>
+            <dia:string>#static#</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.52916664630174637"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="29,16.6305"/>
+            <dia:point val="32,19.7475"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1208,24 +1236,24 @@ Filesystem#</dia:string>
     </dia:object>
     <dia:object type="Standard - Text" version="1" id="O38">
       <dia:attribute name="obj_pos">
-        <dia:point val="23,16.5"/>
+        <dia:point val="35.2,19.6"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="22.525,16.2514;23.4866,16.7486"/>
+        <dia:rectangle val="34.62,19.3525;35.78,19.8475"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#512k#</dia:string>
+            <dia:string>#static#</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.52916664630174637"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="23,16.6305"/>
+            <dia:point val="35.2,19.7475"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1241,24 +1269,24 @@ Filesystem#</dia:string>
     </dia:object>
     <dia:object type="Standard - Text" version="1" id="O39">
       <dia:attribute name="obj_pos">
-        <dia:point val="32,16.5"/>
+        <dia:point val="39.7,19.6"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="31.525,16.2514;32.4866,16.7486"/>
+        <dia:rectangle val="38.7963,19.3525;40.6037,19.8475"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#128k#</dia:string>
+            <dia:string>#dynamic#</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.52916664630174637"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="32,16.6305"/>
+            <dia:point val="39.7,19.7475"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1274,24 +1302,24 @@ Filesystem#</dia:string>
     </dia:object>
     <dia:object type="Standard - Text" version="1" id="O40">
       <dia:attribute name="obj_pos">
-        <dia:point val="35,16.5"/>
+        <dia:point val="34.6,27.8"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="34.7625,16.2514;35.2491,16.7486"/>
+        <dia:rectangle val="33.6962,27.5525;35.5037,28.0475"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#5M#</dia:string>
+            <dia:string>#dynamic#</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.52916664630174637"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="35,16.6305"/>
+            <dia:point val="34.6,27.9475"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
@@ -1307,24 +1335,24 @@ Filesystem#</dia:string>
     </dia:object>
     <dia:object type="Standard - Text" version="1" id="O41">
       <dia:attribute name="obj_pos">
-        <dia:point val="38.5,16.5"/>
+        <dia:point val="45.7,19.6"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="38.2625,16.2514;38.7491,16.7486"/>
+        <dia:rectangle val="44.7839,19.3339;46.6037,19.8661"/>
       </dia:attribute>
       <dia:attribute name="text">
         <dia:composite type="text">
           <dia:attribute name="string">
-            <dia:string>#2M#</dia:string>
+            <dia:string>#dynamic#</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.52916664630174637"/>
           </dia:attribute>
           <dia:attribute name="pos">
-            <dia:point val="38.5,16.6305"/>
+            <dia:point val="45.7,19.7413"/>
           </dia:attribute>
           <dia:attribute name="color">
             <dia:color val="#000000"/>
diff --git a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index 961f534..cd00767 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{Filesystems - Flash file systems}{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,27 @@ 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).
+
+The kernel and DTB images will be stored in two separate {\em static}
+(read-only) UBI volumes.
+
+The root filesystem will be a UBI volume storing a UBIFS filesystem
+mounted read-only, the web server upload data will be stored in
+another UBI volume storing a UBIFS filesystem mounted
+read/write. These volumes will be {\em dynamic} volumes.
+
+Which gives the following layout:
 
 \begin{center}
   \includegraphics[width=\textwidth]{labs/sysdev-flash-filesystems/flash-map.pdf}
@@ -28,66 +37,116 @@ 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.
+
+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.
+
+\section{UBI image preparation}
+
+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 expand the volume.
 
-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.
+Remember that some of these volumes are static (read-only) and some are
+not.
 
-Create a JFFS2 image for your root filesystem, with the same options
-as for the data filesystem.
+%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}
 
-Look at the way default flash partitions are defined in the board
-Device Tree sources
-(\code{arch/arm/boot/dts/at91-sama5d3_xplained.dts}).
+Look at the way the default flash partitions are defined in the board
+Device Tree source (\code{arch/arm/boot/dts/at91-sama5d3_xplained.dts}
+in your kernel tree).
 
 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,25 +155,112 @@ 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.}
 
-Don't forget that you can write U-Boot scripts to automate these
-procedures. This is very handy to avoid mistakes when typing commands!
+\section{Loading kernel and DTB images from UBI and booting it}
+
+From Linux (still booting from the external MMC), attach the UBI
+partition to the UBI layer and verify that all the UBI volumes are
+present.
+
+Now back in U-Boot, 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.
 
 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
+\footnote{Remember you can tweak your bootargs using u-boot env
+  variables before booting the kernel. To achieve that, create a
+  \code{bootargs_base} variable where you will store all the kernel
+  parameters except the mtdparts one. Then modify your \code{bootcmd}
+  to append the \code{mtdparts} definition to \code{bootargs_base}
+  before calling \code{bootz}:
+  \code{setenv bootargs $bootargs_base $mtdparts}}
+\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}).
-  \begin{itemize}
-  \item \bf{Important: even if this partition is mounted read-only,
-      the MTD partition itself must be declared as read-write.
-      Otherwise, Linux won't be able to perform ECC checks on it,
-      which involve both reading and writing.}
-  \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 the 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 ro
+%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{Going further}
+
+\subsection{Resizing an existing volume and creating a new one}
+
+In some cases you might need to adapt your NAND partitioning without
+re-flashing everything. Thanks to UBI this is possible.
+
+From Linux, resize the \code{data} volume to occupy the remaining
+50MiB, and then 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 \code{/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
+%
+
+\subsection{Atomic update}
+
+UBI also provides an atomic update feature, which is particularly useful
+if you need to safely upgrade sensitive parts of 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 \code{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
+
+\subsection{Using {\em squashfs} for the root filesystem}
+
+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. However,
+\code{squashfs} expects to be mounted on a block device.
+
+Use the {\em ubiblk} layer to emulate a read-only block device on top
+of a static UBI volume to mount a {\em squashfs} filesystem as the
+root filesystem:
+
+\begin{itemize}
+  \item First create a {\em 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 {\em ubiblk} layer
+  \item Boot on your new rootfs
+\end{itemize}
+
+%TODO: provide a correction



More information about the training-materials-updates mailing list