Project

General

Profile

Docker build environment

https://docs.docker.com/get-started/overview/

Docker images are used to provide a consistent/known environment of which we can run our builds.

These instructions assume you are running Ubuntu Linux 18.04+ 64-bit
Note: Running these steps using a VM or Windows Subsystem for Linux may work but might result in some disk performance issues

Docker engine

  • Install docker engine: https://docs.docker.com/engine/install/ubuntu/
    $ sudo apt-get remove docker docker-engine docker.io containerd runc
    $ sudo apt-get update
    $ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    $ sudo add-apt-repository \
       "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
       $(lsb_release -cs) \
       stable" 
    $ sudo apt-get update
    $ sudo apt-get install docker-ce docker-ce-cli containerd.io
    $ sudo docker run hello-world
    
    • Note: If you are running in a proxy environment, these commands will not work as-is. You will need to configure docker and possibly your OS to use your network proxy. Please confirm your version of Docker and then follow https://docs.docker.com/network/proxy/ for more information.
  • Allow your user to run docker commands https://docs.docker.com/engine/install/linux-postinstall/
    Warning: The docker group grants privileges equivalent to the root user
    $ sudo usermod -aG docker $USER
    $ sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
    $ sudo chmod g+rwx "$HOME/.docker" -R
    $ newgrp docker 
    $ docker run hello-world
    $ sudo systemctl enable docker
    

U-boot/Kernel/Yocto

Reference

The crops/poky:ubuntu-18.04 image is setup with all the packages to build Yocto images and we can also use it to build U-boot and the Kernel.

