Setting up the Build Environment - FrankBau/meta-marsboard-bsp GitHub Wiki

A desktop Linux build host is needed for cross-compilation and building all packages and the embedded Linux image. For reference, Ubuntu 16.04 on a 64-Bit machine with i7 quad-core CPU, 32 GB of main memory and two fast SDDs was used. Expect 30 to 90 GB of disk space for a clean build which may last 2 hours or more on this machine.

Using a fast laptop is also possible. Using a virtual machine is nearly impossible because the build process needs fast CPUs, lots of memory and a fast disk.

Sudo access is not needed for the Yocto build process, but the user on the build host must be able to sudo for

  • installing software packages (sudo apt-get install ...)
  • Prepare SD card (dd, mount, fdisk, ...)
  • open a system console on the target via a terminal program (recommended: minicom)

Setup Linux Build Host

Check the Yocto Project documentation "3. Setting Up to Use the Yocto Project" and install the packages needed for your distribution.

In addition, you need to install the repo utiliy which might be available as a package:

sudo apt-get install repo

If not, you may install it from the sources:

mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo 

Get the Freescale Community BSP Source Code

The source code from the Freescale Community BSP located at https://github.com/Freescale/fsl-community-bsp-platform/tree/master will be used for development plus a tiny board specific layer (meta-marsboard) from this repository.

Read and follow the README from https://github.com/Freescale/fsl-community-bsp-platform/tree/master. The last instructions will setup the fsl-community-bsp (meta-)source code:

mkdir mars
cd mars
repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b pyro
repo sync 

The top level directory (in this example: mars) is called BSPDIR in Yocto.

Note that one cannot move the directory tree to another top level directory later, because the absolute path will be hardcoded in nearly every build artefact. Choose BSPDIR carefully.

You may repeat repo sync later to stay in touch with remote updates. But, be careful not to loose your current work! You may also change to a newer branch as they become available.

Add the MarS Board layer

It's assumed you are in BSPDIR.

cd sources
git clone -b pyro https://github.com/FrankBau/meta-marsboard-bsp

(Use the same branch as for the Freescale Community BSP)

This will create a meta-marsboard-bsp folder parallel to the existing meta-* folders.

Now, return to the BSPDIR and enter

  MACHINE=marsboard DISTRO=fslc-framebuffer source setup-environment build

This will create a build folder where all build artefacts will be created. That folder also contains some configuration files which need to be adapted next.

Goto the build folder and edit the bblayers.conf file in the conf subfolder. In the bblayers.conf file, add a last line to the list of layer describing the meta-marsboard-bsp layer as follows:

BBLAYERS = " \
  ${BSPDIR}/sources/poky/meta \
  ${BSPDIR}/sources/poky/meta-poky \
  \
  ${BSPDIR}/sources/meta-openembedded/meta-oe \
  ${BSPDIR}/sources/meta-openembedded/meta-multimedia \
  \
  ${BSPDIR}/sources/meta-freescale \
  ${BSPDIR}/sources/meta-freescale-3rdparty \
  ${BSPDIR}/sources/meta-freescale-distro \
  \
  ${BSPDIR}/sources/meta-marsboard-bsp \
"

There is another important file in the conf subfolder: local.conf. It contains many settings (like the MACHINE name) and may also be used to add more packages to images.

Check resp. change the machine definition in local.conf. It should be:

MACHINE ??= 'marsboard'
DISTRO ?= 'fslc-framebuffer'

Now you are ready to build a first Linux image from the build folder:

bitbake core-image-minimal 

Further Reading: