[bootlin/training-materials updates] master: Embedded Linux: replace at91bootstrap by U-Boot SPL (e1e3a9a2)
Michael Opdenacker
michael.opdenacker at bootlin.com
Tue Sep 22 16:56:32 CEST 2020
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/e1e3a9a2ef5d3e99b7eb055ec3665e376422871a
>---------------------------------------------------------------
commit e1e3a9a2ef5d3e99b7eb055ec3665e376422871a
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date: Tue Sep 22 16:56:32 2020 +0200
Embedded Linux: replace at91bootstrap by U-Boot SPL
- In both slides and labs
- Switch to U-Boot 2020.07
- This also fixes the issue with UBI partitions
in U-Boot
Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>
>---------------------------------------------------------------
e1e3a9a2ef5d3e99b7eb055ec3665e376422871a
common/common.sty | 1 +
common/omap-boot.dia | 88 +++++++-----
lab-data/embedded-linux/bootloader/data/boot.bin | 1 -
.../sama5d3_xplained-nandflashboot-uboot-3.9.1.bin | Bin 15200 -> 0 bytes
.../bootloader/data/u-boot-2020.04.bin | Bin 744116 -> 0 bytes
.../bootloader/data/u-boot-2020.07.bin | Bin 0 -> 674856 bytes
.../bootloader/data/u-boot-spl-2020.07.bin | Bin 0 -> 59606 bytes
.../embedded-linux/bootloader/data/u-boot-spl.bin | 1 +
lab-data/embedded-linux/bootloader/data/u-boot.bin | 2 +-
.../sysdev-block-filesystems.tex | 24 ++--
labs/sysdev-flash-filesystems/flash-map.dia | 9 +-
.../sysdev-flash-filesystems.tex | 14 --
labs/sysdev-kernel-cross-compiling/flash-map.dia | 59 +++++++-
labs/sysdev-u-boot/boot.log.tex | 24 +---
labs/sysdev-u-boot/flash-map.dia | 70 ++++++++--
labs/sysdev-u-boot/sysdev-u-boot.tex | 150 +++++++--------------
slides/sysdev-bootloaders-sequence/at91-boot.dia | 18 +--
.../sysdev-bootloaders-sequence.tex | 4 +-
.../sysdev-bootloaders-u-boot.tex | 9 +-
19 files changed, 258 insertions(+), 216 deletions(-)
diff --git a/common/common.sty b/common/common.sty
index b069cd46..488d5016 100644
--- a/common/common.sty
+++ b/common/common.sty
@@ -3,6 +3,7 @@
% Generic Elixir commands
\newcommand\projdir[2]{\href{https://elixir.bootlin.com/#1/latest/source/#2/}{\codelink{#2/}}}
\newcommand\projfile[2]{\href{https://elixir.bootlin.com/#1/latest/source/#2}{\codelink{#2}}}
+\newcommand\projsym[2]{\href{https://elixir.bootlin.com/#1/latest/ident/#2}{\codelink{#2}}}
% Linux Elixir commands
\newcommand\kfunc[1]{\href{https://elixir.bootlin.com/linux/latest/ident/#1}{\codelink{#1()}}}
diff --git a/common/omap-boot.dia b/common/omap-boot.dia
index 5d3b2e0f..8bfd6c29 100644
--- a/common/omap-boot.dia
+++ b/common/omap-boot.dia
@@ -2,10 +2,10 @@
<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
<dia:diagramdata>
<dia:attribute name="background">
- <dia:color val="#ffffff"/>
+ <dia:color val="#ffffffff"/>
</dia:attribute>
<dia:attribute name="pagebreak">
- <dia:color val="#000099"/>
+ <dia:color val="#000099ff"/>
</dia:attribute>
<dia:attribute name="paper">
<dia:composite type="paper">
@@ -37,6 +37,9 @@
</dia:attribute>
<dia:attribute name="grid">
<dia:composite type="grid">
+ <dia:attribute name="dynamic">
+ <dia:boolean val="true"/>
+ </dia:attribute>
<dia:attribute name="width_x">
<dia:real val="1"/>
</dia:attribute>
@@ -53,7 +56,7 @@
</dia:composite>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#d8e5e5"/>
+ <dia:color val="#d8e5e5ff"/>
</dia:attribute>
<dia:attribute name="guides">
<dia:composite type="guides">
@@ -61,8 +64,27 @@
<dia:attribute name="vguides"/>
</dia:composite>
</dia:attribute>
+ <dia:attribute name="display">
+ <dia:composite type="display">
+ <dia:attribute name="antialiased">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="snap-to-grid">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="snap-to-object">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="show-grid">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ <dia:attribute name="show-connection-points">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ </dia:composite>
+ </dia:attribute>
</dia:diagramdata>
- <dia:layer name="Arrière-plan" visible="true" active="true">
+ <dia:layer name="Arrière-plan" visible="true" connectable="true" active="true">
<dia:object type="Standard - Box" version="0" id="O0">
<dia:attribute name="obj_pos">
<dia:point val="22,2"/>
@@ -83,10 +105,10 @@
<dia:real val="0.10000000149011612"/>
</dia:attribute>
<dia:attribute name="border_color">
- <dia:color val="#5cacff"/>
+ <dia:color val="#5cacffff"/>
</dia:attribute>
<dia:attribute name="inner_color">
- <dia:color val="#add8e6"/>
+ <dia:color val="#add8e6ff"/>
</dia:attribute>
<dia:attribute name="show_background">
<dia:boolean val="true"/>
@@ -115,10 +137,10 @@
<dia:real val="0.10000000149011612"/>
</dia:attribute>
<dia:attribute name="border_color">
- <dia:color val="#5cacff"/>
+ <dia:color val="#5cacffff"/>
</dia:attribute>
<dia:attribute name="inner_color">
- <dia:color val="#add8e6"/>
+ <dia:color val="#add8e6ff"/>
</dia:attribute>
<dia:attribute name="show_background">
<dia:boolean val="true"/>
@@ -147,10 +169,10 @@
<dia:real val="0.10000000149011612"/>
</dia:attribute>
<dia:attribute name="border_color">
- <dia:color val="#5cacff"/>
+ <dia:color val="#5cacffff"/>
</dia:attribute>
<dia:attribute name="inner_color">
- <dia:color val="#add8e6"/>
+ <dia:color val="#add8e6ff"/>
</dia:attribute>
<dia:attribute name="show_background">
<dia:boolean val="true"/>
@@ -179,10 +201,10 @@
<dia:real val="0.10000000149011612"/>
</dia:attribute>
<dia:attribute name="border_color">
- <dia:color val="#5cacff"/>
+ <dia:color val="#5cacffff"/>
</dia:attribute>
<dia:attribute name="inner_color">
- <dia:color val="#add8e6"/>
+ <dia:color val="#add8e6ff"/>
</dia:attribute>
<dia:attribute name="show_background">
<dia:boolean val="true"/>
@@ -196,7 +218,7 @@
<dia:point val="27.5,6.04102"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="27.1382,5.99102;27.8618,9.1118"/>
+ <dia:rectangle val="27.1382,5.99102;27.8618,9.05"/>
</dia:attribute>
<dia:attribute name="conn_endpoints">
<dia:point val="27.5,6.04102"/>
@@ -224,7 +246,7 @@
<dia:point val="27.5,13"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="27.1382,12.95;27.8618,16.0708"/>
+ <dia:rectangle val="27.1382,12.95;27.8618,16.009"/>
</dia:attribute>
<dia:attribute name="conn_endpoints">
<dia:point val="27.5,13"/>
@@ -252,7 +274,7 @@
<dia:point val="27.5,20"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="27.1382,19.95;27.8618,23.1118"/>
+ <dia:rectangle val="27.1382,19.95;27.8618,23.05"/>
</dia:attribute>
<dia:attribute name="conn_endpoints">
<dia:point val="27.5,20"/>
@@ -280,7 +302,7 @@
<dia:point val="27.5,3.44"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="25.3363,2.6725;29.6638,3.62"/>
+ <dia:rectangle val="25.3,2.47988;29.7,3.69146"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -297,7 +319,7 @@
<dia:point val="27.5,3.44"/>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#000000"/>
+ <dia:color val="#000000ff"/>
</dia:attribute>
<dia:attribute name="alignment">
<dia:enum val="1"/>
@@ -313,12 +335,12 @@
<dia:point val="27.5,10.38"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="23.1713,9.6125;31.8287,10.56"/>
+ <dia:rectangle val="25.1038,9.38959;29.9265,10.692"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
<dia:attribute name="string">
- <dia:string>#X-Loader / U-Boot 1st#</dia:string>
+ <dia:string>#U-Boot SPL#</dia:string>
</dia:attribute>
<dia:attribute name="font">
<dia:font family="Latin Modern Sans" style="80" name="Courier"/>
@@ -330,7 +352,7 @@
<dia:point val="27.5,10.38"/>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#000000"/>
+ <dia:color val="#000000ff"/>
</dia:attribute>
<dia:attribute name="alignment">
<dia:enum val="1"/>
@@ -346,12 +368,12 @@
<dia:point val="27.5,17.42"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="25.2175,16.6525;29.7825,17.6"/>
+ <dia:rectangle val="26.0613,16.4296;28.969,17.732"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
<dia:attribute name="string">
- <dia:string>#U-Boot 2nd#</dia:string>
+ <dia:string>#U-Boot#</dia:string>
</dia:attribute>
<dia:attribute name="font">
<dia:font family="Latin Modern Sans" style="80" name="Courier"/>
@@ -363,7 +385,7 @@
<dia:point val="27.5,17.42"/>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#000000"/>
+ <dia:color val="#000000ff"/>
</dia:attribute>
<dia:attribute name="alignment">
<dia:enum val="1"/>
@@ -379,7 +401,7 @@
<dia:point val="27.5,24.46"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="24.9363,23.6925;30.0638,24.64"/>
+ <dia:rectangle val="25.0437,23.4999;29.9562,24.7115"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -396,7 +418,7 @@
<dia:point val="27.5,24.46"/>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#000000"/>
+ <dia:color val="#000000ff"/>
</dia:attribute>
<dia:attribute name="alignment">
<dia:enum val="1"/>
@@ -412,7 +434,7 @@
<dia:point val="27.5,4.55"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="25.1337,3.885;29.8663,5.62472"/>
+ <dia:rectangle val="25.225,3.70322;29.775,5.69396"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -430,7 +452,7 @@ in the CPU#</dia:string>
<dia:point val="27.5,4.55"/>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#000000"/>
+ <dia:color val="#000000ff"/>
</dia:attribute>
<dia:attribute name="alignment">
<dia:enum val="1"/>
@@ -446,7 +468,7 @@ in the CPU#</dia:string>
<dia:point val="27.5,11.65"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="23.9088,10.985;31.0913,12.7247"/>
+ <dia:rectangle val="24.0113,10.8032;30.9888,12.794"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -464,7 +486,7 @@ runs from SRAM#</dia:string>
<dia:point val="27.5,11.65"/>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#000000"/>
+ <dia:color val="#000000ff"/>
</dia:attribute>
<dia:attribute name="alignment">
<dia:enum val="1"/>
@@ -480,7 +502,7 @@ runs from SRAM#</dia:string>
<dia:point val="27.5,18.65"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="23.9088,17.985;31.0913,19.7247"/>
+ <dia:rectangle val="24.0113,17.8032;30.9888,19.794"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -498,7 +520,7 @@ runs from SDRAM#</dia:string>
<dia:point val="27.5,18.65"/>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#000000"/>
+ <dia:color val="#000000ff"/>
</dia:attribute>
<dia:attribute name="alignment">
<dia:enum val="1"/>
@@ -514,7 +536,7 @@ runs from SDRAM#</dia:string>
<dia:point val="27.5,25.65"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="22.745,24.985;32.255,26.7247"/>
+ <dia:rectangle val="22.9112,24.8032;32.0887,26.794"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -532,7 +554,7 @@ runs from SDRAM#</dia:string>
<dia:point val="27.5,25.65"/>
</dia:attribute>
<dia:attribute name="color">
- <dia:color val="#000000"/>
+ <dia:color val="#000000ff"/>
</dia:attribute>
<dia:attribute name="alignment">
<dia:enum val="1"/>
diff --git a/lab-data/embedded-linux/bootloader/data/boot.bin b/lab-data/embedded-linux/bootloader/data/boot.bin
deleted file mode 120000
index eb9fff75..00000000
--- a/lab-data/embedded-linux/bootloader/data/boot.bin
+++ /dev/null
@@ -1 +0,0 @@
-sama5d3_xplained-nandflashboot-uboot-3.9.1.bin
\ No newline at end of file
diff --git a/lab-data/embedded-linux/bootloader/data/sama5d3_xplained-nandflashboot-uboot-3.9.1.bin b/lab-data/embedded-linux/bootloader/data/sama5d3_xplained-nandflashboot-uboot-3.9.1.bin
deleted file mode 100644
index 366bdaa9..00000000
Binary files a/lab-data/embedded-linux/bootloader/data/sama5d3_xplained-nandflashboot-uboot-3.9.1.bin and /dev/null differ
diff --git a/lab-data/embedded-linux/bootloader/data/u-boot-2020.04.bin b/lab-data/embedded-linux/bootloader/data/u-boot-2020.04.bin
deleted file mode 100644
index 3adb4d2d..00000000
Binary files a/lab-data/embedded-linux/bootloader/data/u-boot-2020.04.bin and /dev/null differ
diff --git a/lab-data/embedded-linux/bootloader/data/u-boot-2020.07.bin b/lab-data/embedded-linux/bootloader/data/u-boot-2020.07.bin
new file mode 100644
index 00000000..999aea76
Binary files /dev/null and b/lab-data/embedded-linux/bootloader/data/u-boot-2020.07.bin differ
diff --git a/lab-data/embedded-linux/bootloader/data/u-boot-spl-2020.07.bin b/lab-data/embedded-linux/bootloader/data/u-boot-spl-2020.07.bin
new file mode 100644
index 00000000..f5ac821d
Binary files /dev/null and b/lab-data/embedded-linux/bootloader/data/u-boot-spl-2020.07.bin differ
diff --git a/lab-data/embedded-linux/bootloader/data/u-boot-spl.bin b/lab-data/embedded-linux/bootloader/data/u-boot-spl.bin
new file mode 120000
index 00000000..7ebb2321
--- /dev/null
+++ b/lab-data/embedded-linux/bootloader/data/u-boot-spl.bin
@@ -0,0 +1 @@
+u-boot-spl-2020.07.bin
\ No newline at end of file
diff --git a/lab-data/embedded-linux/bootloader/data/u-boot.bin b/lab-data/embedded-linux/bootloader/data/u-boot.bin
index 06404ee2..fec1e7a2 120000
--- a/lab-data/embedded-linux/bootloader/data/u-boot.bin
+++ b/lab-data/embedded-linux/bootloader/data/u-boot.bin
@@ -1 +1 @@
-u-boot-2020.04.bin
\ No newline at end of file
+u-boot-2020.07.bin
\ No newline at end of file
diff --git a/labs/sysdev-block-filesystems/sysdev-block-filesystems.tex b/labs/sysdev-block-filesystems/sysdev-block-filesystems.tex
index 8285387e..74223b93 100644
--- a/labs/sysdev-block-filesystems/sysdev-block-filesystems.tex
+++ b/labs/sysdev-block-filesystems/sysdev-block-filesystems.tex
@@ -218,25 +218,29 @@ Which will load the file named \code{filename} from the first
partition of the device handled by the first MMC controller to the
system memory at the address \code{0x21000000}.
-\section{Going further}
+\section{Booting U-Boot from the SD card}
+
+At this point our board still uses U-Boot SPL and U-Boot
+stored in NAND flash.
-At this point our board still uses the bootloaders
-(\code{at91bootstrap} and \code{U-Boot}) stored in the NAND flash.
Let's try to have everything on our SD card.
The ROM code can load the first stage bootloader from an MMC or SD
card, from a file named \code{boot.bin} located in the first FAT
-partition. U-Boot will be stored as \code{u-boot.bin}.
+partition. U-Boot will be stored as \code{u-boot.img}.
-First, copy your U-Boot environment settings
-(\code{bootargs} and \code{bootcmd}) from the environment in NAND
+First, using the \code{printenv} command, copy your U-Boot
+environment settings from the environment in NAND
flash to a text file, so that you will be able to restore then
on the new environment that will be stored in the FAT partition.
-So, recompile \code{at91bootstrap}
-to support booting from an SD card.
Then recompile U-Boot after reconfiguring it with its MMC configuration
(we previously used the configuration for running from NAND flash).
+Then, copy the \code{spl/boot.bin} and \code{u-boot.img} files to
+the first partition of the SD card.
+
+Make sure your newly compiled SPL and U-Boot boot well. Check
+the compile dates to make sure that the right binaries are executed.
+
Restore \code{bootargs} and \code{bootcmd} as defined previously
-and test that you're booting with the bootstrap and bootloader
-that you've just compiled.
+and make sure that the whole system still boots fine.
diff --git a/labs/sysdev-flash-filesystems/flash-map.dia b/labs/sysdev-flash-filesystems/flash-map.dia
index a6f6decb..c9d2215c 100644
--- a/labs/sysdev-flash-filesystems/flash-map.dia
+++ b/labs/sysdev-flash-filesystems/flash-map.dia
@@ -335,14 +335,13 @@
<dia:point val="17.5894,4.5"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="16.8644,3.23184;18.3144,5.76816"/>
+ <dia:rectangle val="16.6057,3.59673;18.5966,5.40327"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
<dia:attribute name="string">
- <dia:string>#AT91
-Boot
-strap#</dia:string>
+ <dia:string>#U-Boot
+SPL#</dia:string>
</dia:attribute>
<dia:attribute name="font">
<dia:font family="Latin Modern Sans" style="0" name="Courier"/>
@@ -351,7 +350,7 @@ strap#</dia:string>
<dia:real val="0.80000000000000004"/>
</dia:attribute>
<dia:attribute name="pos">
- <dia:point val="17.5894,3.9704"/>
+ <dia:point val="17.5894,4.3587"/>
</dia:attribute>
<dia:attribute name="color">
<dia:color val="#000000ff"/>
diff --git a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
index b42df016..aac5ef0f 100644
--- a/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
+++ b/labs/sysdev-flash-filesystems/sysdev-flash-filesystems.tex
@@ -36,20 +36,6 @@ Which gives the following layout:
\includegraphics[width=\textwidth]{labs/sysdev-flash-filesystems/flash-map.pdf}
\end{center}
-\section{U-Boot issue work-around}
-
-{\em {\bf Caution:} recent mainline U-Boot versions have issues
-using the UBI image that we produce during this lab.
-
-So, to do this lab before we find a better solution, you can compile U-Boot 2018.01
-with the MMC configuration and boot it from MMC.}
-
-Before you deploy this version, use \code{printenv} to your U-Boot
-environment in NAND flash, and copy the settings to a file on your
-workstation. This will help you to restore your environment settings
-after switching to U-Boot 2018.01, which will have a default environment
-again (because it stores its environment on the MMC card).
-
\section{Enabling NAND flash and filesystems}
First, make sure your kernel has support for UBI and UBIFS, and also
diff --git a/labs/sysdev-kernel-cross-compiling/flash-map.dia b/labs/sysdev-kernel-cross-compiling/flash-map.dia
index 467a4cab..db702c63 100644
--- a/labs/sysdev-kernel-cross-compiling/flash-map.dia
+++ b/labs/sysdev-kernel-cross-compiling/flash-map.dia
@@ -335,14 +335,13 @@
<dia:point val="17.5894,4.5"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="16.8644,3.23184;18.3144,5.76816"/>
+ <dia:rectangle val="16.6057,3.63184;18.5732,5.36816"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
<dia:attribute name="string">
- <dia:string>#AT91
-Boot
-strap#</dia:string>
+ <dia:string>#U-Boot
+SPL#</dia:string>
</dia:attribute>
<dia:attribute name="font">
<dia:font family="Latin Modern Sans" style="0" name="Courier"/>
@@ -351,7 +350,7 @@ strap#</dia:string>
<dia:real val="0.80000000000000004"/>
</dia:attribute>
<dia:attribute name="pos">
- <dia:point val="17.5894,3.9704"/>
+ <dia:point val="17.5894,4.3704"/>
</dia:attribute>
<dia:attribute name="color">
<dia:color val="#000000ff"/>
@@ -839,7 +838,7 @@ env#</dia:string>
<dia:point val="48.5001,6.5"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="48.4711,6.47493;48.5252,8.0007"/>
+ <dia:rectangle val="48.471,6.47493;48.5252,8.00071"/>
</dia:attribute>
<dia:attribute name="conn_endpoints">
<dia:point val="48.5001,6.5"/>
@@ -855,5 +854,53 @@ env#</dia:string>
<dia:connection handle="0" to="O20" connection="7"/>
</dia:connections>
</dia:object>
+ <dia:object type="Standard - Line" version="0" id="O26">
+ <dia:attribute name="obj_pos">
+ <dia:point val="48.5001,2.5"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="48.45,2.44994;54.5273,2.55775"/>
+ </dia:attribute>
+ <dia:attribute name="conn_endpoints">
+ <dia:point val="48.5001,2.5"/>
+ <dia:point val="54.4773,2.50769"/>
+ </dia:attribute>
+ <dia:attribute name="numcp">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:attribute name="line_color">
+ <dia:color val="#868686ff"/>
+ </dia:attribute>
+ <dia:attribute name="line_style">
+ <dia:enum val="4"/>
+ </dia:attribute>
+ <dia:connections>
+ <dia:connection handle="0" to="O20" connection="2"/>
+ </dia:connections>
+ </dia:object>
+ <dia:object type="Standard - Line" version="0" id="O27">
+ <dia:attribute name="obj_pos">
+ <dia:point val="48.5001,6.5"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="48.4499,6.43266;54.5354,6.55014"/>
+ </dia:attribute>
+ <dia:attribute name="conn_endpoints">
+ <dia:point val="48.5001,6.5"/>
+ <dia:point val="54.4853,6.48281"/>
+ </dia:attribute>
+ <dia:attribute name="numcp">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:attribute name="line_color">
+ <dia:color val="#868686ff"/>
+ </dia:attribute>
+ <dia:attribute name="line_style">
+ <dia:enum val="4"/>
+ </dia:attribute>
+ <dia:connections>
+ <dia:connection handle="0" to="O20" connection="7"/>
+ </dia:connections>
+ </dia:object>
</dia:layer>
</dia:diagram>
diff --git a/labs/sysdev-u-boot/boot.log.tex b/labs/sysdev-u-boot/boot.log.tex
index 831a107a..bdc4e33a 100644
--- a/labs/sysdev-u-boot/boot.log.tex
+++ b/labs/sysdev-u-boot/boot.log.tex
@@ -1,17 +1,11 @@
\begin{verbatim}
-AT91Bootstrap 3.9.1 (Sun May 3 08:10:48 CEST 2020)
-
-NAND: ONFI flash detected
-NAND: Manufacturer ID: 0x2c Chip ID: 0xda
-NAND: Page Bytes: 2048, Spare Bytes: 64
-NAND: ECC Correctability Bits: 4, ECC Sector Bytes: 512
-NAND: Disable On-Die ECC
-NAND: Initialize PMECC params, cap: 4, sector: 512
-NAND: Image: Copy 0xc0000 bytes from 0x40000 to 0x26f00000
-NAND: Done to load image
+RomBOOT
+<debug_uart>
+U-Boot SPL 2020.07 (Sep 17 2020 - 21:29:14 +0200)
+Trying to boot from NAND
<debug_uart>
-U-Boot 2020.04 (May 03 2020 - 08:47:45 +0200)
+U-Boot 2020.07 (Sep 17 2020 - 21:29:14 +0200)
CPU: SAMA5D36
Crystal frequency: 12 MHz
@@ -20,16 +14,12 @@ Master clock : 132 MHz
DRAM: 256 MiB
NAND: 256 MiB
MMC: Atmel mci: 0, Atmel mci: 1
-Loading Environment from NAND... *** Warning - bad CRC, using default environment
-
+Loading Environment from NAND... OK
In: serial at ffffee00
Out: serial at ffffee00
Err: serial at ffffee00
-Net:
-Error: ethernet at f0028000 address not set.
-
+Net: eth0: ethernet at f0028000
Error: ethernet at f802c000 address not set.
-No ethernet found.
Hit any key to stop autoboot: 0
\end{verbatim}
diff --git a/labs/sysdev-u-boot/flash-map.dia b/labs/sysdev-u-boot/flash-map.dia
index ce120822..deba198e 100644
--- a/labs/sysdev-u-boot/flash-map.dia
+++ b/labs/sysdev-u-boot/flash-map.dia
@@ -152,7 +152,7 @@
<dia:point val="19.505,8.5"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="18.8138,8.30047;20.1963,8.69953"/>
+ <dia:rectangle val="18.8137,8.30047;20.1962,8.69953"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -260,11 +260,11 @@
<dia:point val="25.8027,6.5"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="25.7774,6.47472;25.8457,8.10919"/>
+ <dia:rectangle val="25.7603,6.47473;25.828,8.09402"/>
</dia:attribute>
<dia:attribute name="conn_endpoints">
<dia:point val="25.8027,6.5"/>
- <dia:point val="25.8204,8.08391"/>
+ <dia:point val="25.7856,8.06875"/>
</dia:attribute>
<dia:attribute name="numcp">
<dia:int val="1"/>
@@ -314,11 +314,11 @@
<dia:point val="28.8107,6.5"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="28.7649,6.47468;28.8361,8.10923"/>
+ <dia:rectangle val="28.7856,6.475;28.8357,8.06875"/>
</dia:attribute>
<dia:attribute name="conn_endpoints">
<dia:point val="28.8107,6.5"/>
- <dia:point val="28.7903,8.08391"/>
+ <dia:point val="28.8106,8.04375"/>
</dia:attribute>
<dia:attribute name="numcp">
<dia:int val="1"/>
@@ -335,13 +335,13 @@
<dia:point val="17.9959,4.5"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="16.6721,3.63184;19.3196,5.36816"/>
+ <dia:rectangle val="17.0121,3.59673;19.0031,5.40327"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
<dia:attribute name="string">
- <dia:string>#AT91
-Bootstrap#</dia:string>
+ <dia:string>#U-Boot
+SPL#</dia:string>
</dia:attribute>
<dia:attribute name="font">
<dia:font family="Latin Modern Sans" style="0" name="Courier"/>
@@ -350,7 +350,7 @@ Bootstrap#</dia:string>
<dia:real val="0.80000000000000004"/>
</dia:attribute>
<dia:attribute name="pos">
- <dia:point val="17.9959,4.3704"/>
+ <dia:point val="17.9959,4.3587"/>
</dia:attribute>
<dia:attribute name="color">
<dia:color val="#000000ff"/>
@@ -570,11 +570,11 @@ env#</dia:string>
<dia:point val="31.8107,6.5"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="31.7854,6.47467;31.8561,8.02086"/>
+ <dia:rectangle val="31.7856,6.47488;31.8434,8.04564"/>
</dia:attribute>
<dia:attribute name="conn_endpoints">
<dia:point val="31.8107,6.5"/>
- <dia:point val="31.8308,7.99552"/>
+ <dia:point val="31.8183,8.02052"/>
</dia:attribute>
<dia:attribute name="numcp">
<dia:int val="1"/>
@@ -619,5 +619,53 @@ env#</dia:string>
<dia:enum val="2"/>
</dia:attribute>
</dia:object>
+ <dia:object type="Standard - Line" version="0" id="O18">
+ <dia:attribute name="obj_pos">
+ <dia:point val="31.8107,2.5"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="31.7605,2.43733;35.6189,2.55017"/>
+ </dia:attribute>
+ <dia:attribute name="conn_endpoints">
+ <dia:point val="31.8107,2.5"/>
+ <dia:point val="35.5688,2.4875"/>
+ </dia:attribute>
+ <dia:attribute name="numcp">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:attribute name="line_color">
+ <dia:color val="#868686ff"/>
+ </dia:attribute>
+ <dia:attribute name="line_style">
+ <dia:enum val="4"/>
+ </dia:attribute>
+ <dia:connections>
+ <dia:connection handle="0" to="O14" connection="2"/>
+ </dia:connections>
+ </dia:object>
+ <dia:object type="Standard - Line" version="0" id="O19">
+ <dia:attribute name="obj_pos">
+ <dia:point val="31.8107,6.5"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="31.7606,6.44992;35.6813,6.55633"/>
+ </dia:attribute>
+ <dia:attribute name="conn_endpoints">
+ <dia:point val="31.8107,6.5"/>
+ <dia:point val="35.6313,6.50625"/>
+ </dia:attribute>
+ <dia:attribute name="numcp">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:attribute name="line_color">
+ <dia:color val="#868686ff"/>
+ </dia:attribute>
+ <dia:attribute name="line_style">
+ <dia:enum val="4"/>
+ </dia:attribute>
+ <dia:connections>
+ <dia:connection handle="0" to="O14" connection="7"/>
+ </dia:connections>
+ </dia:object>
</dia:layer>
</dia:diagram>
diff --git a/labs/sysdev-u-boot/sysdev-u-boot.tex b/labs/sysdev-u-boot/sysdev-u-boot.tex
index 3ca4f10e..fe23d585 100644
--- a/labs/sysdev-u-boot/sysdev-u-boot.tex
+++ b/labs/sysdev-u-boot/sysdev-u-boot.tex
@@ -10,7 +10,7 @@ very specific to the hardware platform. There are usually two cases:
\begin{itemize}
\item The processor offers nothing to ease the installation of the
- bootloader, in which case the JTAG has to be used to initialize
+ bootloader, in which case a JTAG interface has to be used to initialize
flash storage and write the bootloader code to flash. Detailed
knowledge of the hardware is of course required to perform these
operations.
@@ -89,12 +89,12 @@ through the serial line.
If you wish to exit \code{picocom}, press \code{[Ctrl][a]} followed by
\code{[Ctrl][x]}.
-\section{AT91Bootstrap Setup}
+\section{Bootloader setup}
The boot process is done in two steps with the ROM monitor trying to
-execute a first piece of software, called \em{AT91Bootstrap}, from
-its internal SRAM, that will initialize the DRAM, load \em{U-Boot}
-that will in turn load Linux and execute it.
+execute a first piece of software, called \em{U-Boot Single Program
+Loader (U-Boot SPL)}, from its internal SRAM. It will initialize the
+DRAM, load \em{U-Boot} that will in turn load Linux and execute it.
As far as bootloaders are concerned, the layout of the NAND flash will
look like:
@@ -105,96 +105,25 @@ look like:
\begin{itemize}
\item Offset \code{0x0} for the first stage bootloader is dictated by
- the hardware: the ROM code of the SAMA5D3 looks for a bootloader at
- offset \code{0x0} in the NAND flash.
+ the hardware: the ROM code of the SAMA5D3 looks for a first stage
+ bootloader at offset \code{0x0} in the NAND flash.
\item Offset \code{0x40000} for the second stage bootloader is decided
- by the first stage bootloader. This can be changed by changing the
- AT91Bootstrap configuration.
+ by the first stage bootloader. This can be changed modifying the
+ value of \projsym{u-boot}{CONFIG_SYS_NAND_U_BOOT_OFFS} in
+ \projfile{u-boot}{include/configs/sama5d3_xplained.h} in U-Boot
+ sources.
\item Offset \code{0x140000} of the U-Boot environment is decided by
- U-Boot. This can be changed by modifying the U-Boot configuration.
+ U-Boot's configuration (\projsym{u-boot}{CONFIG_ENV_OFFSET}).
\end{itemize}
-The first item to compile is AT91Bootstrap that you can fetch from
-Microchip's GitHub account:
-
-\begin{verbatim}
-git clone https://github.com/linux4sam/at91bootstrap.git
-cd at91bootstrap
-git checkout v3.9.1
-\end{verbatim}
-
-Then, we first need to configure the build system for our setup. We're
-going to need a few pieces of information for this:
-
-\begin{itemize}
-\item Which board you want to run AT91Bootstrap on
-\item Which device should AT91Bootstrap will be stored on
-\item What component you want AT91Boostrap to load
-\end{itemize}
-
-You can get the list of the supported boards by listing the
-\code{board} directory. You'll see that in each of these folders, we
-have a bunch of \code{defconfig} files, that are the supported
-combinations. In our case, using the Atmel SAMA5D3 Xplained
-board, we will load U-Boot, from NAND flash on
-(\code{nf} in the \code{defconfig} file names).
-
-After finding the right \code{defconfig} file, load it using
-\code{make <defconfig_filename>} (just the file name, without
-the directory part).
-
-In recent versions of AT91Bootstrap, you can now run \code{make
-menuconfig} to explore options available in this program.
-
-The next thing to do is to specify the cross-compiler prefix
-(the part before \code{gcc} in the cross-compiler executable name):
-
-\begin{verbatim}
-export CROSS_COMPILE=arm-linux-
-\end{verbatim}
-
-Last but not least, install the \code{python} package
-that the Makefile for AT91Bootstrap will try to invoke.
-
-You can now start compiling using \code{make}\footnote{You can
-speed up the compiling by using the \code{-jX} option with
-\code{make}, where X is the number of parallel jobs used for
-compiling. Twice the number of CPU cores is a good value.}.
-
-At the end of the compilation, you should have a file called
-\code{sama5d3_xplained-nandflashboot-uboot-*.bin}, and a \code{boot.bin}
-symbolic link to this file, in the \code{binaries} folder.
-
-In order to flash it, we need to do a few things. First, remove the
-\code{NAND CS} jumper on the board. It's next to the pin header
-closest to the Micro-USB plug. Now, press the \code{RESET} button.
-On the serial port, you should see \code{RomBoot}. You should also
-see that a \code{/dev/ttyACM0} device file has appeared.
-
-Put the jumper back.
-
-Getting back to the \code{bootloader} directory, use \code{sam-ba} to erase
-NAND flash before writing images to it:
-
-\begin{verbatim}
-./sam-ba_3.3.1/sam-ba -p serial -b sama5d3-xplained -a nandflash -c erase
-\end{verbatim}
-
-Then flash the at91bootstrap binary:
-
-\begin{verbatim}
-./sam-ba_3.3.1/sam-ba -p serial -b sama5d3-xplained -a nandflash \
--c writeboot:at91bootstrap/binaries/boot.bin
-\end{verbatim}
-
-\section{U-Boot setup}
+\section{Configuring and compiling U-Boot}
Get U-Boot sources:
\begin{verbatim}
git clone https://gitlab.denx.de/u-boot/u-boot
cd u-boot
-git checkout v2020.04
+git checkout v2020.07
\end{verbatim}
More recent versions may also work, but we have not tested them.
@@ -226,31 +155,46 @@ Basically, you need to:
sudo apt install device-tree-compiler
\end{verbatim}
-\item Finally, run \code{make}, which should build U-Boot.
+\item Finally, run \code{make}, which should build the two stages of U-Boot:
+\begin{itemize}
+ \item First stage bootloader (SPL): \code{spl/u-boot-spl.bin}
+ \item Second stage bootloader: \code{u-boot.bin}
+\end{itemize}
\end{itemize}
-Look at the size of the \code{u-boot.bin} binary. According to the above
-flash layout, the U-Boot binary is supposed to fit between flash offset
-\code{0x40000} and offset \code{0x100000}, corresponding to a maximum
-size of \code{786432} bytes. Is \code{u-boot.bin} bigger than this
-maximum?
+Look at the size of the binaries. \code{spl/u-boot-spl.bin} should fit
+in the SoC SRAM (64 KB) and according to our flash layout, \code{u-boot.bin}
+is supposed to fit between flash offset \code{0x40000} and offset \code{0x100000},
+corresponding to a maximum size of \code{786432} bytes. Make sure that
+both binaries fit.
+
+\section{Flashing SPL and U-Boot}
-If you're trying with a more recent version of U-Boot and if its
-size is too big, we could either change the NAND where U-Boot
-stores its environment and backup environment, but it's easier
-to shrink U-Boot by removing unnecessary features through
-\code{make menuconfig}.
+To put the board in {\em Boot monitor mode} and use \code{sam-ba} for
+flashing, you first need to remove the \code{NAND CS} jumper on the board.
+It's next to the pin header closest to the Micro-USB plug.
+Now, press the \code{RESET} button. On the serial port, you should see
+\code{RomBoot}. You should also see that a \code{/dev/ttyACM0} device
+file has appeared.
-In any case, run \code{make menuconfig} to see what options
-are available. For each option, don't hesitate to use
-help information to find out what it is about.
-Your instructor can also help.
+Put the jumper back.
+
+Getting back to the \code{bootloader} directory, use \code{sam-ba} to erase
+NAND flash before writing images to it:
+
+\begin{verbatim}
+./sam-ba_3.3.1/sam-ba -p serial -b sama5d3-xplained -a nandflash -c erase
+\end{verbatim}
+
+Then flash the U-Boot SPL:
-\section{Flashing U-Boot}
+\begin{verbatim}
+./sam-ba_3.3.1/sam-ba -p serial -b sama5d3-xplained -a nandflash \
+-c writeboot:u-boot/spl/u-boot-spl.bin
+\end{verbatim}
-Back to the \code{bootloader} directory, now use \code{sam-ba} to flash the
-U-Boot binary at offset \code{0x40000}:
+Then flash the U-Boot binary:
\begin{verbatim}
./sam-ba_3.3.1/sam-ba -p serial -b sama5d3-xplained -a nandflash \
diff --git a/slides/sysdev-bootloaders-sequence/at91-boot.dia b/slides/sysdev-bootloaders-sequence/at91-boot.dia
index b7fe3f31..b45c8353 100644
--- a/slides/sysdev-bootloaders-sequence/at91-boot.dia
+++ b/slides/sysdev-bootloaders-sequence/at91-boot.dia
@@ -302,7 +302,7 @@
<dia:point val="27.55,3.15"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="25.075,1.8675;30.025,3.4875"/>
+ <dia:rectangle val="25.0763,1.86984;30.0237,3.48528"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -335,12 +335,12 @@
<dia:point val="27.55,10.24"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="23.5875,8.9575;31.5125,10.5775"/>
+ <dia:rectangle val="24.3562,8.91946;30.7841,10.6561"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
<dia:attribute name="string">
- <dia:string>#AT91Bootstrap#</dia:string>
+ <dia:string>#U-Boot SPL#</dia:string>
</dia:attribute>
<dia:attribute name="font">
<dia:font family="Latin Modern Sans" style="80" name="Courier"/>
@@ -368,7 +368,7 @@
<dia:point val="27.55,17.28"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="25.6325,15.9975;29.4675,17.6175"/>
+ <dia:rectangle val="25.6325,15.9998;29.4675,17.6153"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -401,7 +401,7 @@
<dia:point val="27.55,24.32"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="24.275,23.0375;30.825,24.6575"/>
+ <dia:rectangle val="24.275,23.0398;30.825,24.6553"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -434,7 +434,7 @@
<dia:point val="27.5,4.55"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="25.225,3.7025;29.775,5.69472"/>
+ <dia:rectangle val="25.225,3.70322;29.775,5.69396"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -468,7 +468,7 @@ in the CPU#</dia:string>
<dia:point val="27.65,11.65"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="22.1612,10.8025;33.1388,12.7947"/>
+ <dia:rectangle val="22.1612,10.8032;33.1388,12.794"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -502,7 +502,7 @@ runs from SRAM#</dia:string>
<dia:point val="27.65,18.65"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="22.1612,17.8025;33.1388,19.7947"/>
+ <dia:rectangle val="22.1612,17.8032;33.1388,19.794"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
@@ -536,7 +536,7 @@ runs from DRAM#</dia:string>
<dia:point val="27.7,25.75"/>
</dia:attribute>
<dia:attribute name="obj_bb">
- <dia:rectangle val="22.395,24.8756;33.0319,26.9485"/>
+ <dia:rectangle val="22.395,24.9032;33.005,26.894"/>
</dia:attribute>
<dia:attribute name="text">
<dia:composite type="text">
diff --git a/slides/sysdev-bootloaders-sequence/sysdev-bootloaders-sequence.tex b/slides/sysdev-bootloaders-sequence/sysdev-bootloaders-sequence.tex
index 75dc763b..7f2c41db 100644
--- a/slides/sysdev-bootloaders-sequence/sysdev-bootloaders-sequence.tex
+++ b/slides/sysdev-bootloaders-sequence/sysdev-bootloaders-sequence.tex
@@ -116,7 +116,7 @@
various storage sources, and load it into SRAM (DRAM not
initialized yet). Size limited to 64 KB. No user interaction
possible in standard boot mode.
- \item {\bf AT91Bootstrap}: runs from SRAM. Initializes the DRAM,
+ \item {\bf U-Boot SPL}: runs from SRAM. Initializes the DRAM,
the NAND or SPI controller, and loads the secondary bootloader
into RAM and starts it. No user interaction possible.
\item {\bf U-Boot}: runs from RAM. Initializes some other hardware
@@ -131,8 +131,6 @@
\end{columns}
\end{frame}
-\input{../common/booting-process-omap.tex}
-
\begin{frame}
\frametitle{Booting on Marvell SoCs}
\begin{columns}
diff --git a/slides/sysdev-bootloaders-u-boot/sysdev-bootloaders-u-boot.tex b/slides/sysdev-bootloaders-u-boot/sysdev-bootloaders-u-boot.tex
index 94da6725..b4775923 100644
--- a/slides/sysdev-bootloaders-u-boot/sysdev-bootloaders-u-boot.tex
+++ b/slides/sysdev-bootloaders-u-boot/sysdev-bootloaders-u-boot.tex
@@ -94,9 +94,12 @@ CONFIG_USB_EHCI_HCD=y
Example, if your cross-compiler executable is \code{arm-linux-gcc}:\\
\code{make CROSS_COMPILE=arm-linux-}
\item The main result is a \code{u-boot.bin} file, which is the
- U-Boot image. Depending on your specific platform, there may be
- other specialized images: \code{u-boot.img}, \code{u-boot.kwb},
- \code{MLO}, etc.
+ U-Boot image. Depending on your specific platform, or what storage
+ device you're booting from (NAND or MMC), there may be
+ other specialized images: \code{u-boot.img}, \code{u-boot.kwb}...
+ \item This also generates the U-Boot SPL image to be flashed
+ together with U-Boot. The exact file name can vary too, depending
+ on what the romcode expects.
\end{itemize}
\end{frame}
More information about the training-materials-updates
mailing list