From a522ca8a1dcab3bde5c1da40c06dc28a9aade124 Mon Sep 17 00:00:00 2001
From: Jan Altenberg <jan@linutronix.de>
Date: Mon, 24 Jan 2011 11:44:23 +0100
Subject: New chapter about creating and testing JFFS2 / UbiFS images on the
 host system (using nandsim)

---
 .../flash-filesystems/pres_flashfilesystems_en.tex | 170 +++++++++++++++++++++
 1 file changed, 170 insertions(+)
 create mode 100644 flash-memory/flash-filesystems/pres_flashfilesystems_en.tex

(limited to 'flash-memory/flash-filesystems/pres_flashfilesystems_en.tex')

diff --git a/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex b/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex
new file mode 100644
index 0000000..2708766
--- /dev/null
+++ b/flash-memory/flash-filesystems/pres_flashfilesystems_en.tex
@@ -0,0 +1,170 @@
+\documentclass[11pt]{beamer}
+
+%\usepackage{ngerman}
+\usepackage{times}
+\usepackage{graphicx}
+\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps}
+\usepackage{amsmath,amssymb}
+\usepackage[latin1]{inputenc}
+\usepackage{listings,color}
+\definecolor{lbcolor}{RGB}{255,210,150}
+\lstset{
+	language=C,
+	numbers=left,
+	stepnumber=1,
+	numbersep=5pt,
+	numberstyle=\tiny,
+	breaklines=true,
+	breakautoindent=true,
+	postbreak=\space,
+	tabsize=2,
+	basicstyle=\ttfamily\footnotesize,
+	showspaces=false,
+	showstringspaces=false,
+	extendedchars=true,
+	backgroundcolor=\color{lbcolor},
+	keywordstyle=\bf ,
+	commentstyle=\color{green},
+	stringstyle=\color{red}
+}
+
+\mode<presentation>
+{
+	\usetheme{linutronix}
+}
+
+% on the following slides, include icon in the left sidebar
+\def\lximg{/usr/share/lx/icons/fueller.png}
+
+\title{Creating Flashfilesystems}
+\institute{Linutronix GmbH}
+
+\begin{document}
+
+\frame{ \titlepage }
+
+% stop displaying 'fueller.png' on the following slides
+\def\lximg{none}
+
+\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}
+
+\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}
+
+\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}
+
+\section*{sources}
+\begin{frame}
+\begin{thebibliography}{1}
+\bibitem{UBIFS} http://mytechrants.wordpress.com/2010/01/20/ubiubifs-on-nandsim/
+\end{thebibliography} 
+\end{frame}
+\end{document}
-- 
cgit v1.2.3

