[BL training-materials-updates] Kernel labs: support for BeagleBoneBlack Wireless

Michael Opdenacker michael.opdenacker at bootlin.com
Fri May 25 10:54:24 CEST 2018


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

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

commit 51138bbd7d0d639b33d8eca470817d2ee404302b
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Fri May 25 10:53:19 2018 +0200

    Kernel labs: support for BeagleBoneBlack Wireless
    
    - Also an upgrade to Linux 4.16
    - Now configuring IP addresses on the host through "nmcli"
      instead of using the graphical interface
    
    Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>


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

51138bbd7d0d639b33d8eca470817d2ee404302b
 .../beaglebone-black-connectors.jpg                | Bin 107753 -> 0 bytes
 labs/kernel-board-setup/kernel-board-setup.tex     | 155 +++++++++++++--------
 labs/kernel-board-setup/network-config-2.png       | Bin 20437 -> 0 bytes
 labs/kernel-board-setup/network-config-3.png       | Bin 43472 -> 0 bytes
 .../kernel-compiling-and-nfs-booting.tex           |  24 +++-
 .../kernel-i2c-device-model.tex                    |   4 +-
 labs/kernel-module-simple/kernel-module-simple.tex |   4 +-
 labs/kernel-serial-iomem/kernel-serial-iomem.tex   |   2 +-
 .../kernel-sources-download.tex                    |   4 +-
 .../kernel-sources-exploring.tex                   |  10 +-
 10 files changed, 130 insertions(+), 73 deletions(-)

diff --git a/labs/kernel-board-setup/beaglebone-black-connectors.jpg b/labs/kernel-board-setup/beaglebone-black-connectors.jpg
deleted file mode 100644
index 7c3a9bc..0000000
Binary files a/labs/kernel-board-setup/beaglebone-black-connectors.jpg and /dev/null differ
diff --git a/labs/kernel-board-setup/kernel-board-setup.tex b/labs/kernel-board-setup/kernel-board-setup.tex
index e22f70a..151f555 100644
--- a/labs/kernel-board-setup/kernel-board-setup.tex
+++ b/labs/kernel-board-setup/kernel-board-setup.tex
@@ -10,13 +10,13 @@ After this lab, you will be able to:
 
 \section{Getting familiar with the board}
 
-\begin{center}
-\includegraphics[width=8cm]{labs/kernel-board-setup/beaglebone-black-connectors.jpg}
-\end{center}
+Take some time to read about the board features and connectors:
 
