[FE training-materials-updates] Factorize common parts: start with the ethernet setup

Antoine Ténart antoine.tenart at free-electrons.com
Wed Mar 26 14:48:40 CET 2014


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

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

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

commit 9baa45772a7f7454e08539049aaab2ccc3a584d2
Author: Antoine Ténart <antoine.tenart at free-electrons.com>
Date:   Tue Mar 25 16:56:56 2014 +0100

    Factorize common parts: start with the ethernet setup


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

9baa45772a7f7454e08539049aaab2ccc3a584d2
 .../network-config-1.png                           |  Bin 40480 -> 40480 bytes
 .../network-config-2.png                           |  Bin 24584 -> 24584 bytes
 .../network-config-3.png                           |  Bin 50383 -> 50383 bytes
 labs/common/setup-ethernet-communication.tex       |  115 ++++++++++++++++++++
 labs/yocto-first-build/yocto-first-build.tex       |   31 +-----
 5 files changed, 121 insertions(+), 25 deletions(-)

diff --git a/labs/kernel-board-setup/network-config-1.png b/labs/common/network-config-1.png
similarity index 100%
copy from labs/kernel-board-setup/network-config-1.png
copy to labs/common/network-config-1.png
diff --git a/labs/kernel-board-setup/network-config-2.png b/labs/common/network-config-2.png
similarity index 100%
copy from labs/kernel-board-setup/network-config-2.png
copy to labs/common/network-config-2.png
diff --git a/labs/kernel-board-setup/network-config-3.png b/labs/common/network-config-3.png
similarity index 100%
copy from labs/kernel-board-setup/network-config-3.png
copy to labs/common/network-config-3.png
diff --git a/labs/common/setup-ethernet-communication.tex b/labs/common/setup-ethernet-communication.tex
new file mode 100644
index 0000000..a0458f7
--- /dev/null
+++ b/labs/common/setup-ethernet-communication.tex
@@ -0,0 +1,115 @@
+\section{Set up the Ethernet communication}
+
+Later on, we will transfer files from the development workstation to
+the board using the TFTP protocol, which works on top of an Ethernet
+connection.
+
+To start with, install the \code{tftpd-hdpa} server and create the root TFTP
+directory:
+\begin{verbatim}
+sudo apt-get install tftp-hdpa
+sudo mkdir -m 777 /tftp
+\end{verbatim}
+
+Then make sure the \code{tftp-hdpa} server uses the right directory by checking
+the \code{TFTP_DIRECTORY} variable in \code{/etc/default/tftpd-hpa}.
+
+Finally restart the service to make sure all modifications are effective:
+\begin{verbatim}
+sudo service tftpd-hdpa restart
+\end{verbatim}
+
+With a network cable, connect the Ethernet port of your board to the 
+one of your computer. If your computer already has a wired connection
+to the network, your instructor will provide you with a USB Ethernet
+adapter. A new network interface, probably \code{eth1} or \code{eth2},
+should appear on your Linux system.
+
+To configure this network interface on the workstation side, click on
+the {\em Network Manager} tasklet on your desktop, and select {\em
+  Edit Connections}.
+
+\begin{center}
+\includegraphics[width=8cm]{../labs/common/network-config-1.png}
+\end{center}
+
+Select the new {\em wired network connection}:
+
+\begin{center}
+\includegraphics[width=8cm]{../labs/common/network-config-2.png}
+\end{center}
+
+In the \code{IPv4 Settings} tab, press the \code{Add} button
+and make the interface use a static IP
+address, like \code{192.168.0.1} (of course, make sure that this
+address belongs to a separate network segment from the one of the main
+company network).
+
+\begin{center}
+\includegraphics[width=8cm]{../labs/common/network-config-3.png}
+\end{center}
+
+You can use \code{255.255.255.0} as \code{Netmask}, and leave the
+\code{Gateway} field untouched (if you click on the \code{Gateway} box, you
+will have to type a valid IP address, otherwise you won't be apply to
+click on the \code{Apply} button).
+
+Now, configure the network on the board in U-Boot by setting the \code{ipaddr}
+and \code{serverip} environment variables:
+
+\begin{verbatim}
+setenv ipaddr 192.168.0.100
+setenv serverip 192.168.0.1
+\end{verbatim}
+
+The first time you use your board, you also need to send the MAC address
+in U-boot:
+
+\begin{verbatim}
+setenv ethaddr 01:02:03:04:05:06
+\end{verbatim}
+
+In case the board was previously configured in a different way, we
+also turn off automatic booting after commands that can be used to
+copy a kernel to RAM:
+
+\begin{verbatim}
+setenv autostart no
+\end{verbatim}
+
+To make these settings permanent, save the environment:
+
+\begin{verbatim}
+saveenv
+\end{verbatim}
+
+Now switch your board off and on again\footnote{Power cycling your
+  board is needed to make your \code{ethaddr} permanent, for obscure
+  reasons. If you don't, U-boot will complain that \code{ethaddr} is not
+  set.}.
+
+You can then test the TFTP connection. First, put a small text file in
+the directory exported through TFTP on your development
+workstation. Then, from U-Boot, do:
+
+\begin{verbatim}
+tftp 0x80000000 textfile.txt
+\end{verbatim}
+
+{\bf Caution: known issue in Ubuntu 12.04 and later}:
+if this command doesn't work, you may have to stop the server
+and start it again every time you boot your workstation:
+
+\begin{verbatim}
+sudo service tftpd-hpa restart
+\end{verbatim}
+
+The \code{tftp} command should have downloaded
+the \code{textfile.txt} file from your development
+workstation into the board's memory at location 0x80000000 (this
+location is part of the board DRAM). You can verify that the download
+was successful by dumping the contents of the memory:
+
+\begin{verbatim}
+md 0x80000000
+\end{verbatim}
diff --git a/labs/yocto-first-build/yocto-first-build.tex b/labs/yocto-first-build/yocto-first-build.tex
index 1371529..7c90968 100644
--- a/labs/yocto-first-build/yocto-first-build.tex
+++ b/labs/yocto-first-build/yocto-first-build.tex
@@ -21,23 +21,7 @@ Install the required packages:
 sudo apt-get install chrpath gawk texinfo
 \end{verbatim}
 
