This application note explains how to use a prebuilt container image for development.
Perform the following steps:
- Pull the docker image (11GB):
$ docker pull ghcr.io/emcraftsystems/ubuntu14-6ull:latest
...
- Prepare a directory on the host to map to the docker:
$ mkdir docker-work
$ chmod 777 docker-work
- Run the docker:
$ docker run -i -t --security-opt "label=disable" -v `pwd`/docker-work:/work ghcr.io/emcraftsystems/ubuntu14-6ull:latest
dev@8a2a7bac0970:/home/dev$ ls -l
total 8
-rw-r--r-- 1 dev dev 521 Sep 8 16:28 README.txt
drwxr-xr-x 14 dev dev 4096 Sep 8 15:22 yocto-1.8.1-emcraft
dev@8a2a7bac0970:/home/dev$ ls -l /work
total 0
dev@8a2a7bac0970:/home/dev$
- Install the BSP: on the host, copy it to the shared directory and then unpack in the docker:
dev@89639e42b08d:/home/dev$ ls /work/
total 133328
linux-imx6ull-2.4.4.tar.bz2
dev@89639e42b08d:/home/dev$
- Build the bootable images:
dev@89639e42b08d:/home/dev$ cd linux-imx6ull-2.4.4/
dev@89639e42b08d:/home/dev/linux-imx6ull-2.4.4$ source ./ACTIVATE.sh
dev@89639e42b08d:/home/dev/linux-imx6ull-2.4.4$ cd projects/rootfs/
dev@89639e42b08d:/home/dev/linux-imx6ull-2.4.4/projects/rootfs$ make
...
dev@89639e42b08d:/home/dev/linux-imx6ull-2.4.4/projects/root$ ls
...
rootfs.dtb
rootfs.uImage
rootfs.ubi
- If you need to keep the project's changes in the container image, do not exit the image, commit the changes to the docker. Run on the host:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
89639e42b08d ghcr.io/emcraftsystems/ubuntu14-6ull:latest "/bin/bash" 10 minutes ago Up 10 minutes affectionate_payne
$ docker commit 89639e42b08d ghcr.io/emcraftsystems/ubuntu14-6ull:latest
...
- Exit the docker.
Perform the following steps tо add a new package to the Yocto's packages collection and to the project:
- Start the docker image:
$ docker run -i -t --security-opt "label=disable" -v `pwd`/docker-work:/work ghcr.io/emcraftsystems/ubuntu14-6ull:latest
dev@8e360c1341d7:/home/dev$
- Activate Yocto build environment:
dev@8e360c1341d7:/home/dev$ cd yocto-1.8.1-emcraft
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft$
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft$ source oe-init-build-env build
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$
- As an example, add the vim package to the packages collection. Edit core-image-qte-sdk.bb and add vim to the IMAGE_INSTALL list:
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$ emacs ../meta-emcraft/recipes-qt/images/core-image-qte-sdk.bb
...
tcsh \
vim \
"
export IMAGE_BASENAME = "core-image-qte-sdk"
...
- Download and install Yocto build cache (6GB):
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$ wget https://emcraft.com/misc/sstate-cache-6ull-1.8.1.tar .
...
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$ tar xf sstate-cache-6ull-1.8.1.tar
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$ rm sstate-cache-6ull-1.8.1.tar
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$ ls -l
total 32
-rw-r--r-- 1 dev dev 0 Sep 8 18:44 bitbake.lock
drwxr-xr-x 1 dev dev 4096 Sep 8 18:44 cache
drwxr-xr-x 1 dev dev 4096 Sep 8 15:24 conf
drwxr-xr-x 259 dev dev 4096 Sep 7 13:38 sstate-cache
drwxr-xr-x 1 dev dev 4096 Sep 8 16:05 tmp
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$
- Rebuild the package collection and check that the vim package now exists:
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$ bitbake core-image-qte-sdk
Loading cache:
...
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$ find tmp/deploy/ipk/ -name vim*
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim-dbg_7.4.481-r0_cortexa5hf-vfp-neon.ipk
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim-common_7.4.481-r0_cortexa5hf-vfp-neon.ipk
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim-help_7.4.481-r0_cortexa5hf-vfp-neon.ipk
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim-vimrc_7.4.481-r0_cortexa5hf-vfp-neon.ipk
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim-doc_7.4.481-r0_cortexa5hf-vfp-neon.ipk
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim-tutor_7.4.481-r0_cortexa5hf-vfp-neon.ipk
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim_7.4.481-r0_cortexa5hf-vfp-neon.ipk
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim-syntax_7.4.481-r0_cortexa5hf-vfp-neon.ipk
tmp/deploy/ipk/cortexa5hf-vfp-neon/vim-dev_7.4.481-r0_cortexa5hf-vfp-neon.ipk
dev@8e360c1341d7:/home/dev/yocto-1.8.1-emcraft/build$
- On the host, start a new shell in the running docker:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8e360c1341d7 ghcr.io/emcraftsystems/ubuntu14-6ull:latest "/bin/bash" 29 minutes ago Up 29 minutes quirky_ritchie
$ docker exec -it 8e360c1341d7 bash
dev@8e360c1341d7:/home/dev$
- Check that vim is now available to add to the target image:
dev@8e360c1341d7:/home/dev/linux-imx6ull-2.4.4$ source ./ACTIVATE.sh dev@8e360c1341d7:/home/dev/linux-imx6ull-2.4.4$ cd projects/rootfs/ dev@8e360c1341d7:/home/dev/linux-imx6ull-2.4.4/projects/rootfs$ emacs rootfs.initramfs
...
opkg wt
opkg vim
- Exit with save.
dev@8e360c1341d7:/home/dev/linux-imx6ull-2.4.4/projects/rootfs$ make
...
dev@8e360c1341d7:/home/dev/linux-imx6ull-2.4.4/projects/rootfs$