R-Car/Boards/Yocto-Gen3/Docker

From eLinux.org
Jump to: navigation, search


Introduction

This page contains information to use the Docker engine with Yocto on:

Yocto versions

Poky-2.4.3 is supported with Yocto v3.21.0.
Specific commits of meta-openembedded and meta-virtualization are required.

Host PC

Ubuntu 16.04 LTS (64bit) is recommended as OS. 32bit version is not supported.

Required packages

  1. Install required packages
    Ubuntu and Debian
    sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
         build-essential chrpath socat libsdl1.2-dev xterm python-crypto cpio python python3 \
         python3-pip python3-pexpect xz-utils debianutils iputils-ping libssl-dev
    
    Fedora
    sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \
         diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
         ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue socat \
         SDL-devel xterm python-crypto cpio python python3 python3-pip python3-pexpect \
         ghc-lzma-conduit iputils openssl
    
    Refer to Yocto Project Quick Start for more information.

Building the image for Renesas H3 Starter Kit, M3 Starter Kit

Build using manual steps

  1. Create a directory and switch to it
    Warning! Yocto builds require a lot of disk space (up to 100 GB). Make sure you have got enough before starting the build.
    mkdir build
    cd build
    export WORK=`pwd`
    
  2. Clone basic Yocto layers:
    cd $WORK
    git clone git://git.yoctoproject.org/poky
    git clone git://git.openembedded.org/meta-openembedded
    git clone git://git.linaro.org/openembedded/meta-linaro.git
    git clone git://github.com/renesas-rcar/meta-renesas
    git clone git://git.yoctoproject.org/meta-virtualization
    
  3. Switch to proper branches/commits
    cd $WORK/poky
    git checkout -b tmp 7e7ee662f5dea4d090293045f7498093322802cc
    cd $WORK/meta-openembedded
    git checkout -b tmp 352531015014d1957d6444d114f4451e241c4d23
    cd $WORK/meta-linaro
    git checkout -b tmp 75dfb67bbb14a70cd47afda9726e2e1c76731885
    cd $WORK/meta-renesas
    git checkout -b tmp 70d47c56f04a7ee78597770b88de68a59c56a4aa
    cd $WORK/meta-virtualization
    git checkout -b tmp b704c689b67639214b9568a3d62e82df27e9434f
    
  4. Prepare Kernel configuration files.
    Download File:Docker-config R-Car v3.21.0.txt and copy it into meta-renesas (with renaming *.txt to *.cfg).
    cp docker-config_R-Car_v3.21.0.txt $WORK/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/docker-config.cfg
    vi $WORK/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb
    

    Add the following lines to linux-renesas_4.14.bb.
    SRC_URI_append = " \
        file://docker-config.cfg \
    "
    
  5. Setup build environment
    cd $WORK
    source poky/oe-init-build-env $WORK/build
    
  6. Prepare default configuration files.
    cp $WORK/meta-renesas/meta-rcar-gen3/docs/sample/conf/<h3ulcb|m3ulcb>/poky-gcc/bsp/*.conf ./conf/
    cd $WORK/build
    
  7. Edit local.conf for the docker requirements:
    # Docker presumes systemd
    DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
    VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
    
    # add docker to the image
    # connman to manage the networking
    IMAGE_INSTALL_append = " docker docker-contrib connman connman-client"
    CORE_IMAGE_EXTRA_INSTALL_append = " kernel-modules"
    
  8. Add meta-virtualization layer and dependent layers to bblayers.conf
    bitbake-layers add-layer ../meta-openembedded/meta-python
    bitbake-layers add-layer ../meta-openembedded/meta-networking
    bitbake-layers add-layer ../meta-openembedded/meta-filesystems
    bitbake-layers add-layer ../meta-virtualization
    
  9. Start the build
    bitbake core-image-minimal
    
  10. Building image can take up to a few hours depending on your host system performance.
    After the build has been completed successfully, you should see the output similar to:
    NOTE: Tasks Summary: Attempted 3801 tasks of which 31 didn't need to be rerun and all succeeded.
    
    and the command prompt should return.
  11. Bitbake has generated all the necessary files in ./tmp/deploy/images directory.
    You can verify its content:
    $ ls -1 `find ./tmp/deploy/images/h3ulcb/ -maxdepth 1 -type l -print`
    ./tmp/deploy/images/h3ulcb/core-image-minimal-h3ulcb.cpio.gz
    ./tmp/deploy/images/h3ulcb/core-image-minimal-h3ulcb.ext4
    ./tmp/deploy/images/h3ulcb/core-image-minimal-h3ulcb.manifest
    ./tmp/deploy/images/h3ulcb/core-image-minimal-h3ulcb.tar.bz2
    ./tmp/deploy/images/h3ulcb/Image
    ./tmp/deploy/images/h3ulcb/Image-h3ulcb.bin
    ./tmp/deploy/images/h3ulcb/Image-r8a7795-es1-h3ulcb.dtb
    ./tmp/deploy/images/h3ulcb/Image-r8a7795-h3ulcb-4x2g.dtb
    ./tmp/deploy/images/h3ulcb/Image-r8a7795-h3ulcb.dtb
    ./tmp/deploy/images/h3ulcb/modules-h3ulcb.tgz
    ./tmp/deploy/images/h3ulcb/u-boot.bin
    ./tmp/deploy/images/h3ulcb/u-boot-elf-h3ulcb.srec
    ./tmp/deploy/images/h3ulcb/u-boot-elf.srec
    ./tmp/deploy/images/h3ulcb/u-boot-h3ulcb.bin
    
    Image is a Kernel image, *.dtb is a blob file, core-image-minimal-h3ulcb.tar.bz2 is the rootfs, modules-h3ulcb.tgz are kernel modules.
  12. You can now proceed with "Running Yocto images"