Setup

  • Download a prebuilt toolchain from ARM and extract it to /home/tools (You can put it wherever you like, you'll just need to update the instructions accordingly)
    $ mkdir -p /home/tools/mitysom-57x/
    $ wget https://developer.arm.com/-/media/Files/downloads/gnu-a/8.3-2019.03/binrel/
    gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf.tar.xz -O - | tar -Jxv -C /home/tools/mitysom-57x/
    
  • Pull crops/poky image and echo test
    docker pull crops/poky:ubuntu-18.04
    docker run --rm crops/poky:ubuntu-18.04 echo Test
    

Usage

If we mount our local directory into the docker container we can enter the docker container and run our builds.
  • cd to your work directory
  • Launch poky image
     $ docker run --rm -it -v $PWD:/work -v /home/tools:/home/tools --env "TOOLCHAIN_PATH_ARMV7=/home/tools/mitysom-57x/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf" crops/poky:ubuntu-18.04 --workdir=/work
    pokyuser@e34e187356b3:/workdir$ id
    uid=9338(pokyuser) gid=502(pokyuser) groups=502(pokyuser)

    Explanation:
    docker run Run a command in a new container
    --rm Automatically remove the container when it exits
    -it Allows interracting with container over STDIN
    -v $PWD:/work Mounts current directory to /workdir inside container
    -v /home/tools:/home/tools Mount tools directory so we can access downloaded toolchain
    --env "TOOLCHAIN_PATH_ARMV7=/home/tools/mitysom-57x/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf" Set environment variable needed for processor-sdk Yocto build
    crops/poky:ubuntu-18.04 Selects docker image to run
    --workdir=/work Tells crops poky-entry.py script to create a user pokyuser with a matching user id and group id of the owner of /work

Alternatively, we can run a command directly (echo Test) and the docker container will exit when the command finishes.

 $ docker run --rm -it -v $PWD:/work -v /home/tools:/home/tools --env "TOOLCHAIN_PATH_ARMV7=/home/tools/mitysom-57x/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf" crops/poky:ubuntu-18.04 --workdir=/work echo Test
Test

All of this can be wrapped into a bash script so we don't forget. docker-poky.sh

Using your Docker image for Yocto Development

There are many ways to use your Docker image for development depending on your needs. Once you have completed the Docker setup previously described, you can use the Yocto project to build your own kernel, U-Boot, and filesystem.

Critical Link uses TI's Yocto infrastructure to generate the MitySOM-AM57x binaries listed under the Files tab.

These instructions will show you how to create a Yocto build structure interactively. Once you are comfortable with the setup, you can script it using a build server (e.g. Jenkins) for repeatable builds.

First, create a development directory and start your docker image and run a shell:

 $ mkdir devel
 $ cd devel
 $ docker run --rm -it -v $PWD:/work -v /home/tools:/home/tools --env "TOOLCHAIN_PATH_ARMV7=/home/tools/mitysom-57x/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf" crops/poky:ubuntu-18.04 --workdir=/work

This will give you a shell prompt inside the docker image. Go to the /work directory (actually the devel directory outside of the docker image) and run the following commands:

Starting with UID : 9337
user@8ec23474095b:~$ cd /work
user@8ec23474095b:~$ git clone  --single-branch --branch criticallink https://support.criticallink.com/git/oe-layersetup.git
user@8ec23474095b:~$ cd oe-layersetup
user@8ec23474095b:~$ ./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-06.03.00.106-cl-external-config.txt

This will download many Yocto repositories, including Critical Link's meta-mitysom.

Now, enter the build directory and configure your local.conf. These additions to the local.conf are optional but recommended. The rm_work option helps reduce disk usage and the archiver options are used to save the source code used for your builds. Finally the source command sets up your build environment.

 
user@8ec23474095b:~$ cd build
user@8ec23474095b:~$ source conf/setenv
user@8ec23474095b:~$ echo 'INHERIT           += "rm_work" '    >> conf/local.conf
user@8ec23474095b:~$ echo 'INHERIT           += "archiver"'    >> conf/local.conf
user@8ec23474095b:~$ echo 'ARCHIVER_MODE[src] = "original"'     >> conf/local.conf

At this point, your Yocto build environment is configured and you can bring your build. As a starting point, you could build a filesystem, kernel, and U-Boot compatible with our MitySOM-AM57x Dev Board by running:

user@8ec23474095b:~$ MACHINE=mitysom-am57x bitbake arago-base-tisdk-image

You can also build a full SDK using:

user@8ec23474095b:~$  MACHINE=mitysom-am57x bitbake arago-core-tisdk-bundle

Or a TBD using:

user@8ec23474095b:~$ MACHINE=mitysom-am57x bitbake meta-toolchain-arago-tisdk

A Note about Yocto Errors

A full Yocto build will stress your CPU, RAM, and disk space. This can sometimes cause errors that are difficult to troubleshoot.

If you get a error in a recipe that you did not modify, and you are certain there is not a RAM or disk space problem, you can usually clear the offending error by building the package independently.

user@8ec23474095b:~$ MACHINE=mitysom-am57x bitbake arago-base-tisdk-image
... <Various status and output from each recipe> ...
NOTE: recipe vlib-c66x-3_2_1_0-r0: task do_populate_lic: Started
WARNING: vlib-c66x-3_2_1_0-r0 do_populate_lic: Could not copy license file /work/build/arago-tmp-external-arm-toolchain/work/armv7at2hf-neon-linux-gnueabi/vlib-c66x/3_2_1_0-r0/vlib_c66x_3_2_1_0/docs/VLIB_Software_Manifest.html to /work/build/arago-tmp-external-arm-toolchain/work/armv7at2hf-neon-linux-gnueabi/vlib-c66x/3_2_1_0-r0/license-destdir/vlib-c66x/VLIB_Software_Manifest.html: [Errno 2] No such file or directory: '/work/build/arago-tmp-external-arm-toolchain/work/armv7at2hf-neon-linux-gnueabi/vlib-c66x/3_2_1_0-r0/vlib_c66x_3_2_1_0/docs/VLIB_Software_Manifest.html'
ERROR: vlib-c66x-3_2_1_0-r0 do_populate_lic: QA Issue: vlib-c66x: LIC_FILES_CHKSUM points to an invalid file: /work/build/arago-tmp-external-arm-toolchain/work/armv7at2hf-neon-linux-gnueabi/vlib-c66x/3_2_1_0-r0/vlib_c66x_3_2_1_0/docs/VLIB_Software_Manifest.html [license-checksum]
ERROR: vlib-c66x-3_2_1_0-r0 do_populate_lic: Fatal QA errors found, failing task.
ERROR: vlib-c66x-3_2_1_0-r0 do_populate_lic: Function failed: populate_lic_qa_checksum
ERROR: Logfile of failure stored in: /work/build/arago-tmp-external-arm-toolchain/work/armv7at2hf-neon-linux-gnueabi/vlib-c66x/3_2_1_0-r0/temp/log.do_populate_lic.32041
NOTE: recipe vlib-c66x-3_2_1_0-r0: task do_populate_lic: Failed
ERROR: Task (/work/sources/meta-ti/recipes-ti/vlib/vlib-c66x_3.2.1.0.bb:do_populate_lic) failed with exit code '1'

In this case, the build was stopped due to an error in the vlib-c66x-3_2_1_0-r0. The error is complaining that it can't find "VLIB_Software_Manifest.html." Instead of just restarting the build, you can run the following commands to reset the vlib-c66x recipe and build it independently:
user@8ec23474095b:~$ MACHINE=mitysom-am57x bitbake -c clean vlib-c66x
user@8ec23474095b:~$ MACHINE=mitysom-am57x bitbake vlib-c66x

If that succeeds, the result will be cached and you can re-run your previous bitbake command (e.g. MACHINE=mitysom-am57x bitbake arago-base-tisdk-image).

Yocto Linux Kernel Build

You can change the configuration of the kernel by running:

user@8ec23474095b:~$ MACHINE=mitysom-am57x bitbake -c menuconfig virtual/kernel

Then, to build the kernel:

user@8ec23474095b:~$ MACHINE=mitysom-am57x bitbake virtual/kernel

Yocto U-Boot Build

user@8ec23474095b:~$ MACHINE=mitysom-am57x bitbake virtual/bootloader

Linux applications

TODO

FPGA software

TODO

DSP software

TODO

docker-poky.sh View (938 Bytes) Jonathan Cormier, 08/05/2020 09:09 PM

Add picture from clipboard (Maximum size: 2 GB)