[FE training-materials-updates] Finalize first Buildroot lab

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Wed Apr 22 11:04:15 CEST 2015

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

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


commit 2e8e6c52050ddd36a503c931a024ff317b1fe222
Author: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Date:   Wed Apr 22 11:03:52 2015 +0200

    Finalize first Buildroot lab
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>


 labs/buildroot-basic/buildroot-basic.tex | 91 ++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/labs/buildroot-basic/buildroot-basic.tex b/labs/buildroot-basic/buildroot-basic.tex
index a42130b..35efede 100644
--- a/labs/buildroot-basic/buildroot-basic.tex
+++ b/labs/buildroot-basic/buildroot-basic.tex
@@ -306,6 +306,97 @@ Our SD card needs to be formatted in two partitions:
+To achieve this, do the following steps:
+\item Unmount all partitions of your SD card (they are generally
+  automatically mounted by Ubuntu)
+\item Erase the beginning of the SD card to ensure that the existing
+  partitions are not going to be mistakenly detected:\\
+  \code{sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=16}.
+\item Create the two partitions. We'll use the \code{cfdisk} tool for
+  that:\\
+  \code{sudo cfdisk /dev/mmcblk0}.\\
+  Create a first small partition (16 MB or 32 MB) with type \code{e}
+  ({\em W95 FAT16}) and mark it bootable. Create a second partition
+  with the rest of the available space, with type \code{83} ({\em
+    Linux}).
+\item Format the first partition as a {\em FAT16} filesystem:\\
+  \code{sudo mkfs.vfat -F 16 -n boot /dev/mmcblk0p1}.
+\item Format the second partition as an {\em ext4} filesystem:\\
+  \code{sudo mkfs.ext4 -L rootfs -E nodiscard /dev/mmcblk0p2}.
+Remove the SD card and insert it again, the two partitions should be
+mounted automatically, in \code{/media/<user>/boot} and
+Now everything should be ready. Hopefully by that time the Buildroot
+build should have completed. If not, wait a little bit more.
 \section{Flash the system}
+Once Buildroot has finished building the system, it's time to put it
+on the SD card:
+\item Copy the \code{MLO}, \code{u-boot.img}, \code{zImage} and
+  \code{am335x-boneblack.dtb} files from \code{output/images/} to the
+  \code{boot} partition of the SD card.
+\item Extract the \code{rootfs.tar} file to the \code{rootfs}
+  partition of the SD card, using:\\
+  \code{sudo tar -C /media/<user>/rootfs/ -xf output/images/rootfs.tar}.
+\item Create a file named \code{uEnv.txt} in the \code{boot}
+  partition. This file should contain the following lines:
+uenvcmd=run loadimage;run loadramdisk;run findfdt;run loadfdt;run mmcloados
+  These lines teach the U-Boot bootloader how to load the Linux kernel
+  image and the Device Tree, before booting the kernel.
 \section{Boot the system}
+Insert the SD card in the BeagleBone Black. Push the S2 button
+(located near the USB host connector) and plug the USB power cable
+while holding S2. Pushing S2 forces the BeagleBone Black to boot from
+the SD card instead of from the internal eMMC.
+You should see your system booting. Make sure that the U-Boot SPL and
+U-Boot version and build dates match with the current date. Do the
+same check for the Linux kernel.
+Login as \code{root} on the BeagleBone Black, and explore the system.
+\section{Explore the build log}
+Back to your build machine, since we redirected the build output to a
+file called \code{build.log}, we can now have a look at it to see what
+happened. Since the Buildroot build is quite verbose, Buildroot prints
+before each important step a message prefixed by the \code{>>>}
+sign. So to get an overall idea of what the build did, you can run:
+grep ">>>" build.log
+You see the different packages between downloaded, extracted, patched,
+configured, built and installed.
+Feel free to explore the \code{output/} directory as well.

More information about the training-materials-updates mailing list