diff options
| author | Holger Dengler <dengler@linutronix.de> | 2012-10-09 15:04:27 +0200 |
|---|---|---|
| committer | Holger Dengler <dengler@linutronix.de> | 2012-10-15 11:54:06 +0200 |
| commit | 17cbf45947697dd6323764fe10615851cb01234e (patch) | |
| tree | 6d803a4abf345c5b4aa78d353a2861a1cfba0d4a | |
| parent | 664ec7412576bc7e756c407574e1a1f73f3d3c95 (diff) | |
Flash-Memory: Update Flash-Filesystem Presentation
Update the exercises in the presentation and separate the cleanup
sections.
Signed-off-by: Holger Dengler <dengler@linutronix.de>
| -rw-r--r-- | flash-memory/flash-filesystems/pres_flashfilesystems_en.tex | 83 |
1 files changed, 55 insertions, 28 deletions
diff --git a/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex b/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex index 5de794f..718965d 100644 --- a/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex +++ b/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex @@ -17,6 +17,7 @@ \subsubsection{Emulation} \begin{frame}[fragile] \frametitle{Emulating flash devices} +Exercise: \begin{lstlisting} $ sudo modprobe nandsim $ cat /proc/mtd @@ -56,17 +57,26 @@ mtdparts=edb7312-nor:256k(ARMboot)ro, \begin{frame}[fragile] \frametitle{Using JFFS2} +Exercise: \begin{lstlisting} # Create JFFS2 image -$ mkfs.jffs2 -e 131072 \ - -d source_directory \ - -o jffs2.img +$ /usr/sbin/mkfs.jffs2 -e 131072 \ + -d source_directory \ + -o jffs2.img # Erase flash partition -$ flash_erase -j /dev/mtd0 0 0 +$ sudo flash_erase -j /dev/mtd0 0 0 # Write jffs2 image -$ nandwrite /dev/mtd0 jffs2.img +$ sudo nandwrite -p /dev/mtd0 jffs2.img +# Load mtdblock module +$ sudo modprobe mtdblock # Mounting the image -$ mount /dev/mtdblock0 /mnt +$ sudo mount -t jffs2 /dev/mtdblock0 /mnt +\end{lstlisting} +Clean-up: +\begin{lstlisting} +# Unmount the image and erase flash partition +$ sudo umount /mnt +$ sudo flash_erase -j /dev/mtd0 0 0 \end{lstlisting} \end{frame} @@ -96,13 +106,14 @@ root=/dev/mtdblock0 rootfstype=jffs2 \begin{frame}[fragile] \frametitle{Using UBIFS} +Exercise: \begin{lstlisting} -# 1) Attaching UBI to an MTD device -modprobe ubi -ubiattach ubiattach -m 0 -# or -modprobe ubi mtd=0 -# 2) Gathering some information +# 1) Loading module and attach UBI to MTD device +$ sudo modprobe ubi +$ sudo ubiattach ubiattach -m 0 +# or: 1a) Specify the MTD device during module load +$ sudo modprobe ubi mtd=0 +# 2) Gathering some information: $ dmesg UBI: attaching mtd0 to ubi0 UBI: physical eraseblock size: 16384 bytes (16 KiB) @@ -112,21 +123,29 @@ 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 +# 3) Creating an UBIFS image +$ /usr/sbin/mkfs.ubifs -r test -m 512 -e 15872 \ + -c 8450 -o ubifs.img \end{lstlisting} \end{frame} \begin{frame}[fragile] \frametitle{Using UBIFS} +Exercise (cont.): \begin{lstlisting} -# 4) Creating an UBIFS image -$ mkfs.ubifs -r test -m 512 -e 15872 \ - -c 8450 -o ubifs.img +# 4) Creating a volume +$ sudo ubimkvol /dev/ubi0 -N myvolume -s 64MiB # 5) Writing the image -$ ubiupdatevol /dev/ubi0_0 ubifs.img +$ sudo ubiupdatevol /dev/ubi0_0 ubifs.img # 6) Mounting UBIFS -$ mount -t ubifs ubi0:myvolume /mnt/ +$ sudo mount -t ubifs ubi0:myvolume /mnt/ +\end{lstlisting} +Clean-up: +\begin{lstlisting} +# Unmounting image, detach UBI from MTD device, and erase flash partition +$ sudo umount /mnt +$ sudo ubidetach -m 0 +$ sudo flash_erase -j /dev/mtd0 0 0 \end{lstlisting} \end{frame} @@ -147,17 +166,23 @@ vol_flags=autoresize \begin{frame}[fragile] \frametitle{UBI: Create flash images} +Exercise: \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/ +$ /usr/sbin/ubinize -o ubi.img -m 512 -s 256 -p 16384 ubinize.cfg +# 2) Write the image +$ sudo nandwrite /dev/mtd0 ubi.img +# 3) Attach UBI +$ sudo ubiattach -m 0 +# 4) Mount UBIFS +$ sudo mount -t ubifs ubi0:myvolume /mnt/ +\end{lstlisting} +Clean-up: +\begin{lstlisting} +# Unmounting image, detach UBI from MTD device, and erase flash partition +$ sudo umount /mnt +$ sudo ubidetach -m 0 +$ sudo flash_erase -j /dev/mtd0 0 0 \end{lstlisting} \end{frame} @@ -169,7 +194,9 @@ ubi.mtd=0 root=ubi0:myvolume rootfstype=ubifs \end{verbatim} \end{frame} +\subsection{} \begin{frame} +\frametitle{References} \begin{thebibliography}{1} \bibitem{UBIFS} http://mytechrants.wordpress.com/2010/01/20/ubiubifs-on-nandsim/ \end{thebibliography} |