-\section{Install the TFTP server}
-
-First we need to setup a TFTP server on the training computer.
-
-Install the \code{tftpd-hdpa} server and create the root TFTP directory:
-\begin{verbatim}
-sudo apt-get install tftp-hdpa
-sudo mkdir -m 777 /tftp
-\end{verbatim}
-
-Then make sure the \code{tftp-hdpa} server uses the right directory by checking
-the \code{TFTP_DIRECTORY} variable in \code{/etc/default/tftpd-hpa}.
-
-Finally restart the service to make sure all modifications are effective:
-\begin{verbatim}
-sudo service tftpd-hdpa restart
-\end{verbatim}
+\input{../labs/common/setup-ethernet-communication.tex}
 
 \section{Download Yocto}
 
@@ -86,19 +70,16 @@ bitbake core-image-minimal
 Once the build finished, all output images can be find under
 \code{\$BUILDDIR/tmp/deploy/images/beaglebone}.
 
+\section{Setup the internal eMMC}
+
+In order to boot from the internal eMMC, we should make sure it is properly
+setted up before writing our images.
+
 \section{Flash the board}
 
 In order to boot the BeagleBone Black we will flash the bootloader and the
 kernel image in the internal eMMC here.
 
-First we need to set the correct environment variables from the U-Boot command
-line so that the BeagleBone Black can communicate with the TFTP server:
-\begin{verbatim}
-setenv ipaddr 192.168.0.2
-setenv serverip 192.168.0.1
-setenv loadaddr 0x80200000
-\end{verbatim}
-
 On the training computer copy the bootloader, kernel and rootfs images in the
 root TFTP directory:
 \begin{verbatim}



More information about the training-materials-updates mailing list