[FE training-materials-updates] Further embedded Linux updates

Michael Opdenacker michael.opdenacker at free-electrons.com
Wed May 18 10:37:14 CEST 2016


Repository : git://git.free-electrons.com/training-materials.git
On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=57840a108512a8afff61dc027fbe605ec7074678

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

commit 57840a108512a8afff61dc027fbe605ec7074678
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Wed May 18 10:37:14 2016 +0200

    Further embedded Linux updates
    
    - For Ubuntu 16.04 and Linux 4.6
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>


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

57840a108512a8afff61dc027fbe605ec7074678
 .../sysdev-block-filesystems.tex                   | 93 +++++++++++-----------
 labs/sysdev-buildroot/sysdev-buildroot.tex         | 10 +--
 .../sysdev-flash-filesystems.tex                   |  6 +-
 labs/sysdev-thirdparty/sysdev-thirdparty.tex       |  2 +-
 labs/sysdev-toolchain/sysdev-toolchain.tex         |  4 +-
 labs/sysdev-u-boot/boot.log.tex                    | 34 ++++++++
 labs/sysdev-u-boot/sysdev-u-boot.tex               | 39 +--------
 7 files changed, 95 insertions(+), 93 deletions(-)

diff --git a/labs/sysdev-block-filesystems/sysdev-block-filesystems.tex b/labs/sysdev-block-filesystems/sysdev-block-filesystems.tex
index f01fd6c..db623f8 100644
--- a/labs/sysdev-block-filesystems/sysdev-block-filesystems.tex
+++ b/labs/sysdev-block-filesystems/sysdev-block-filesystems.tex
@@ -26,8 +26,20 @@ directory, which we will progressively adapt to use block filesystems.
 
 Recompile your kernel with support for SquashFS and ext3\footnote{Basic
 configuration options for these filesystems will be sufficient. No need
-for things like extended attributes.}. Update your
-kernel image in NAND flash.
+for things like extended attributes.}.
+
+Here are other kernel configuration settings to change:
+\begin{itemize}
+\item Disable \code{CONFIG_REGULATOR_FIXED_VOLTAGE}, which
+   can cause an abrupt reset when an MMC card is inserted or removed.
+\item Enable \code{CONFIG_AT_HDMAC}, without which MMC events
+   won't be detected.
+\end{itemize}
+
+Fixes for these issues have been submitted by us for inclusion in the
+next versions of the Linux kernel.
+
+Update your kernel image in NAND flash.
 
 Boot your board with this new kernel and on the NFS filesystem you
 used in this previous lab.
@@ -41,63 +53,40 @@ We're going to use an MMC card for our block device.
 
 Plug the MMC card your instructor gave you on your workstation. Type
 the \code{dmesg} command to see which device is used by your
-workstation. In case the device is \code{/dev/sdb}, you will see
+workstation. In case the device is \code{/dev/mmcblk0}, you will see
 something like
 
 \begin{verbatim}
-sd 3:0:0:0: [sdb] 3842048 512-byte hardware sectors: (1.96 GB/1.83 GiB)
+[46939.425299] mmc0: new high speed SDHC card at address 0007
+[46939.427947] mmcblk0: mmc0:0007 SD16G 14.5 GiB
 \end{verbatim}
 
