- bc (GNU bc arbitrary precision calculator language)
- openssl/bn.h header (Secure Sockets Layer toolkit - development files)
- make (GNU Make)
- gcc (GNU C Compiler)
Under Debian / Ubuntu, the dependencies can be installed using
```bash
sudo apt-get -y install bison flex bc libssl-dev make gcc
```
### Cross compiler
Even though mainline U-Boot requires GCC minimum version 6, it would generate oversized SPL (Secondary Program Loader) image. Therefore it is recommended to use GCC version 7.
To support Armbian boot script (/boot/boot.scr), please apply [this patch](/files/uboot/u-boot-mainline-armbian-boot-script-support.patch) to U-Boot source code before
*make helios4_defconfig*
#### SD Card image
```bash
make -j$(nproc)
```
it would produced **u-boot-spl.kwb**
#### SPI NOR flash image
Since *helios4_defconfig* targeting SD card image, we need to modified the configuration to generate SPI NOR flash image before compiling.
```bash
mv -f .config .config_mmc
awk '{\
gsub(/CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y/,"# CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC is not set");\
gsub(/# CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI is not set/,"CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI=y");\
gsub(/CONFIG_ENV_IS_IN_MMC=y/,"# CONFIG_ENV_IS_IN_MMC is not set");\
gsub(/# CONFIG_ENV_IS_IN_SPI_FLASH is not set/,"CONFIG_ENV_IS_IN_SPI_FLASH=y");\
}1' .config_mmc >> .config
rm -f .config_mmc
make -j$(nproc)
```
it would produced **u-boot-spl.kwb**
### Customize U-Boot
U-Boot has configuration editor based on ncurses similar like Linux Kernel configuration editor.
Install ncurses development files. Under Debian/Ubuntu can be done using this command
After exiting the configuration editor and saving the configuration, build the image according to [SD Card image](#sd-card-image) or [SPI NOR flash image](#spi-nor-flash-image) instructions.
- - -
## Marvell U-Boot 2013.01
Based on U-Boot 2013.01 Marvell version: 2015_T1.0p16
To compile using Ubuntu 16.04 cross compiler, please apply [this patch](https://github.com/armbian/build/blob/master/patch/u-boot/u-boot-mvebu/tools-bin_hdr-compiler-fixes.patch) to U-Boot source code.
To support Armbian boot script (/boot/boot.scr), please apply [this patch](/files/uboot/u-boot-armbian-boot-script-support.patch) to U-Boot source code.
it would produced *u-boot-a38x-**mm**-**d**-mmc.bin* whereas **mm** is month and **d** is day. For example, building u-boot on October 2nd would produced
it would produced *u-boot-a38x-**mm**-**d**-spi.bin* whereas **mm** is month and **d** is day. For example, building u-boot on October 2nd would produced