Build From Source - Bootloader

The ESPRESSObin board is preloaded with ARM Trusted Firmware(ATF) + U-Boot as its default bootloader. This page shows the steps of downloading and building the bootloader for ESPRESSObin. The instructions below assume that you have already followed the instructions from the Build from source - Toolchain page and setup the toolchain on your build machine.

Prebuilt images

Prebuilt bootloader images for 1GB DDR3 and 2GB DDR3 ESPRESSObin flavors can be found on our Tech Spec page in the Software table. In case you will be using prebuilt images, you can skip this page and head over to Update the Bootloader page to see how they are used to update the bootloader on your ESPRESSObin.

Build U-Boot

First, you need to make the directory into which you will clone the U-Boot source (e.g./home/ebin/u-boot) and enter into that directory:

ebin@buildserver:~$ mkdir u-boot
ebin@buildserver:~$ cd u-boot/

and there please clone the u-boot-marvell repository with the command below:

ebin@buildserver:~/u-boot$ git clone https://github.com/MarvellEmbeddedProcessors/u-boot-marvell .

You'll see the repository being downloaded to the u-boot directory. When it is done, checkout to the branch for ESPRESSObin (u-boot-2017.03-armada-17.06):

ebin@buildserver:~/u-boot$ git checkout u-boot-2017.03-armada-17.06
Branch u-boot-2017.03-armada-17.06 set up to track remote branch u-boot-2017.03-armada-17.06 from origin.
Switched to a new branch 'u-boot-2017.03-armada-17.06'

In order to build U-Boot binaries for ESPRESSObin, you'll need to setup the CROSS_COMPILE variable properly on your build machine:

ebin@buildserver:~/u-boot$ export CROSS_COMPILE=aarch64-linux-gnu-

Now you'll need to create the .config file using the default values from one of the default config file in the configs directory. For ESPRESSObin board, you will use the file mvebu_espressobin-88f3720_defconfig:

ebin@buildserver:~/u-boot$ make mvebu_espressobin-88f3720_defconfig

Once the .config is generated, build the u-boot binary with make:

ebin@buildserver:~/u-boot$ make DEVICE_TREE=armada-3720-espressobin

Wait for the make command until it finishes, and you'll see the binary file u-boot.bin created under the current directory:

ebin@buildserver:~/u-boot$ ls u-boot*
u-boot          u-boot-nodtb.bin  u-boot.cfg          u-boot.dtb  u-boot.map   u-boot.sym
u-boot-dtb.bin  u-boot.bin        u-boot.cfg.configs  u-boot.lds  u-boot.srec



The dtc tool is required to compile the device trees in the u-boot source. If your build machine does not have the dtc tool installed, please setup the tool with the command sudo apt-get install device-tree-compiler on the build machine.

The file u-boot.bin will be used in the next step.

Build ATF

After you finish building the u-boot, you'll need to setup the environment variable on your build machine to make the u-boot binary as the valid payload for the ARM Trusted Firmware. Make sure to adjust the path of the u-boot.bin binary according to your setup.

ebin@buildserver:~/u-boot$ export BL33=/home/ebin/u-boot/u-boot.bin



In order to create the ATF image, it requires openssl headers to be installed on your build machine. Please do sudo apt-get install libssl-dev to install the openssl headers before starting to build the ATF.

You might also need to install GNU ARM toolchain for building the WTMI binary. On Debian/Ubuntu the default GNU ARM toolchain can be installed using "sudo apt-get install gcc-arm-linux-gnueabi"

Now you'll need to create the directory to hold the ATF source code.

ebin@buildserver:~/u-boot$ cd ..
ebin@buildserver:~$ mkdir atf
ebin@buildserver:~$ cd atf/

Then please clone the source code repository atf-marvell to the directory you have just created.

ebin@buildserver:~/atf$ git clone https://github.com/MarvellEmbeddedProcessors/atf-marvell.git .

When the clone is done, checkout the atf-v1.3-armada-17.06, which is a valid working branch for ESPRESSObin:

ebin@buildserver:~/atf$ git checkout atf-v1.3-armada-17.06
Branch atf-v1.3-armada-17.06 set up to track remote branch atf-v1.3-armada-17.06 from origin.
Switched to a new branch 'atf-v1.3-armada-17.06'

Building flash images for ESPRESSObin also requires cloning Marvell's A3700-utils repository. We will clone it into a new directory named a3700-utils:

ebin@buildserver:~/atf$ cd ..
ebin@buildserver:~$ mkdir a3700-utils
ebin@buildserver:~$ cd a3700-utils
ebin@buildserver:~/a3700-utils$ git clone -b A3700_utils-armada-17.06 https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell.git .

To build flash images for both 1GB and 2GB DDR3 system memory configuration, there are a couple of patches we need to download here:

After the patches have been downloaded into the a3700-utils directory, we need to apply them with:

ebin@buildserver:~/a3700-utils$ git am 0001-build-add-ddr-size-parsing-support-for-ddrparser.patch
Applying: build: add ddr size parsing support for ddrparser
ebin@buildserver:~/a3700-utils$ git am 0002-ddr-add-topology-4-DDR3-2CS-2G-support.patch
Applying: ddr: add topology 4 (DDR3-2CS-2G) support

Now, go back to your atf directory:

ebin@buildserver:~/a3700-utils$ cd ../atf/

Now we are all set to build the flash images. Below are commands for building flash images for both 1GB DDR3 and 2GB DDR3 ESPRESSObin flavors. Make sure to use the command according to the size of your ESPRESSObin's DDR memory.

To build ESPRESSObin flash images for 1GB DDR3 do:


Make sure to adjust the WTP variable below to point to where you cloned the a3700-utils sources (in our case this was /opt/a3700-utils/).

ebin@buildserver:~/atf$ make DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_1000_DDR_800 DDR_TOPOLOGY=2 BOOTDEV=SPINOR PARTNUM=0 WTP=../a3700-utils/ PLAT=a3700 all fip

To build ESPRESSObin flash images for 2GB DDR3 do:

ebin@buildserver:~/atf$ make DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_1000_DDR_800 DDR_TOPOLOGY=4 BOOTDEV=SPINOR PARTNUM=0 WTP=../a3700-utils/ PLAT=a3700 all fip

After the building process is done, the flash-image.bin bootloader image can be found in the build/a3700/debug/ directory:

ebin@buildserver:~/atf$ ls build/a3700/debug/
TIM_ATF.bin   bl1      bl2      bl31      boot-image.bin    fip.bin          uart-images      wtmi.bin
atf-ntim.txt  bl1.bin  bl2.bin  bl31.bin  boot-image_h.bin  flash-image.bin  uart-images.tgz

whereas UART images can be found in build/a3700/debug/uart-images/ directory:

ebin@buildserver:~/atf$ ls build/a3700/debug/uart-images
TIM_ATF.bin  atf-ntim.txt  boot-image_h.bin  wtmi_h.bin


Please find the file in your atf source tree docs/marvell/build.txt for a complete reference of the build parameters to make bootloader image for MACCHIATObin.

Now you have your bootloader image flash-image.bin ready, please refer to the page Update the Bootloader on how to update the ESPRESSObin with the new bootloader image.