Loading...
 

Build from source - Yocto


This tutorial provides instructions for building Yocto binaries for ESPRESSObin. In-detail requirements for building Yocto on a Linux build machine can be read in this document section 18.3.1 Support Linux Distributions. In this tutorial we will be building Yocto on Ubuntu 14.04.

Setting up build directories


First we will create a directory where we will download Yocto sources (e.g. /opt/yocto) and head into that directory:

user@laptop:~$ mkdir /opt/yocto && cd /opt/yocto
user@laptop:/opt/yocto$


Now we will download Marvell Yocto source code for ESPRESSObin:

# install repo and other necessary bitbake packages if needed, e.g. on Ubuntu:
user@laptop:/opt/yocto$ sudo apt-get install repo diffstat texi2html texinfo subversion chrpath gettext
# download Marvell sources
user@laptop:/opt/yocto$ repo init -u https://github.com/MarvellEmbeddedProcessors/marvell-embedded-linux-platform.git -b krogoth
# synchronize all files
user@laptop:/opt/yocto$ repo sync


After updates have been installed, select the correct MACHINE for ESPRESSObin. We will also create a directory (here espressobin) which will contain build configuration and output:

user@laptop:/opt/yocto$ MACHINE=cb-88f3720-ddr3-expbin . setup-environment espressobin


After this command is executed, it will automatically change our location to the espressobin subdirectory. From there we will run bitbake command to build the root filesystem and kernel binaries for ESPRESSObin:

 Note

Depending on the speed of your internet connection and build machine, the build process could take a while to finish. Since it includes downloading sources from the Internet, make sure to have a stable Internet connection throughout the build process.

 

user@laptop:/opt/yocto/espressobin$ bitbake marvell-image-machine-test


After the build is finished, you can find the newly built rootfs tarball and kernel image containing the dtb file in the espressobin/tmp/deploy/images/cb-88f3720-ddr3-expbin/ subdirectory. So, head into it and check the contents of the directory:

user@laptop:/opt/yocto/espressobin$ cd tmp/deploy/images/cb-88f3720-ddr3-expbin/
user@laptop:/opt/yocto/espressobin/tmp/deploy/images/cb-88f3720-ddr3-expbin$    ls
Image
Image--4.4.8-r0.2-armada-3720-community-20170329203229.dtb
Image--4.4.8-r0.2-cb-88f3720-ddr3-expbin-20170329203229.bin
Image-armada-3720-community.dtb
Image-cb-88f3720-ddr3-expbin.bin
marvell-image-machine-test-cb-88f3720-ddr3-expbin-20170329203229.license_manifest
marvell-image-machine-test-cb-88f3720-ddr3-expbin-20170329203229.license_manifest.csv
marvell-image-machine-test-cb-88f3720-ddr3-expbin-20170329203229.rootfs.manifest
marvell-image-machine-test-cb-88f3720-ddr3-expbin-20170329203229.rootfs.tar.bz2
marvell-image-machine-test-cb-88f3720-ddr3-expbin.license_manifest
marvell-image-machine-test-cb-88f3720-ddr3-expbin.license_manifest.csv
marvell-image-machine-test-cb-88f3720-ddr3-expbin.manifest
marvell-image-machine-test-cb-88f3720-ddr3-expbin.tar.bz2
modules--4.4.8-r0.2-cb-88f3720-ddr3-expbin-20170329203229.tgz
modules-cb-88f3720-ddr3-expbin.tgz
README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt


The files which will be important for us here are the rootfs package (marvell-image-machine-test-cb-88f3720-ddr3-expbin.tar.bz2), kernel image (Image-cb-88f3720-ddr3-expbin.bin) and the dtb file for ESPRESSObin (Image-armada-3720-community.dtb).

Now we can copy kernel and dtb file and extract the root filesystem to a MicroSD card. Go to Boot from removable storage - Yocto to see how to transfer these files to SD card and boot ESPRESSObin from it.

Building Image with latest changes


In order to pick up recent changes made for ESPRESSObin, we can modify the Yocto source code to include the latest updates.

For example, to use the new version of the kernel source for ESPRESSObin, we can update the file linux-marvell_4.4.8.bb in the directory sources/meta-marvell/recipes-kernel/linux to use the tip of the kernel branch linux-4.4.8-armada-17.02-espressobin from the kernel repository github.com/MarvellEmbeddedProcessors/linux-marvell.git.

Below is an example of how to update the file to pick up the new branch and commit for ESPRESSObin. Open the file in your favorite editor:

user@laptop:/opt/yocto$ vim sources/meta-marvell/recipes-kernel/linux/linux-marvell_4.4.8.bb


and edit it to pick up the latest changes from linux-4.4.8-armada-17.02-espressobin branch:

SOC_SRC_URI = "git://git@github.com/MarvellEmbeddedProcessors/linux-marvell.git;protocol=https"
SRCBRANCH = "linux-4.4.8-armada-17.02-espressobin"
SRCREV = "8148be99814b2cb1ea560a2da0aaf18a3449e29c"

SRC_URI += "${@bb.utils.contains('TUNE_FEATURES', 'bigendian', 'file://big-endian.cfg', '', d)}"

SRC_URI_append_clearfog = " \

file://iptables.cfg \
"

COMPATIBLE_MACHINE = "(armada37xx|armada38x|armada70xx|armada80xx)"


Save the changes and exit your editor. Now rebuild Yocto with bitbake marvell-image-machine-test. After the build is finished, the images and root filesystem package will again be located in tmp/deploy/images/cb-88f3720-ddr3-expbin/ subdirectory, from where they can be copied to a boot media (USB or microSD card) and used to start the ESPRESSObin board.