[FE training-materials-updates] Kernel slides: misc improvements and corrections

Michael Opdenacker michael.opdenacker at free-electrons.com
Mon May 26 09:16:35 CEST 2014


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

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

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

commit 61dde3e56f9c32279d4a39de013d7e3a0f64d3de
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Sun May 25 07:56:49 2014 +0200

    Kernel slides: misc improvements and corrections
    
    - Reported by Robert P. J. Day (thanks!)
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>


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

61dde3e56f9c32279d4a39de013d7e3a0f64d3de
 code/hello-param/hello_param.c                     |    1 -
 slides/kernel-device-model/kernel-device-model.tex |    6 ++---
 .../kernel-driver-development-modules.tex          |   25 ++++++++++----------
 .../kernel-porting-content.tex                     |    2 +-
 .../kernel-source-code-drivers.tex                 |    2 +-
 .../sysdev-linux-intro-compilation.tex             |    4 ++--
 .../sysdev-linux-intro-configuration.tex           |    5 ++--
 .../sysdev-linux-intro-cross-compilation.tex       |   15 +++++++-----
 .../sysdev-linux-intro-modules.tex                 |    4 ++--
 9 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/code/hello-param/hello_param.c b/code/hello-param/hello_param.c
index 007e15e..26667e8 100644
--- a/code/hello-param/hello_param.c
+++ b/code/hello-param/hello_param.c
@@ -1,7 +1,6 @@
 /* hello_param.c */
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 
 MODULE_LICENSE("GPL");
 
