In this page we will show you how to download necessary sources and build OpenWrt binaries for MACCHIATObin.
Prebuilt OpenWrt images can be downloaded from Software page, under OpenWrt.
OpenWrt is an open source firmware designed for embedded devices that is highly extensible and enables both users and customers to install a powerful, highly customizable variant of Linux on their routers.
Generating an installable OpenWrt firmware requires:
- ca. 200MB of hard disk space for OpenWrt build system
- ca. 300MB of hard disk space for OpenWrt build system + OpenWrt feeds
- ca. 2.1 GB of hard disk space for source packages downloaded during build from OpenWrt feeds
- ca. 3-4 GB or available hard disk space to build (i.e. cross-compile) OpenWrt and build the firmware image.
- ca. 1-4GB of RAM to build OpenWrt (building x86 images requires 4GB RAM)
Before proceeding, make sure to install all prerequisites for building OpenWrt:
These packages should be available for installation using your default distribution package manager. A complete list of dependencies and prerequisites can be found on OpenWrt's official Wiki pages.
IMPORTANTIn order to provide the full device functionality, 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.2-g6a6581a for the OpenWrt 17.10 release.
MACCHIATObin U-Boot binary release armada-17.10 is available on our Software page, under Bootloader.
To check the current version of U-Boot (platform independent), connect the device over serial port and power on the board. You should see the relevant information in the first few lines:
BootROM - 2.03 Starting CP-1 IOROM 1.07 Booting from SPI NOR flash 1 (0x32) Found valid image at boot postion 0x000 lNOTICE: Starting binary extension NOTICE: SVC: SW Revision 0x0. SVC is not supported mv_ddr: mv_ddr-armada-17.10.4-gcc280f0 (Feb 02 2018 - 13:57:45) mv_ddr: completed successfully NOTICE: Cold boot NOTICE: Booting Trusted Firmware NOTICE: BL1: v1.3(release):armada-17.10.6:84c1c1d NOTICE: BL1: Built : 13:57:53, Feb 2 2018 NOTICE: BL1: Booting BL2 lNOTICE: BL2: v1.3(release):armada-17.10.6:84c1c1d NOTICE: BL2: Built : 13:57:55, Feb 2 2018 BL2: Initiating SCP_BL2 transfer to SCP NOTICE: SCP_BL2 contains 2 concatenated images NOTICE: Load image to CP1 MSS NOTICE: Loading MSS image from address 0x4023020 Size 0x1378 to MSS at 0xf4280000 NOTICE: Done NOTICE: Load image to AP MSS NOTICE: Loading MSS image from address 0x4024398 Size 0x1f68 to MSS at 0xf0580000 N FreeRTOS 7.3.0 - Marvell cm3 - A8K release armada-17.10.1 OTICE: Done NOTICE: SCP Image doesn't contain PM firmware NOTICE: BL1: Booting BL31 lNOTICE: MSS PM is not supported in this build NOTICE: BL31: v1.3(release):armada-17.10.7:4396548 NOTICE: BL31: Built : 11:36:52, Feb 8 2018 l U-Boot 2017.03-armada-17.10.2-g6a6581a (Feb 08 2018 - 11:33:50 +0000) Model: MACCHIATOBin-8040 Clock: CPU 1800 [MHz] DDR 1200 [MHz] FABRIC 1200 [MHz] MSS 200 [MHz] DRAM: 4 GiB
Alternatively, press any key to stop the booting procedure, and type version in the U-Boot prompt:
Marvell>> version U-Boot 2017.03-armada-17.10.2-g6a6581a (Feb 08 2018 - 11:33:50 +0000) aarch64-linux-gnu-gcc (Linaro GCC 5.3-2016.05) 5.3.1 20160412 GNU ld (Linaro_Binutils-2016.05) 2.25.0 Linaro 2016_02
In most cases, the (stable) GNU/Linux distribution of your choice should be sufficient for building the OpenWrt image. Just take care to do everything as non-root user.
However, if you are using testing repositories, bleeding-edge distros or latest/unstable development packages, you could encounter problems with building OpenWrt's cross-toolchain and/or compiler.
In these cases, we advise the use of Docker container with one of the stable images, e.g. Ubuntu 16.04. Setting up a running Docker image is outside of the scope of this tutorial.
Whichever method you require/prefer, take care of the following guidelines:
- Do everything as non-root user!
- Issue all OpenWrt build system commands in directory.
- Make sure to issue all OpenWrt commands in the directory where you have cloned OpenWrt, or in our case this will be the opt/openwrt/openwrt-dd/ directory.
- Changing ownership for working directories to other than root user (this will be covered a little later).
There are three Marvell LSP kernel versions (with OpenWrt patches on top) available for MACCHIATObin: 17.02, 17.06 and 17.10. The location where we will download the kernel source to is /opt/kernel/openwrt-kernel, so create the directory and position into it:
user@laptop:~$ mkdir -p /opt/kernel/ && cd /opt/kernel/
From here clone the kernel source and checkout the desired version:
- for 17.02:
user@laptop:/opt/kernel$ git clone https://github.com/MarvellEmbeddedProcessors/openwrt-kernel.git -b openwrt_17.02_release
- for 17.06:
user@laptop:/opt/kernel$ git clone https://github.com/MarvellEmbeddedProcessors/openwrt-kernel.git -b openwrt_17.06_release
- for 17.10:
user@laptop:/opt/kernel$ git clone https://github.com/MarvellEmbeddedProcessors/openwrt-kernel.git -b openwrt_17.10_release
OpenWrt version supported for MACCHIATObin is Designated Driver (DD), with additional patches for the boards. We will download OpenWrt sources to /opt/openwrt/openwrt-dd so create that directory and head into it:
user@laptop:~$ mkdir -p /opt/openwrt/openwrt-dd && cd /opt/openwrt/openwrt-dd
Depending on your chosen Marvell LSP kernel version, checkout the respective OpenWrt branch:
- for 17.02:
user@laptop:~$ git clone https://github.com/MarvellEmbeddedProcessors/openwrt-dd.git -b openwrt_17.02_release
- for 17.06:
user@laptop:~$ git clone https://github.com/MarvellEmbeddedProcessors/openwrt-dd.git -b openwrt_17.06_release
- for 17.10:
user@laptop:~$ git clone https://github.com/MarvellEmbeddedProcessors/openwrt-dd.git -b openwrt_17.10_release
NoteNote that you might need to set the right permissions for the working directories:
user@laptop:~$ sudo chown -R $(whoami):$(id -gn) /opt/kernel/ user@laptop:~$ sudo chown -R $(whoami):$(id -gn) /opt/openwrt/openwrt-dd/
After we have downloaded necessary repositories, from our OpenWrt directory (/opt/openwrt/openwrt-dd) we update and index the feeds with::
user@laptop:/opt/openwrt/openwrt-dd$ ./scripts/feeds update -a user@laptop:/opt/openwrt/openwrt-dd$ ./scripts/feeds install -a
Now we invoke OpenWrt's image configuration dialog:
user@laptop:/opt/openwrt/openwrt-dd$ make menuconfig
and in the menu, we select the following:
Target System ---> Marvell 64b Boards Target Profile ---> MACHIATOBin (SolidRun Armada 8040 Community Board) Target Images ---> [x] ramdisk ---> * Root filesystem archives * [x] tar.gz * Root filesystem images * [x] ext4 ---> [x] Advanced configuration options (for developers) ---> (/opt/kernel/openwrt-kernel) Use external kernel tree
NoteIf you have setup a different kernel path, make sure to replace it when defining external kernel tree variable.
Save your configuration and exit the make menuconfig interface. Build the image with the make command.
user@laptop:/opt/openwrt/openwrt-dd$ make -j5
To speed up the build process, you can utilize multiple cores with the following command:
user@laptop:/opt/openwrt/openwrt-dd$ make -j$(($(nproc)+1))
When the build process finishes, the binaries will be generated inside the /bin/mvebu64/ directory. We will need the armada-8040-mcbin.dtb device tree file, openwrt-armada-a8k-MACHIATOBin-Image image and openwrt-mvebu64-armada-a8k-machiatobin-rootfs.tar.gz root file system. Binary names are, of course, identical regardless of the chosen release.
To see how to flash these files onto a USB device or SD card, see Boot from MicroSD card/USB stick - OpenWrt.