Loading...
 

Build From Source - Kernel

ESPRESSObin board currently supports Linux kernel versions 4.4.8, 4.4.52 and 4.14 mainline kernel. Kernel images and dtb files for both kernel versions can be:

  • Generated manually by following instructions on this page
  • Downloaded as a zip archive from our Tech Spec page, Software table.

Kernel version 4.4.8


First we need to make the directory into which we will clone the kernel (e.g. /home/user/kernel/4.4.8/) and position into that directory:

user@laptop:~$ mkdir -p kernel/4.4.8
user@laptop:~$ cd kernel/4.4.8/


and there we clone linux-marvell repository with:

user@laptop:~/kernel/4.4.8$ 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 (linux-4.4.8-armada-17.02-espressobin):

user@laptop:~/kernel/4.4.8$ git checkout linux-4.4.8-armada-17.02-espressobin
Branch linux-4.4.8-armada-17.02-espressobin set up to track remote branch linux-4.4.8-armada-17.02-espressobin from origin.
Switched to a new branch 'linux-4.4.8-armada-17.02-espressobin'


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

user@laptop:~/kernel/4.4.8$ export ARCH=arm64
user@laptop:~/kernel/4.4.8$ 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):

user@laptop:~/kernel/4.4.8$ make mvebu_v8_lsp_defconfig


and finally start the build with:

user@laptop:~/kernel/4.4.8$ make -j4


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

user@laptop:~/kernel/4.4.8$ ls arch/arm64/boot/
        dts  Image  Image.gz  install.sh  Makefile


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

Kernel version 4.4.52


First we need to make the directory into which we will clone the kernel (e.g. /home/user/kernel/4.4.52/) and position into that directory:

user@laptop:~$ mkdir -p kernel/4.4.52
user@laptop:~$ cd kernel/4.4.52/


and there we clone linux-marvell repository with:

user@laptop:~/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 ESPRESSObin (linux-4.4.52-armada-17.06):

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

 Note

For the kernel 4.4.52 branches linux-4.4.52-armada-17.06 and onward, please apply the kernel patches from here before building the binaries.


In order to apply the patches, simply do as follows, taking into account the directories that the patches were downloaded to:

user@laptop:~/kernel/4.4.52$ git apply 0001-fix-regulator-armada-37xx-overwrite-CPU-voltage-valu.patch
user@laptop:~/kernel/4.4.52$ git apply 0002-fix-ARM64-dts-marvell-armada-37xx-update-CPU-voltage.patch


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

user@laptop:~/kernel/4.4.52$ export ARCH=arm64
user@laptop:~/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):

user@laptop:~/kernel/4.4.52$ make mvebu_v8_lsp_defconfig


and finally start the build with:

user@laptop:~/kernel/4.4.52$ make -j4


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

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


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

Kernel version 4.14


This section will show how to download, configure and build mainline kernel 4.14 for your ESPRESSObin board.

Requirements:

  • Toolchain and toolchain path configured on your local machine as shown in Build From Source - Toolchain
  • Packages for building the Linux kernel:
    • build-essential
    • git
    • bc
    • libncurses5-dev


Now you are ready to clone the mainline kernel and checkout the linux-4.14y branch. We will clone it to /home/user/kernel/4.14/:

user@laptop:~$ mkdir -p kernel/4.14 && cd kernel/4.14/
user@laptop:~/kernel/4.14$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
user@laptop:~/kernel/4.14$ git checkout linux-4.14.y


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

user@laptop:~/kernel/4.14$ export ARCH=arm64
user@laptop:~/kernel/4.14$ export CROSS_COMPILE=aarch64-linux-gnu-


Next we create a default ./.config file using the default values from arch/arm64/configs/defconfig:

user@laptop:~/kernel/4.14$ make defconfig


Additional, custom options can be added using the menuconfig interface (make menuconfig command).

Start the build with:

user@laptop:~/kernel/4.14$ make -j4 Image dtbs modules


This will build:

- arch/arm64/boot/Image -> vmlinux binary
- arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtb -> device tree file for U-Boot
- All modules specified in .config.

Do not run make modules_install unless you are just updating your local system.

The newly created kernel image and device tree file can now be copied to the removable media, as instructed in tutorials regarding various supported file systems.

Mainline notes

 

  • To install the modules belonging to the kernel image, from the kernel root directory do:
    user@laptop:~/kernel/4.14$ sudo make ARCH=arm64 modules_install INSTALL_MOD_PATH=/mnt/sdcard/
    where /mnt/sdcard/ is the path to the root of the file system on your removable media.
  • The device tree file name for mainline kernel differs from other supported kernel versions, so make sure the fdt_name U-Boot variable is adjusted accordingly:
    Marvell>> setenv fdt_name 'boot/armada-3720-espressobin.dtb'
  • Due to the size of kernel files increasing, you will likely need to increase the allocated memory location of the kernel image and device tree file by adjusting these U-Boot variables accordingly, e.g.:
    Marvell>> setenv fdt_addr 0x1500000
    Marvell>> setenv kernel_addr 0x5000000