diff --git a/slides/kernel-device-model/kernel-device-model.tex b/slides/kernel-device-model/kernel-device-model.tex
index 3d4e8df..bccafe2 100644
--- a/slides/kernel-device-model/kernel-device-model.tex
+++ b/slides/kernel-device-model/kernel-device-model.tex
@@ -74,7 +74,7 @@
     \begin{itemize}
     \item Registering the bus type (\kstruct{bus_type})
     \item Allowing the registration of adapter drivers (USB
-      controllers, I2C adapters, etc.), able of detecting the
+      controllers, I2C adapters, etc.), able to detect the
       connected devices, and providing a communication mechanism with
       the devices
     \item Allowing the registration of device drivers (USB devices,
@@ -170,8 +170,8 @@ MODULE_DEVICE_TABLE(usb, rtl8150_table);
   \item \kstruct{usb_driver} is a structure defined by the USB
     core. Each USB device driver must instantiate it, and register
     itself to the USB core using this structure
-  \item This structure inherits from \kstruct{driver}, which is defined
-    by the device model.
+  \item This structure inherits from \kstruct{device_driver},
+    which is defined by the device model.
     \begin{block}{}
   \begin{minted}{c}
 static struct usb_driver rtl8150_driver = {
diff --git a/slides/kernel-driver-development-modules/kernel-driver-development-modules.tex b/slides/kernel-driver-development-modules/kernel-driver-development-modules.tex
index 85841aa..3380de5 100644
--- a/slides/kernel-driver-development-modules/kernel-driver-development-modules.tex
+++ b/slides/kernel-driver-development-modules/kernel-driver-development-modules.tex
@@ -36,7 +36,8 @@ MODULE_AUTHOR("William Shakespeare");
   \end{itemize}
 \item \ksym{__exit}
   \begin{itemize}
-  \item discarded when module compiled statically into the kernel.
+  \item discarded when module compiled statically into the kernel,
+        or when module unloading support is not enabled.
   \end{itemize}
 \item Example available on
   \url{http://git.free-electrons.com/training-materials/plain/code/hello/hello.c}
@@ -75,7 +76,7 @@ MODULE_AUTHOR("William Shakespeare");
   \item From a kernel module, only a limited number of kernel
     functions can be called
   \item Functions and variables have to be explicitly exported by the
-    kernel to be visible from a kernel module
+    kernel to be visible to a kernel module
   \item Two macros are used in the kernel to export functions and
     variables:
     \begin{itemize}
@@ -153,8 +154,9 @@ MODULE_AUTHOR("William Shakespeare");
   \item The below \code{Makefile} should be reusable for any single-file
     out-of-tree Linux module
   \item The source file is \code{hello.c}
-  \item Just run make to build the \code{hello.ko} file
+  \item Just run \code{make} to build the \code{hello.ko} file
   \end{itemize}
+{\footnotesize
 \begin{block}{}
 \begin{minted}{make}
 ifneq ($(KERNELRELEASE),)
@@ -167,12 +169,14 @@ all:
 endif
 \end{minted}
 \end{block}
+}
 
 \begin{itemize}
-\item For \code{KDIR}, you can either set
+\item For \code{KDIR}, you can either set:
   \begin{itemize}
-  \item full kernel source directory (configured and compiled)
-  \item or just kernel headers directory (minimum needed)
+  \item full kernel source directory\\
+        (configured + \code{make modules_prepare})
+  \item or just kernel headers directory (\code{make headers_install})
   \end{itemize}
 \end{itemize}
 \end{frame}
@@ -271,7 +275,6 @@ config USB_SERIAL_NAVMAN
 /* hello_param.c */
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/moduleparam.h>
 
 MODULE_LICENSE("GPL");
 
@@ -315,20 +318,18 @@ Source code available on: {\small
   \frametitle{Declaring a module parameter}
 
 \begin{minted}[fontsize=\small]{c}
-#include <linux/moduleparam.h>
-
 module_param(
     name, /* name of an already defined variable */
     type, /* either byte, short, ushort, int, uint, long, ulong,
-             charp, or bool. (checked at run time!) */ 
+             charp, bool or invbool. (checked at run time!) */ 
     perm  /* for /sys/module/<module_name>/parameters/<param>,
              0: no such module parameter value file */
 );
 
 /* Example */
-int irq=5;
+static int irq=5;
 module_param(irq, int, S_IRUGO);
 \end{minted}
 Modules parameter arrays are also possible with
-\kfunc{module_param_array}, but they are less common.
+\kfunc{module_param_array}.
 \end{frame}
diff --git a/slides/kernel-porting-content/kernel-porting-content.tex b/slides/kernel-porting-content/kernel-porting-content.tex
index 82a4f1d..031523d 100644
--- a/slides/kernel-porting-content/kernel-porting-content.tex
+++ b/slides/kernel-porting-content/kernel-porting-content.tex
@@ -46,7 +46,7 @@
     \end{itemize}
   \item Some CPU types share some code, in directories named
     \code{plat-*}
-  \item Device Tree files in \kpath{arch/arm/boot/dts}.
+  \item Device Tree source files in \kpath{arch/arm/boot/dts}.
   \end{itemize}
 \end{frame}
 
diff --git a/slides/kernel-source-code-drivers/kernel-source-code-drivers.tex b/slides/kernel-source-code-drivers/kernel-source-code-drivers.tex
index 5c84850..22c1049 100644
--- a/slides/kernel-source-code-drivers/kernel-source-code-drivers.tex
+++ b/slides/kernel-source-code-drivers/kernel-source-code-drivers.tex
@@ -27,7 +27,7 @@
       ANSI C compiler will not compile the kernel
     \item A few alternate compilers are supported (Intel and Marvell)
     \item See
-      \url{http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/C-Extensions.html}
+      \url{http://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/C-Extensions.html}
     \end{itemize}
   \end{itemize}
 \end{frame}
diff --git a/slides/sysdev-linux-intro-compilation/sysdev-linux-intro-compilation.tex b/slides/sysdev-linux-intro-compilation/sysdev-linux-intro-compilation.tex
index 2e9da5e..8c9994c 100644
--- a/slides/sysdev-linux-intro-compilation/sysdev-linux-intro-compilation.tex
+++ b/slides/sysdev-linux-intro-compilation/sysdev-linux-intro-compilation.tex
@@ -7,8 +7,8 @@
   \item \code{make}
     \begin{itemize}
     \item in the main kernel source directory
-    \item Remember to run \code{make -j 4} if you have multiple CPU
-      cores to speed up the compilation process
+    \item Remember to run multiple jobs in parallel
+          if you have multiple CPU cores. Example: \code{make -j 4}
     \item No need to run as root!
     \end{itemize}
   \item Generates
diff --git a/slides/sysdev-linux-intro-configuration/sysdev-linux-intro-configuration.tex b/slides/sysdev-linux-intro-configuration/sysdev-linux-intro-configuration.tex
index aa19f08..a0dd919 100644
--- a/slides/sysdev-linux-intro-configuration/sysdev-linux-intro-configuration.tex
+++ b/slides/sysdev-linux-intro-configuration/sysdev-linux-intro-configuration.tex
@@ -105,6 +105,7 @@
       \item {\em false} (to exclude the feature)
       \end{itemize}
     \item \code{int} options, to specify integer values
+    \item \code{hex} options, to specify hexadecimal values
     \item \code{string} options, to specify string values
     \end{itemize}
   \end{itemize}
@@ -318,8 +319,8 @@ CONFIG_NTFS_RW=y
   \item Enable the block layer
     \begin{itemize}
     \item If \code{CONFIG_EXPERT} is enabled, the block layer can be
-      completely removed. Embedded systems using only flash storage
-      can safely disable the block layer
+      completely removed. Embedded systems using only raw flash storage
+      (MTD) can safely disable the block layer
     \end{itemize}
   \item Processor type and features (x86) or System type (ARM) or CPU selection
     (MIPS)
diff --git a/slides/sysdev-linux-intro-cross-compilation/sysdev-linux-intro-cross-compilation.tex b/slides/sysdev-linux-intro-cross-compilation/sysdev-linux-intro-cross-compilation.tex
index bf9802a..0a096c3 100644
--- a/slides/sysdev-linux-intro-cross-compilation/sysdev-linux-intro-cross-compilation.tex
+++ b/slides/sysdev-linux-intro-cross-compilation/sysdev-linux-intro-cross-compilation.tex
@@ -168,7 +168,9 @@
 \begin{frame}
   \frametitle{Booting with U-Boot}
   \begin{itemize}
-  \item U-Boot requires a special kernel image format: \code{uImage}
+  \item Recent versions of U-Boot can boot the \code{zImage} binary.
+  \item Older versions require a special kernel image format:
+        \code{uImage}
     \begin{itemize}
     \item \code{uImage} is generated from \code{zImage} using the
       \code{mkimage} tool. It is done automatically by the kernel
@@ -181,10 +183,11 @@
     {\em Device Tree Blob} to the kernel.
   \item The typical boot process is therefore:
     \begin{enumerate}
-    \item Load \code{uImage} at address X in memory
+    \item Load \code{zImage} or \code{uImage} at address X in memory
     \item Load \code{<board>.dtb} at address Y in memory
-    \item Start the kernel with \code{bootm X - Y} (the \code{-} in
-      the middle indicates no {\em initramfs})
+    \item Start the kernel with \code{bootz X - Y} or
+      \code{bootm X - Y}\\
+      The \code{-} in the middle indicates no {\em initramfs}
     \end{enumerate}
   \end{itemize}
 \end{frame}
@@ -201,8 +204,8 @@
     \item It is very important for system configuration
     \item \code{root=} for the root filesystem (covered later)
     \item \code{console=} for the destination of kernel messages
-    \item and many more, documented in \kerneldoc{kernel-parameters.txt}
-       in the kernel sources
+    \item Many more exist. The most important ones are documented
+          in \kerneldoc{kernel-parameters.txt} in kernel sources.
     \end{itemize}
   \item This kernel command line is either
     \begin{itemize}
diff --git a/slides/sysdev-linux-intro-modules/sysdev-linux-intro-modules.tex b/slides/sysdev-linux-intro-modules/sysdev-linux-intro-modules.tex
index 68a4dfd..b8078c4 100644
--- a/slides/sysdev-linux-intro-modules/sysdev-linux-intro-modules.tex
+++ b/slides/sysdev-linux-intro-modules/sysdev-linux-intro-modules.tex
@@ -43,7 +43,7 @@
     \code{loglevel} kernel parameter, or completely disabled with the
     \code{quiet} parameter).
   \item Note that you can write to the kernel log from user space too:\\
-    \code{echo "Debug info" > /dev/kmsg}
+    \code{echo "<n>Debug info" > /dev/kmsg}
   \end{itemize}
 \end{frame}
 
@@ -130,7 +130,7 @@ $ dmesg
   \frametitle{Check module parameter values}
   How to find the current values for the parameters of a loaded module?
   \begin{itemize}
-  \item Check \code{/sys/modules/<name>/parameters}.
+  \item Check \code{/sys/module/<name>/parameters}.
   \item There is one file per parameter, containing the parameter value.
   \end{itemize}
 \end{frame}



More information about the training-materials-updates mailing list