-Take some time to read about the board features and connectors on
-\url{http://www.elinux.org/Beagleboard:BeagleBoneBlack}
-above image was taken from this page.
+\begin{itemize}
+   \item If you have the original BeagleBone Black: \url{http://www.elinux.org/Beagleboard:BeagleBoneBlack}
+   \item If you have the newer BeagleBone Black Wireless:
+\url{https://beagleboard.org/black-wireless} in addition to the above URL. 
+\end{itemize}
 
 Don't hesitate to share your questions with the instructor.
 
@@ -25,11 +25,13 @@ Don't hesitate to share your questions with the instructor.
 We are going to download documents which we will need during our
 practical labs.
 
-The first document to download is the board System Reference Manual found at
-\url{https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf?raw=true}\footnote{
-There is a link to this manual on the above page}.
-This is the ultimate reference about the board, giving all the details
-about the design of the board and the components which were chosen.
+The first document to download is the BeagleBone Black System Reference Manual found at
+\url{https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf?raw=true}.
+
+Even if you have the BeagleBoneBlack Wireless board, this is the
+ultimate reference about the board, in particular for the pinout and
+possible configurations of the P8 and P9 headers, and more generally
+for most devices which are the same in both boards.
 You don't have to start reading this document now but you will need it
 during the practical labs.
 
@@ -95,6 +97,7 @@ There should be nothing on the serial line so far, as the board is not
 powered up yet.
 
 It is now time to power up your board by plugging in the mini-USB
+(BeagleBone Black case) or micro-USB (BeagleBone Black Wireless case)
 cable supplied by your instructor (with your PC or a USB power supply at the
 other end of the cable).
 
@@ -103,25 +106,34 @@ start on the serial line.
 
 \section{Bootloader interaction}
 
-Reset your board. Press a key in the \code{picocom} terminal to stop the U-boot
-countdown. You should then see the U-Boot prompt:
+Reset your board. Press the space bar in the \code{picocom} terminal
+to stop the U-boot countdown. You should then see the U-Boot prompt.
+
+For the version we use in the BeagleBone Black, it's:
 \begin{verbatim}
 U-Boot>
 \end{verbatim}
 
+And for the BeagleBone Black Wireless, it's:
+\begin{verbatim}
+==>
+\end{verbatim}
+
 You can now use U-Boot. Run the \code{help} command to see the available
 commands.
 
-Using the \code{version} command, make sure that you have at least version
-\code{2013.10}\footnote{This will be needed to use the \code{saveenv} command to
+Type the \code{help saveenv} command to make sure that the
+\code{saveenv} command exists. We use it in these labs to
 save your U-Boot environment settings to the boards' eMMC storage.
-Some earlier versions do not support this.}.
+Some earlier versions do not support this.
 
-If you are doing these labs on your own (i.e. without participating to a Bootlin
-course), we ask you to install the U-Boot binary that we compiled and
-tested. See
+If you don't have this command, it's probably because you are doing these labs on your own
+(i.e. without participating to a Bootlin course), we ask you to install the U-Boot binary
+that we compiled and tested. See instructions in
 \url{https://git.bootlin.com/training-materials/tree/lab-data/common/bootloader/beaglebone-black/README.txt}
-file for a simple way to do this.
+or in
+\url{https://git.bootlin.com/training-materials/tree/lab-data/common/bootloader/beaglebone-black-wireless/README.txt}
+for a simple way to do this.
 
 To avoid trouble because of settings applied in previous practical labs,
 we advise you to clear the U-Boot environment variables:
@@ -135,50 +147,47 @@ saveenv
 
 The next step is to configure U-boot and your workstation to let your
 board download files, such as the kernel image and Device Tree Binary
-(DTB), using the TFTP protocol through an Ethernet cable.
-
-To start with, install a TFTP server on your development workstation:
-
-\begin{verbatim}
-sudo apt install tftpd-hpa
-\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.
+(DTB), using the TFTP protocol through an Ethernet connection.
 
-To configure your network interface on the workstation side, click on
-the \code{Network Manager} tasklet on your desktop, and select
-\code{Edit Connections}.
-
-Select the new wired network connection:
+\begin{itemize} 
+\item BeagleBone Black board case: connect your board to your PC
+      through an Ethernet cable given by your instructor.
+      If your computer already has a wired connection
+      to the network, your instructor will provide you with a USB Ethernet
+      adapter.
+\item BeagleBone Black Wireless board case: we will use Ethernet
+      over USB device and therefore will only need the USB device cable
+      is already used to power up the board.
+\end{itemize}
 
-\begin{center}
-\includegraphics[width=5cm]{labs/kernel-board-setup/network-config-2.png}
-\end{center}
+\section{Ethernet configuration on the target}
+Now, let's configure networking in U-Boot:
 
-In the \code{IPv4 Settings} tab, choose the \code{Manual} method
-to 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{itemize}
+  \item \code{ipaddr}: IP address of the board
+  \item \code{serverip}: IP address of the PC host
+\end{itemize}
 
-\begin{center}
-\includegraphics[width=5cm]{labs/kernel-board-setup/network-config-3.png}
-\end{center}
+\begin{verbatim}
+setenv ipaddr 192.168.0.100
+setenv serverip 192.168.0.1
+\end{verbatim}
 
-You can use \code{24} 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 allowed to
-click on the \code{Save} button).
+Of course, make sure that this address belongs to a separate network
+segment from the one of the main company network.
 
-Now, configure the network on the board in U-Boot by setting the \code{ipaddr}
-and \code{serverip} environment variables:
+For the BeagleBone Black Wireless board, we also need to configure
+Ethernet over USB device:
+\begin{itemize}
+  \item \code{ethact}: controls which interface is currently active.
+  \item \code{usbnet_devaddr}: MAC address on the device side
+  \item \code{usbnet_hostaddr}: MAC address on the host side  
+\end{itemize}
 
 \begin{verbatim}
-setenv ipaddr 192.168.0.100
-setenv serverip 192.168.0.1
+setenv ethact usb_ether
+setenv usbnet_devaddr 11:22:33:44:55:02
+setenv usbnet_hostaddr 11:22:33:44:55:01
 \end{verbatim}
 
 Save these settings to the eMMC storage on the board\footnote{
@@ -192,6 +201,40 @@ first partition of the eMMC storage.}:
 saveenv
 \end{verbatim}
 
+\section{Ethernet configuration on the PC host}
+
+To configure your network interface on the workstation side, we need
+to know the name of the network interface connected to your board.
+
+\begin{itemize}
+   \item If you have the BeagleBone Black board, check the name
+      of your PC's Ethernet interface by running the \code{ifconfig -a}
+      command. It should be \code{eth<x>} or \code{eno<x>}.
+   \item If you have the BeagleBone Black Wireless board, you won't
+      be able to see the network interface corresponding to the Ethernet
+      over USB device connection yet, because it's only active when
+      the board turns it on, from U-Boot or from Linux. When this
+      happens, the network interface name will be \code{enx<macaddr>}.
+      Given the value we gave to \code{usbnet_hostaddr}, it will
+      therefore be \code{enx112233445501}.
+\end{itemize}
+
+Then, instead of configuring the host IP address from NetWork Manager's
+graphical interface, let's do it through its command line interface,
+which is so much easier to use:
+
+\begin{verbatim}
+nmcli con add type ethernet ifname enx112233445501 ip4 192.168.0.1/24
+\end{verbatim}
+
+\section{Testing the network connection}
+
+Let's install a TFTP server on your development workstation:
+
+\begin{verbatim}
+sudo apt install tftpd-hpa
+\end{verbatim}
+
 You can then test the TFTP connection.  First, put a small text
 file in \code{/var/lib/tftpboot}. Then, from U-Boot, do:
 
diff --git a/labs/kernel-board-setup/network-config-2.png b/labs/kernel-board-setup/network-config-2.png
deleted file mode 100644
index 6942628..0000000
Binary files a/labs/kernel-board-setup/network-config-2.png and /dev/null differ
diff --git a/labs/kernel-board-setup/network-config-3.png b/labs/kernel-board-setup/network-config-3.png
deleted file mode 100644
index 6b29059..0000000
Binary files a/labs/kernel-board-setup/network-config-3.png and /dev/null differ
diff --git a/labs/kernel-compiling-and-nfs-booting/kernel-compiling-and-nfs-booting.tex b/labs/kernel-compiling-and-nfs-booting/kernel-compiling-and-nfs-booting.tex
index b496868..a111596 100644
--- a/labs/kernel-compiling-and-nfs-booting/kernel-compiling-and-nfs-booting.tex
+++ b/labs/kernel-compiling-and-nfs-booting/kernel-compiling-and-nfs-booting.tex
@@ -44,7 +44,7 @@ Install packages needed for configuring, compiling and booting
 the kernel for your board:
 
 \begin{verbatim}
-sudo apt install qt5-default g++ pkg-config
+sudo apt install qt5-default g++ pkg-config libssl-dev
 \end{verbatim}
 
 \code{qt5-default} and \code{g++} are needed for \code{make xconfig}.
@@ -73,6 +73,14 @@ belongs to. Don't forget to set the \code{ARCH} and
 \code{CROSS_COMPILE} definitions for the \code{arm} platform and to
 use your cross-compiler.
 
+For the BeagleBone Black Wireless board, add the below options:
+\begin{itemize}
+  \item \code{CONFIG_USB_GADGET=y}
+  \item \code{CONFIG_USB_ETH=y}
+  \item \code{CONFIG_USB_ETH_EEM=y}
+  \item \code{CONFIG_USB_ETH_RNDIS=y}
+\end{itemize}
+
 Make sure that this configuration has \code{CONFIG_ROOT_NFS=y} (support
 booting on an NFS exported root directory).
 
@@ -85,7 +93,8 @@ Compile your kernel and generate the Device Tree Binaries (DTBs)
 make -j 4 
 \end{verbatim}
 
-Now, copy the \code{zImage} and \code{am335x-boneblack.dtb} files
+Now, copy the \code{zImage} and \code{am335x-boneblack.dtb}
+or \code{am335x-boneblack-wireless.dtb}files
 to the TFTP server home directory (\code{/var/lib/tftpboot}).
 
 \section{Setting up the NFS server}
@@ -126,11 +135,18 @@ Do this by setting U-boot's \code{bootargs} environment variable (all in
 just one line, pay attention to the \code{O} character, like "OMAP", in
 \code{ttyO0}):
 
+For the BeagleBone Back board:
 \begin{verbatim}
 setenv bootargs root=/dev/nfs rw ip=192.168.0.100 console=ttyO0
   nfsroot=192.168.0.1:/home/<user>/linux-kernel-labs/modules/nfsroot
 \end{verbatim}
 
+For the BeagleBone Back Wireless board:
+\begin{verbatim}
+setenv bootargs root=/dev/nfs rw ip=192.168.0.100:::::sit0 console=ttyO0,115200n8
+  nfsroot=192.168.0.1:/home/<user>/linux-kernel-labs/modules/nfsroot
+\end{verbatim}
+
 Of course, you need to adapt the IP addresses to your exact network
 setup.
 
@@ -155,7 +171,7 @@ tftp 0x81000000 zImage
 You'll also need to download the device tree blob:
 
 \begin{verbatim}
-tftp 0x82000000 am335x-boneblack.dtb
+tftp 0x82000000 <board>.dtb
 \end{verbatim}
 
 Now, boot your kernel:
@@ -203,7 +219,7 @@ environment variable:
 
 {\scriptsize
 \begin{verbatim}
-setenv bootcmd 'tftp 0x81000000 zImage; tftp 0x82000000 am335x-boneblack.dtb; bootz 0x81000000 - 0x82000000'
+setenv bootcmd 'tftp 0x81000000 zImage; tftp 0x82000000 <board>.dtb; bootz 0x81000000 - 0x82000000'
 saveenv
 \end{verbatim}
 }
diff --git a/labs/kernel-i2c-device-model/kernel-i2c-device-model.tex b/labs/kernel-i2c-device-model/kernel-i2c-device-model.tex
index 2ccdb5e..2020983 100644
--- a/labs/kernel-i2c-device-model/kernel-i2c-device-model.tex
+++ b/labs/kernel-i2c-device-model/kernel-i2c-device-model.tex
@@ -17,10 +17,10 @@ device/driver match.
 \section{Setup}
 
 Go to the \code{~/linux-kernel-labs/src/linux} directory. Check out the
-\code{4.9.y} branch.
+\code{4.16.y} branch.
 
 Now create a new \code{nunchuk} branch starting from the
-\code{4.9.y} branch,  for your upcoming work on the nunchuk
+\code{4.16.y} branch,  for your upcoming work on the nunchuk
 driver.
 
 \section{Connecting the nunchuk}
diff --git a/labs/kernel-module-simple/kernel-module-simple.tex b/labs/kernel-module-simple/kernel-module-simple.tex
index c4ce4ee..240b1b8 100644
--- a/labs/kernel-module-simple/kernel-module-simple.tex
+++ b/labs/kernel-module-simple/kernel-module-simple.tex
@@ -102,7 +102,7 @@ As we are going to make changes to the kernel sources, first create a
 special branch for such changes:
 
 \begin{verbatim}
-git checkout 4.9.y
+git checkout 4.16.y
 git checkout -b hello
 \end{verbatim}
 
@@ -147,7 +147,7 @@ from the commits between your branch and another branch, usually the
 one you started from:
 
 \begin{verbatim}
-git format-patch 4.9.y
+git format-patch 4.16.y
 \end{verbatim}
 
 Have a look at the generated file. You can see that its name reused
diff --git a/labs/kernel-serial-iomem/kernel-serial-iomem.tex b/labs/kernel-serial-iomem/kernel-serial-iomem.tex
index 203ef33..cf3db49 100644
--- a/labs/kernel-serial-iomem/kernel-serial-iomem.tex
+++ b/labs/kernel-serial-iomem/kernel-serial-iomem.tex
@@ -22,7 +22,7 @@ is independent from the nunchuk changes, it's best to create a separate
 branch!
 
 \begin{verbatim}
-git checkout 4.9.y
+git checkout 4.16.y
 git checkout -b uart
 \end{verbatim}
 
diff --git a/labs/kernel-sources-download/kernel-sources-download.tex b/labs/kernel-sources-download/kernel-sources-download.tex
index 0713e6f..1bb21fd 100644
--- a/labs/kernel-sources-download/kernel-sources-download.tex
+++ b/labs/kernel-sources-download/kernel-sources-download.tex
@@ -33,7 +33,7 @@ send patches, in particular.
 To begin working with the Linux kernel sources, we need to clone its
 reference git tree, the one managed by Linus Torvalds.
 
-The trouble is you have to download about 1 GB of data!
+The trouble is you have to download more than 1 GB of data!
 
 If you are running this command from home, or if you have very fast
 access to the Internet at work (and if you are not 256 participants in the
@@ -95,7 +95,7 @@ git fetch stable
 \end{verbatim}
 }
 
-As this still represents many git objects to download (163 MB when 4.3 was
+As this still represents many git objects to download (243 MiB when 4.16 was
 the latest version), if you are using an already downloaded git tree,
 your instructor will probably have fetched the {\em stable} branch ahead
 of time for you too. You can check by running:
diff --git a/labs/kernel-sources-exploring/kernel-sources-exploring.tex b/labs/kernel-sources-exploring/kernel-sources-exploring.tex
index 767f746..9808775 100644
--- a/labs/kernel-sources-exploring/kernel-sources-exploring.tex
+++ b/labs/kernel-sources-exploring/kernel-sources-exploring.tex
@@ -26,20 +26,18 @@ cd ~/linux-kernel-labs/src/linux
 git branch -a
 \end{verbatim}
 
-As we will do our labs with the Linux 4.9 stable branch, the remote branch
-we are interested in is \code{remotes/stable/linux-4.9.y} (if this
-branch doesn't exist yet when you run this lab, just continue to work
-with the latest \code{-rc} ("release candidate") version).
+As we will do our labs with the Linux 4.16 stable branch, the remote branch
+we are interested in is \code{remotes/stable/linux-4.16.y}.
 
 First, open the \code{Makefile} file just to check the Linux kernel
 version that you currently have.
 
 Now, let's create a local branch starting from that remote branch:
 \begin{verbatim}
-git checkout -b 4.9.y stable/linux-4.9.y
+git checkout -b 4.16.y stable/linux-4.16.y
 \end{verbatim}
 
-Open \code{Makefile} again and make sure you now have a 4.9.y version.
+Open \code{Makefile} again and make sure you now have a 4.16.y version.
 
 \section{Exploring the sources manually}
 




More information about the training-materials-updates mailing list