-If your PC has an internal MMC/SD card reader, the device may also
-been seen as \code{/dev/mmcblk0}, and the first partition as
-\code{mmcblk0p1}\footnote{This is not always the case with internal
-  MMC/SD card readers. On some PCs, such devices are behind an
-  internal USB bus, and thus are visible in the same way external card
-  readers are}. You will see that the MMC/SD card is seen in the same
-way by the board.
+The device file name may be different (such as \code{/dev/sdb}
+if the card reader is connected to a USB bus (either inside your PC
+or using a USB card reader).
 
 In the following instructions, we will assume that your MMC/SD card
-is seen as \code{/dev/sdb} by your PC workstation.
-
-\fbox{
-  \begin{minipage}{\textwidth}
-    {\bfseries Caution: read this carefully before proceeding. You
-      could destroy existing partitions on your PC!
-
-      Do not make the confusion between the device that is used by
-      your board to represent your MMC/SD disk (probably
-      \code{/dev/sda}), and the device that your workstation uses when
-      the card reader is inserted (probably \code{/dev/sdb}).
-
-      So, don't use the \code{/dev/sda} device to reflash your MMC
-      disk from your workstation. People have already destroyed their
-      Windows partition by making this mistake.}
-  \end{minipage}
-}
-
-You can also run \code{cat /proc/partitions} to list all block devices
-in your system. Again, make sure to distinguish the SD/MMC card from
-the hard drive of your development workstation!
+is seen as \code{/dev/mmcblk0} by your PC workstation.
 
 Type the \code{mount} command to check your currently mounted
 partitions. If MMC/SD partitions are mounted, unmount them:
 
 \begin{verbatim}
-$ sudo umount /dev/sdb*
+$ sudo umount /dev/mmcblk0*
 \end{verbatim}
 
 Then, clear possible MMC/SD card contents remaining from previous
-training sessions:
+training sessions (only the first megabytes matter):
 
 \begin{verbatim}
-$ sudo dd if=/dev/zero of=/dev/sdb bs=1M count=256
+$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=256
 \end{verbatim}
 
 Now, let's use the \code{cfdisk} command to create the partitions that
 we are going to use:
 
 \begin{verbatim}
-$ sudo cfdisk /dev/sdb
+$ sudo cfdisk /dev/mmcblk0
 \end{verbatim}
 
 In the \code{cfdisk} interface, delete existing partitions, then
@@ -131,12 +120,22 @@ workstation, remove the MMC card and insert it again.
 \section{Data partition on the MMC disk}
 
 Using the \code{mkfs.ext3} create a journaled file system on the
-third partition of the MMC disk (Caution: one again, make sure
-you're not touching hard disk partitions instead of the MMC ones!).
-Remember that you can use the \code{-L} option to set a volume name
-for the partition. Move the contents of the \code{/www/upload/files}
-directory (in your target root filesystem) into this new partition.
-The goal is to use the third partition of the MMC card as the storage
+third partition of the MMC disk:
+
+\begin{verbatim}
+sudo mkfs.ext3 -L data -E nodiscard /dev/mmcblk0p3
+\end{verbatim}
+
+\begin{itemize}
+\item \code{-L} assigns a volume name to the partition
+\item \code{-E nodiscard} disables bad block discarding. While this
+      should be a useful option for cards with bad blocks, skipping
+      this step saves long minutes in MMC/SD cards. 
+\end{itemize}
+
+Now, mount this new partition and move the contents of the
+\code{/www/upload/files} directory (in your target root filesystem) into
+it. The goal is to use the third partition of the MMC card as the storage
 for the uploaded images.
 
 Connect the MMC disk to your board. You should see the MMC partitions
@@ -198,11 +197,6 @@ Check that your system still works. Congratulations if it does!
 
 \section{Store the kernel image and DTB on the MMC card}
 
-Finally, copy the \code{zImage} kernel image and DTB to the first
-partition of the MMC card and adjust the \code{bootcmd} of U-Boot so
-that it loads the kernel and DTB from the MMC card instead of loading
-them from the NAND.
-
 You'll first need to format the first partition, using:
 \begin{verbatim}
 sudo mkfs.vfat -F 16 -n boot /dev/sdb1
@@ -212,6 +206,11 @@ It will create a new FAT16 partition, called \code{boot}. Remove and
 plug the MMC card. You can now copy the kernel image and Device Tree
 to it.
 
+You can now copy the \code{zImage} kernel image and DTB to the first
+partition of the MMC card and adjust the \code{bootcmd} of U-Boot so
+that it loads the kernel and DTB from the MMC card instead of loading
+them from the NAND.
+
 In U-boot, you can load a file from a FAT filesystem using a command
 like
 
diff --git a/labs/sysdev-buildroot/sysdev-buildroot.tex b/labs/sysdev-buildroot/sysdev-buildroot.tex
index 18d168d..14e7871 100644
--- a/labs/sysdev-buildroot/sysdev-buildroot.tex
+++ b/labs/sysdev-buildroot/sysdev-buildroot.tex
@@ -11,7 +11,7 @@ go into it.
 \section{Get Buildroot and explore the source code}
 
 The official Buildroot website is available at
-\url{http://buildroot.org/}. Download the latest stable 2015.11.x
+\url{http://buildroot.org/}. Download the latest stable 2016.02.x
 version which we have tested for this lab. Uncompress the tarball
 and go inside the Buildroot source directory.
 
@@ -70,6 +70,7 @@ button whenever you need more details about a given option:
   \begin{itemize}
   \item \code{Target Architecture}: \code{ARM (little endian)}
   \item \code{Target Architecture Variant}: \code{cortex-A5}
+  \item \code{Enable VFP extension support}: Enabled
   \item \code{Target ABI}: \code{EABIhf}
   \item \code{Floating point strategy}: \code{VFPv4-D16}
   \end{itemize}
@@ -80,11 +81,10 @@ button whenever you need more details about a given option:
   \item \code{Toolchain path}: use the toolchain you built:
     \code{/usr/local/xtools/arm-cortexa5-linux-uclibcgnueabihf}
   \item \code{External toolchain gcc version}: \code{5.x}
-  \item \code{External toolchain kernel headers series}: \code{4.3.x}
+  \item \code{External toolchain kernel headers series}: \code{4.4.x}
   \item \code{External toolchain C library}: \code{uClibc}
-  \item We must tell Buildroot about our toolchain configuration, so:
-    enable \code{Toolchain has large file support?}, \code{Toolchain has
-    WCHAR support?}, \code{Toolchain has SSP support?} and
+  \item We must tell Buildroot about our toolchain configuration, so
+    select \code{Toolchain has WCHAR support?} and
     \code{Toolchain has C++ support?}.
     Buildroot will check these parameters anyway.
   \item Select \code{Copy gdb server to the Target}
diff --git a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index f061018..b4489c0 100644
--- a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
+++ b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
@@ -63,8 +63,8 @@ to UBI. In case, the last partition is \code{mtd5}, you will run:
 ubiattach -m 5 /dev/ubi_ctrl
 \end{verbatim}
 
-Doing this, you will get details in the kernel log about the MTD page
-size and the LEB size that UBI will use.
+Doing this, you will get details in the kernel log about the MTD minimum
+I/O size and the LEB size that UBI will use.
 
 Using such information, prepare prepare a UBIFS filesystem
 image containing the files stored in the \code{/www/upload/files} directory.
@@ -189,7 +189,7 @@ data using the web server.
 %Useful u-boot environment variables
 %setenv mtdids nand0=atmel_nand
 %setenv mtdparts mtdparts=atmel_nand:256k(bootstrap),512k(u-boot),256k(u-boot-env1),256k(u-boot-env2),-(UBI)
-%setenv bootargs_base console=ttyS0,115200 rootfstype=ubifs root=ubi0:root ip=dhcp ubi.mtd=4 ro
+%setenv bootargs_base console=ttyS0,115200 rootfstype=ubifs root=ubi0:root ip=192.168.0.100:::::eth0 ubi.mtd=4 ro
 %setenv bootcmd 'mtdparts; ubi part UBI; ubi readvol 0x21000000 kernel;
 %ubi readvol 0x22000000 dtb; setenv bootargs ${bootargs_base} ${mtdparts}; bootz 0x21000000 - 0x22000000'
 %setenv flash 'mtdparts; nand erase.part UBI; tftp 0x21000000 test.ubi; nand write.trimffs 0x21000000 UBI ${filesize}'
diff --git a/labs/sysdev-thirdparty/sysdev-thirdparty.tex b/labs/sysdev-thirdparty/sysdev-thirdparty.tex
index d1e70ed..d9cfe1c 100644
--- a/labs/sysdev-thirdparty/sysdev-thirdparty.tex
+++ b/labs/sysdev-thirdparty/sysdev-thirdparty.tex
@@ -96,7 +96,7 @@ what's needed for execution.
 So, in \code{$HOME/embedded-linux-labs/thirdparty}, create two
 directories: \code{staging} and \code{target}.
 
-For the target, we need a basic system with BusyBox, device nodes and
+For the target, we need a basic system with BusyBox and
 initialization scripts. We will re-use the system built in the {\em A
   tiny embedded system} lab, so copy this system in the target
 directory:
diff --git a/labs/sysdev-toolchain/sysdev-toolchain.tex b/labs/sysdev-toolchain/sysdev-toolchain.tex
index 7db43e8..78e7d49 100644
--- a/labs/sysdev-toolchain/sysdev-toolchain.tex
+++ b/labs/sysdev-toolchain/sysdev-toolchain.tex
@@ -104,7 +104,9 @@ In \code{Toolchain options}:
 
 In \code{C-library}:
 \begin{itemize}
-  \item Enable \code{IPv6} support.
+  \item Enable \code{IPv6} support. That's because of Buildroot (which
+  we will use later, which doesn't accept to use toolchains without IPv6
+  support.
 \end{itemize}
 
 In \code{Debug facilities}:
diff --git a/labs/sysdev-u-boot/boot.log.tex b/labs/sysdev-u-boot/boot.log.tex
new file mode 100644
index 0000000..3dc5ef8
--- /dev/null
+++ b/labs/sysdev-u-boot/boot.log.tex
@@ -0,0 +1,34 @@
+\begin{verbatim}
+AT91Bootstrap 3.8.5 (Tue May 17 12:06:03 EDT 2016)
+
+NAND: ONFI flash detected
+NAND: Manufacturer ID: 0x2c Chip ID: 0x32
+NAND: Page Bytes: 0x800, Spare Bytes: 0x40
+NAND: ECC Correctability Bits: 0x4, ECC Sector Bytes: 0x200
+NAND: Disable On-Die ECC
+NAND: Initialize PMECC params, cap: 0x4, sector: 0x200
+NAND: Image: Copy 0x80000 bytes from 0x40000 to 0x26f00000
+NAND: Done to load image
+
+
+U-Boot 2016.05 (May 17 2016 - 12:41:15 -0400)
+
+CPU: SAMA5D36
+Crystal frequency:       12 MHz
+CPU clock        :      528 MHz
+Master clock     :      132 MHz
+DRAM:  256 MiB
+NAND:  256 MiB
+MMC:   mci: 0
+*** Warning - bad CRC, using default environment
+
+In:    serial
+Out:   serial
+Err:   serial
+Net:   gmac0
+Error: gmac0 address not set.
+, macb0
+Error: macb0 address not set.
+
+Hit any key to stop autoboot:  0 
+\end{verbatim}
diff --git a/labs/sysdev-u-boot/sysdev-u-boot.tex b/labs/sysdev-u-boot/sysdev-u-boot.tex
index 9c6ff0a..7a82791 100644
--- a/labs/sysdev-u-boot/sysdev-u-boot.tex
+++ b/labs/sysdev-u-boot/sysdev-u-boot.tex
@@ -117,7 +117,7 @@ Atmel's GitHub account:
 \begin{verbatim}
 git clone git://github.com/linux4sam/at91bootstrap.git
 cd at91bootstrap
-git checkout v3.7.1
+git checkout v3.8.5
 \end{verbatim}
 
 Then, we first need to configure the build system for our setup. We're
@@ -178,8 +178,6 @@ You need to:
 \item Select \code{Erase All}, and execute the command
 \item Then, select and execute \code{Enable OS PMECC parameters}
   in order to change the NAND ECC parameters to what RomBOOT expects.
-  Change the number of ECC bits to \code{4}, and the ECC offset to
-  \code{36}.
 \item Finally, send the image we just compiled using the command
   \code{Send Boot File}
 \end{itemize}
@@ -192,7 +190,7 @@ the next section.
 Download U-Boot:
 
 \begin{verbatim}
-wget ftp://ftp.denx.de/pub/u-boot/u-boot-2016.03.tar.bz2
+wget ftp://ftp.denx.de/pub/u-boot/u-boot-2016.05.tar.bz2
 \end{verbatim}
 
 
@@ -238,38 +236,7 @@ You can now exit \code{sam-ba}.
 Reset the board and check that it boots your new bootloaders. You can
 verify this by checking the build dates:
 
-\begin{verbatim}
-AT91Bootstrap 3.7.1 (Tue May 10 08:59:24 EDT 2016)
-
-NAND: ONFI flash detected
-NAND: Manufacturer ID: 0x2c Chip ID: 0x32
-NAND: Disable On-Die ECC
-NAND: Initialize PMECC params, cap: 0x4, sector: 0x200
-NAND: Image: Copy 0x80000 bytes from 0x40000 to 0x26f00000
-NAND: Done to load image
-
-
-U-Boot 2016.03 (May 10 2016 - 09:12:47 -0400)
-
-CPU: SAMA5D36
-Crystal frequency:       12 MHz
-CPU clock        :      528 MHz
-Master clock     :      132 MHz
-DRAM:  256 MiB
-NAND:  256 MiB
-MMC:   mci: 0
-*** Warning - bad CRC, using default environment
-
-In:    serial
-Out:   serial
-Err:   serial
-Net:   gmac0
-Error: gmac0 address not set.
-, macb0
-Error: macb0 address not set.
-
-Hit any key to stop autoboot:  0
-\end{verbatim}
+\input{../labs/sysdev-u-boot/boot.log.tex}
 
 Interrupt the countdown to enter the U-Boot shell:
 \begin{verbatim}




More information about the training-materials-updates mailing list