Loading...
 

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 set up the toolchain on your build machine.

Prebuilt images


Prebuilt 17.06 and 17.10 release U-Boot images for 1GB DDR3 and 2GB DDR3 ESPRESSObin flavors can be found on our Tech Spec page, Software table under Bootloader. 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.

 IMPORTANT

In order to provide the full device functionality for OpenWrt distribution, you will have to re-flash the U-Boot version to match the version of the OpenWrt release you are planning to use. For example:


U-Boot 2017.03-armada-17.10.1-00489-ge7c0ff4 for the OpenWrt 17.10 release.

Build U-Boot


First, clone the U-Boot source (and checkout the u-boot-2017.03-armada-17.10 branch) into a newly created u-boot directory:

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

 ESPRESSObin v7

For the ESPRESSObin v7 hardware revision which supports DDR4, there are a couple of patches we need to download here:


After downloading these patches into the u-boot directory, apply them with:

ebin@buildserver:~/a3700-utils$ git apply 000*


Set up the CROSS_COMPILE variable properly on your build machine:

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

Now create the .config file using the default values from one of the default config file in the configs directory. For the ESPRESSObin board this is the mvebu_espressobin-88f3720_defconfig config:

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

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

 Information

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, set up the tool by running sudo apt-get install device-tree-compiler on the build machine.
ebin@buildserver:~/u-boot$ make DEVICE_TREE=armada-3720-espressobin

A successful build will generate a u-boot.bin binary file in your 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

Build ATF


Now we need to set up the environment variable on your build machine to make the u-boot binary as a valid payload for the ARM Trusted Firmware. 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

 

 Information

Creating the ATF image 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 head back and clone the ATF source code repository (branch atf-v1.3-armada-17.10). The below command will clone the repository in the atf-marvell directory:

ebin@buildserver:~/u-boot$ cd ..
ebin@buildserver:~/atf$ git clone -b atf-v1.3-armada-17.10 https://github.com/MarvellEmbeddedProcessors/atf-marvell.git atf-marvell

Building flash images for ESPRESSObin also requires cloning Marvell's A3700-utils repository. We will clone it into a new directory named a3700-utils and right away check out the A3700_utils-armada-17.10 branch:

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

To build flash images for different ESPRESSObin versions and hardware revisions (e.g. for ESPRESSObin 1GB or 2GB DDR3 configuration, or for the ESPRESSObin v7 1GB or 2GB DDR4 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 apply 0001-parser-add-preset_ddr_conf-field-for-using-preset-dd.patch 0002-ddr-update-ddr-topology-for-ddr3-ddr4.patch

The patches enable to build bootloader images for a wide variety of DDR topologies. Some examples will be shown below. Lastly, go back to your ATF directory:

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

Now we are all set to build the flash images.

Build examples

 
Below are several examples of building flash images for various ESPRESSObin flavors. Make sure to use the DDR topology according to your hardware revision (v7 or v5) and the size of your ESPRESSObin's DDR memory.

 Information

In commands below 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/).
  • SPINOR ESPRESSObin DDR3 1CS 1GB:
     
    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
  • SPINOR ESPRESSObin DDR3 2CS 2GB:
     
    ebin@buildserver:~/atf$ make DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_1000_DDR_800 DDR_TOPOLOGY=7 BOOTDEV=SPINOR PARTNUM=0 WTP=../a3700-utils/ PLAT=a3700 all fip
  • SPINOR ESPRESSObin DDR4 1CS 1GB:
     
    ebin@buildserver:~/atf$ make DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_1000_DDR_800 DDR_TOPOLOGY=5 BOOTDEV=SPINOR PARTNUM=0 WTP=../a3700-utils/ PLAT=a3700 all fip
  • SPINOR ESPRESSObin DDR4 2CS 2GB:
     
    ebin@buildserver:~/atf$ make DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_1000_DDR_800 DDR_TOPOLOGY=6 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

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.

UART images


After a successful build, UART images are located 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

See Bootloader recovery via UART on how to recover your bootloader using UART images.

SATA bootloader image


To build SATA bootloader images set the BOOTDEV variable in the build command to SATA, for example, to build 1GB DDR3 SATA bootloader image, the command would be:

$ make DEBUG=1 USE_COHERENT_MEM=0 LOG_LEVEL=20 SECURE=0 CLOCKSPRESET=CPU_1000_DDR_800 DDR_TOPOLOGY=2 BOOTDEV=SATA PARTNUM=0 WTP=../a3700-utils/ PLAT=a3700 all fip

See Bootloader recovery via SATA on how to recover your bootloader using SATA bootloader image.