Loading...
 

Build From Source - Bootloader


The ESPRESSObin board ships pre-loaded with ARM Trusted Firmware (ATF) + U-Boot as its default bootloader. This page shows how to download and build the bootloader from source. Building the bootloader requires that the toolchain is set up as shown in Build from source - Toolchain.

Prebuilt images


Prebuilt 17.06 and 17.10 release bootloader images for 1GB DDR3, 2GB DDR3, 1GB DDR4 and 2GB DDR4 ESPRESSObin flavors can be found on our Tech Spec page, Software table. If you will be using pre-built images, skip this page and head over to Update the Bootloader page to read how to flash and update the bootloader on your ESPRESSObin board.

 IMPORTANT
In order to provide the full device functionality for the 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 should be used for the OpenWrt 17.10. release

Build U-Boot


Clone the u-boot-marvell repository and head into the directory:

$ git clone https://github.com/MarvellEmbeddedProcessors/u-boot-marvell.git
$ cd u-boot-marvell

To enable building bootloader images for the new DDR4-supporting ESPRESSObin v7 hardware revision, there are a couple of patches that need to be applied. We will create a new branch named espressobin-v7 that uses a commit from the u-boot-2017.03-armada-17.10 branch as a starting point:

$ git checkout 6a6581a21ec5d6405f30fd41ee5040d64893651b -b espressobin-v7

The archive containing the patches can be downloaded below:


After downloading the archive, extract it with:

$ unzip ebin_v7_u-boot_patches.zip

Apply the patches using the git am command:

$ git am *.patch

Set up the CROSS_COMPILE variable:

$ export CROSS_COMPILE=aarch64-linux-gnu-

Now create the .config file using the mvebu_espressobin-88f3720_defconfig configuration file:

$ make mvebu_espressobin-88f3720_defconfig

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

$ make DEVICE_TREE=armada-3720-espressobin
 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.

A successful build will generate a u-boot.bin binary file in your current directory.

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.

$ 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:

$ cd ..
$ git clone https://github.com/MarvellEmbeddedProcessors/atf-marvell.git


There are a couple of patches that need to be applied for the DDR4-supporting ESPRESSObin v7 hardware revision. We will create a new branch named espressobin-v7 that uses a commit from the atf-v1.3-armada-17.10 branch as a starting point:

$ cd atf-marvell
$ git checkout 43965481990fd92e9666cf9371a8cf478055ec7c -b espressobin-v7

The archive containing the patches can be downloaded below:


After downloading the archive, extract it with:

$ unzip ebin_v7_atf_patches.zip

Apply the patches using the git am command:

$ git am *.patch

Building flash images for ESPRESSObin also requires cloning Marvell's A3700-utils repository. Head back a directory and clone the source:

$ cd ..
$ git clone https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell.git
$ cd A3700-utils-marvell/

To build flash images for different ESPRESSObin versions and hardware revisions, there are a couple of patches that need to be applied here as well. We will create a new branch named espressobin-v7 that uses a commit from the A3700_utils-armada-17.10 branch as a starting point:

$ git checkout 34ce2160a1521dda9c7c68e06fcde83242dee94a -b espressobin-v7

The archive containing the patches can be downloaded below:


After downloading the archive, extract it with:

$ unzip ebin_v7_a3700-utils_patches.zip

Apply the patches using the git am command:

$ git am *.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, from where we will build the bootloader images:

$ cd ../atf-marvell/

Build examples

 
This section shows several examples of building flash images for various ESPRESSObin flavors. Make sure to change the value of DDR_TOPOLOGY option according to the DDR flash configuration (DDR3 or DDR4) and the DDR memory size (512MB, 1GB or 2GB) of your ESPRESSObin board. All commands are executed from the root of the ATF repository.

 Info
In commands below make sure to adjust the WTP variable below to point to where you cloned the A3700-utils repository source.
  • SPINOR ESPRESSObin DDR3 2CS 1GB:
     
    $ 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-marvell/ PLAT=a3700 all fip
  • SPINOR ESPRESSObin DDR3 2CS 2GB:
     
    $ 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-marvell/ PLAT=a3700 all fip
  • SPINOR ESPRESSObin DDR4 1CS 1GB:
     
    $ 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-marvell/ PLAT=a3700 all fip
  • SPINOR ESPRESSObin DDR4 2CS 2GB:
     
    $ 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-marvell/ 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 inside the ATF repository:

$ 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:

$ 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.