Loading...
 

Build from source - Kernel

MACCHIATObin board currently supports Linux kernel version 4.4.52. The kernel image and dtb file can be either:

  • Downloaded from our Software page
  • Built manually from source


Generated kernel files cannot be used interchangeably between Single Shot and Double Shot; make sure to use the files for your particular MACCHIATObin version.

Downloading from Software page


Note that the kernel binaries for MACCHIATObin Double Shot differ from kernel binaries for MACCHIATObin Single Shot. On the Software page, there are two archives containing kernel binaries:

  • For MACCHIATObin Single Shot - under Linux kernel - Single Shot
  • For MACCHIATObin Double Shot - under Linux kernel - Double Shot

Building from source


Building the kernel from source requires that the toolchain is setup as instructed in Toolchain Installation.

To build the kernel binary for MACCHIATObin from source, first we need to make the directory into which we will clone the kernel (e.g. /home/mcbin/kernel/4.4.52/) and position into that directory:

mcbin@buildserver:~$ mkdir -p kernel/4.4.52
mcbin@buildserver:~$ cd kernel/4.4.52/


and there we clone linux-marvell repository with:

mcbin@buildserver:~/kernel/4.4.52$ git clone https://github.com/MarvellEmbeddedProcessors/linux-marvell .


and the repo contents will be cloned inside your current directory. Now we checkout the proper branch for MACCHIATObin (linux-4.4.52-armada-17.10):

mcbin@buildserver:~/kernel/4.4.52$ git checkout linux-4.4.52-armada-17.10
Branch linux-4.4.52-armada-17.10 set up to track remote branch linux-4.4.52-armada-17.10 from origin.
Switched to a new branch 'linux-4.4.52-armada-17.10'


Next thing we need to do in order to enable building images for MACCHIATObin is to set correct definitions for ARCH and CROSS_COMPILE:

mcbin@buildserver:~/kernel/4.4.52$ export ARCH=arm64
mcbin@buildserver:~/kernel/4.4.52$ export CROSS_COMPILE=aarch64-linux-gnu-


Next we create a default .config file using the default values from arch/$ARCH/configs/${PLATFORM}_defconfig (in this case from arch/arm64/configs/mvebu_v8_lsp_defconfig):

mcbin@buildserver:~/kernel/4.4.52$ make mvebu_v8_lsp_defconfig


and finally start the build with:

mcbin@buildserver:~/kernel/4.4.52$ make -j$(($(nproc)+1))


After the build process finishes successfully, you can find the Image (named Image) in arch/arm64/boot/:

mcbin@buildserver:~/kernel/4.4.52$ ls arch/arm64/boot/
dts  Image  Image.gz  install.sh  Makefile


and the device tree blob for MACCHIATObin (named armada-8040-mcbin.dtb) can be found in arch/arm64/boot/dts/marvell/ directory.

Single Shot


A couple of changes are required for building the 4.4.52 kernel for the MACCHIATObin Single Shot board.

1. Download the 0001-dts-a80x0-add-device-tree-for-MacchiatoBin-single-sh.patch and apply it on top of the the latest kernel (from release 17.10.3):

mcbin@buildserver:~/kernel/4.4.52$ git apply 0001-dts-a80x0-add-device-tree-for-MacchiatoBin-single-sh.patch


2. Now issue the build with:

mcbin@buildserver:~/kernel/4.4.52$ make -j$(($(nproc)+1))

 
3. After the build process finishes, you can find the newly created kernel image (named Image) in arch/arm64/boot/:

mcbin@buildserver:~/kernel/4.4.52$ ls arch/arm64/boot/
dts  Image  Image.gz  install.sh  Makefile


and the device tree blob for the MACCHIATObin Single Shot (named armada-8040-mcbin-single-shot.dtb) can be found in arch/arm64/boot/dts/marvell/ directory. When building the kernel for the MACCHIATObin Single Shot, it is necessary to copy the newly created armada-8040-mcbin-single-shot.dtb device tree file over the armada-8040-mcbin.dtb device tree file for the bootloader to load the correct device tree file:

mcbin@buildserver:~/kernel/4.4.52$ cd arch/arm64/boot/arch/arm64/boot/dts/marvell/
mcbin@buildserver:~/kernel/4.4.52/arch/arm64/boot/dts/marvell$ sudo cp armada-8040-mcbin-single-shot.dtb armada-8040-mcbin.dtb


It is vital that the modified armada-8040-mcbin.dtb device tree file and kernel image are used when booting various supported Linux distributions on the MACCHIATObin Single Shot.