Loading...
 

Build Instruction

Build system requirements

Before building the source code, you should setup your build environment. Our recommended host platform is Ubuntu v18.04.4 (64 bits), and you can launch the below commands to install related packages.

 

sudo apt-get update

sudo apt-get install make binutils build-essential gcc g++ \

       bash patch gzip bzip2 perl tar cpio python zlib1g-dev \

       gawk ccache gettext libssl-dev libncurses5 minicom git \

       bison flex device-tree-compiler gcc-arm-linux-gnueabi

 

Download the latest source code

You can get the latest MOCHAbin source code from our GitHub. You can download the source code manually.

  1. checkout Marvell firmware

git clone https://github.com/globalscaletechnologies/binaries-marvell.git -b binaries-marvell-armada-18.12

  1. checkout atf-marvell

git clone https://github.com/globalscaletechnologies/atf-marvell.git -b atf-v1.5-armada-18.12-gti

  1. checkout mv-ddr-marvell
  1. checkout u-boot-marvell

git clone https://github.com/globalscaletechnologies/u-boot-marvell.git -b u-boot-2018.03-armada-18.12-gti

  1. checkout linux-v5.4.163

 

Get the cross-compiler

For MOCHAbin, we use linaro-7.3.1 (aarch64) toolchain, you can download the toolchain from linaro website.

wget https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz

mkdir toolchain

tar -xvf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz -C toolchain/

rm gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz

 

Build the bootloader

After install all related software packages, we can start to build the source code, you can follow below steps to build the bootloader image.

setup environment variables

# Set the cross compiler

export CROSS_COMPILE=/path/to/toolchain/aarch64-linux-gnu-

 

# Set path for MV_DDR component

export MV_DDR_PATH=path/to/mv_ddr_marvell

 

# Set U-Boot image path

export BL33=path/to/u-boot.bin

 

# Set Firmware (binaries-marvell) path

export SCP_BL2=path/to/binaries-marvell/mrvl_scp_bl2.img

 

build u-boot

The u-boot image need to build first before you start build the ATF image, so let us to build it first.

 

For MOCHAbin platform, the setting file as below

    Device Tree : /arch/arm/dts/armada-7040-mochabin

    Defconfig : /configs/gti_mochabin-88f7040_defconfig

 

make -C gti_mochabin-88f7040_defconfig

make -C DEVICE_TREE=armada-7040-mochabin

 

build ATF

 

The ATF has many parameter need to configure, below are major parameters

  • DEBUG : debug information enable or not.
  • DDR_TOPOLOGY : for MOCHAbin board, we have some different DDR size models,
    0: 1cs-4g / 1: 2cs-8g / 2: 1cs-2g 
  • PLAT: platform name

 

For MOCHAbin platform, the default build command as below

 

# build for 4GB DDR

make -C DEBUG=0 USE_COHERENT_MEM=0 LOG_LEVEL=10 SECURE=0  PLAT=a70x0_mochabin DDR_TOPOLOGY=0 all fip

 

# build for 8GB DDR

make -C DEBUG=0 USE_COHERENT_MEM=0 LOG_LEVEL=10 SECURE=0 PLAT=a70x0_mochabin DDR_TOPOLOGY=1 all fip

 

# build for 2GB DDR

make -C DEBUG=0 USE_COHERENT_MEM=0 LOG_LEVEL=10 SECURE=0 PLAT=a70x0_mochabin DDR_TOPOLOGY=2 all fip

 

The final image is output to

 

  • For non-debug build
    /build/a70x0_mochabin/release/flash-image.bin
  • For debug enabled build
    /build/a70x0_mochabin/debug/flash-image.bin

 

Build the kernel

The current MOCHAbin kernel is based on Linux longterm support version (v5.4).

 

For MOCHAbin platform, the setting file as below

    Device Tree : /arch/arm64/boot/dts/marvell/armada-7040-mochabin.dts

    Defconfig : /arch/arm64/configs/gti_generic_mvebu_defconfig

 

The default build command as below

 

# build kernel and modules image

make -C gti_generic_mvebu_defconfig

make -C -j4

 

# install modules to target path

make -C modules_install INSTALL_MOD_PATH=



 

Build image with gti build script file

We also provided a build script to build MOCHAbin image. When you use ‘repo sync’ to batch download source code, it also checkout a build script “env-mochabin.sh”.

 

If you download the source manually, not using ‘repo sync’,  you also can flow below steps to download the build script.

git clone https://github.com/globalscaletechnologies/build.git -b mochabin

 

ln -s build/mochabin/env-setup.sh env-mochabin.sh



 

Now you can execute the below commands to build the bootloader and kernel image.

 

source env-mochabin.sh

# build bootloader image

gtibuild bootloader 

 

# build linux kernel and modules image

gtibuild kernel

 

# build bootloader & kernel

gtibuild all

 

The final output image is output to ./out/build-/

 

24IdL5-n1F8biP5N1aZyYitEI_U_abzrtEogK10YHZG9mfRPIV-4byHGuxigLmvQyf8fQs99zlB4svQC0UTM1ZjQ938syTdFfUJuDi4OvYEvGlxxhIoPLPrf6UiumfhYyTxTZvvM

 

Update bootloader image

You can follow the below steps to update the MOCHAbin bootloader image.

  1. Copy /build/a70x0_mochabin/release/flash-image.bin to USB disk and insert USB disk to MOCHAbin. If you use gti build script to build bootloader image, you can find the bootloader image under ./out/build-/a70x0_mochabin-bootloader-*-dbg.bin.
  2. Power on the device and press any key on UART debug console during booting
  3. execute “bubt flash-image.bin spi usb” to update u-boot image
  4. reset the device to load new bootloader image

 

Update Ubuntu rootfs image

We provided a prebuilt Ubuntu 18.04 rootfs for MOCHAbin, you can download the prebuilt image from our official website. In our official image included a ramdisk with an updated script, the user can boot into the ramdisk and use this script (mkemmc.sh) to partition / format / install the rootfs to the eMMC disk.

 

You can follow the below steps to update your device.

  1. download our prebuilt image from our official website
  2. prepare a USB disk and format it to FAT/FAT32 filesystem.
  3. copy all files under the recovery folder to USB disk.
  4. copy all files under the bootloader and rootfs to USB disk.
  5. insert USB disk to MOCHAbin board and then power on the device.
  6. press any key on UART debug console during booting to enter the u-boot console.
  7. run the below command on the u-boot console to update the bootloader, the image must fit your device hardware model and memory size. If you don’t want to update the bootloader, you can ignore this step.

bubt a70x0_mochabin-bootloader-ddr4-8g--rel.bin spi usb

  1. run below command to load ramdisk image and boot it

usb reset; fatload usb 0 $loadaddr recovery.bin; source $loadaddr

  1. when device boot into the system, run below commands to install MOCHAbin rootfs image to eMMC.

mount /dev/sda1 /media

/root/mkemmc.sh /media/mochabin-rootfs-ubuntu1804-.tar.gz

  1. after update completed, reboot the system and enter u-boot console again.
  2. run below command to setup the device boot from eMMC.

env default -a

setenv image_name boot/Image

setenv fdt_name boot/armada-7040-mochabin.dtb

setenv bootcmd 'mmc dev 0; ext4load mmc 0:1 $kernel_addr_r $image_name;ext4load mmc 0:1 $fdt_addr_r $fdt_name;setenv bootargs $console root=PARTUUID=89708921-01 rw rootwait net.ifnames=0 biosdevname=0; booti $kernel_addr_r - $fdt_addr_r'

saveenv

boot