summaryrefslogtreecommitdiff
path: root/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex
blob: 5de794f785b1878926d5395ba829ee076226ff59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
\def\lximg{/usr/share/lx/icons/fueller.png}

\input{configpres}

\subsection{Creating Flashfilesystems}

\title{Creating Flashfilesystems}
\maketitle

\def\lximg{none}

\begin{frame}
\frametitle{Contents}
\tableofcontents
\end{frame}

\subsubsection{Emulation}
\begin{frame}[fragile]
\frametitle{Emulating flash devices}
\begin{lstlisting}
$ sudo modprobe nandsim
$ cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 08000000 00004000 "NAND simulator partition 0"
$ dmesg
[...]
[  128.718421] flash size: 128 MiB
[  128.718423] page size: 512 bytes
[  128.718425] OOB area size: 16 bytes
[  128.718426] sector size: 16 KiB
[...]
\end{lstlisting}
\end{frame}

\subsubsection{JFFS2}
\begin{frame}[fragile]
\frametitle{MTD Flash partitioning}
\begin{itemize}
\item Redboot partition parsing
\item Boardsupport
\item Kernelparameters:
\begin{verbatim}
mtdparts=edb7312-nor:256k(ARMboot)ro,
-(root);edb7312-nand:-(home)
\end{verbatim}
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{JFFS2}
\begin{figure}[h]
\centering
\includegraphics[width=8cm]{images/jffs2.png}
\end{figure}
\end{frame}

\begin{frame}[fragile]
\frametitle{Using JFFS2}
\begin{lstlisting}
# Create JFFS2 image
$ mkfs.jffs2 -e 131072 \
    -d source_directory \
    -o jffs2.img
# Erase flash partition
$ flash_erase -j /dev/mtd0 0 0
# Write jffs2 image
$ nandwrite /dev/mtd0 jffs2.img
# Mounting the image
$ mount /dev/mtdblock0 /mnt
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]
Kernelparameters:
\begin{verbatim}
root=/dev/mtdblock0 rootfstype=jffs2
\end{verbatim}
\end{frame}

\subsubsection{UBI and UBIFS}
\begin{frame}
\frametitle{UBI: Unsorted Block Images}
\begin{figure}[h]
\centering
\includegraphics[width=8cm]{images/ubi.png}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{UBIFS}
\begin{figure}[h]
\centering
\includegraphics[width=8cm]{images/ubifs.png}
\end{figure}
\end{frame}

\begin{frame}[fragile]
\frametitle{Using UBIFS}
\begin{lstlisting}
# 1) Attaching UBI to an MTD device
modprobe ubi
ubiattach ubiattach -m 0
# or
modprobe ubi mtd=0
# 2) Gathering some information
$ dmesg
UBI: attaching mtd0 to ubi0
UBI: physical eraseblock size:   16384 bytes (16 KiB)
UBI: logical eraseblock size:    15872 bytes
UBI: smallest flash I/O unit:    512
UBI: sub-page size:              256
UBI: VID header offset:          256 (aligned 256)
UBI: data offset:                512
[...]
# 3) Creating a volume
$ ubimkvol /dev/ubi0 -N myvolume -s 64MiB
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]
\frametitle{Using UBIFS}
\begin{lstlisting}
# 4) Creating an UBIFS image
$ mkfs.ubifs -r test -m 512 -e 15872 \
   -c 8450 -o ubifs.img
# 5) Writing the image
$ ubiupdatevol /dev/ubi0_0 ubifs.img
# 6) Mounting UBIFS
$ mount -t ubifs ubi0:myvolume /mnt/
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]
\frametitle{UBI: Create flash images}
ubinize.cfg:
\begin{verbatim}
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=64MiB
vol_type=dynamic
vol_name=myvolume
vol_flags=autoresize
\end{verbatim}
\end{frame}

\begin{frame}[fragile]
\frametitle{UBI: Create flash images}
\begin{lstlisting}
# 1) Create the ubi image
ubinize -o ubi.img -m 512 -s 256 -p 16384 ubinize.cfg
# 2) erase the flash partition
flash_erase /dev/mtd0 0 0
# 3) Write the image
nandwrite /dev/mtd0 ubi.img
# 4) Attach UBI
ubiattach -m 0
# 5) Mount UBIFS
mount -t ubifs ubi0:myvolume /mnt/
\end{lstlisting}
\end{frame}

\begin{frame}[fragile]
\frametitle{UBIFS as a rootfilesystem}
Kernelparameters:
\begin{verbatim}
ubi.mtd=0 root=ubi0:myvolume rootfstype=ubifs
\end{verbatim}
\end{frame}

\begin{frame}
\begin{thebibliography}{1}
\bibitem{UBIFS} http://mytechrants.wordpress.com/2010/01/20/ubiubifs-on-nandsim/
\end{thebibliography} 
\end{frame}

\input{tailpres}