TipsAndTricks/CropsCLIContainers: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
Line 25: Line 25:


=== eSDK ===
=== eSDK ===
The eSDK container is also generic in that it takes an extensible sdk install script as an argument so it can be used with a fairly arbitrary ext-sdk.
The eSDK container is also generic in that it takes an extensible sdk install script as an argument so it can be used with a fairly arbitrary ext-sdk. It works equally well with an old fashioned sdk (e.g. one without devtool but with a sysroot and a toolchain).
 
=== Toaster ===
=== Toaster ===
Toaster is more complicated.  To facilitate quick startup, the Toaster containers include a database prepopulated from the layer index https://layers.openembedded.org.  Because of this, the toaster containers come in a couple of varieties.
Toaster is more complicated.  To facilitate quick startup, the Toaster containers include a database prepopulated from the layer index https://layers.openembedded.org.  Because of this, the toaster containers come in a couple of varieties.

Revision as of 21:00, 29 August 2017

CROPS or How to Run bitbake/devtool/eSDK/Toaster on Your MacWinux Host

Introduction

CROPS provides CLI containers that allow you to run the set of tools listed in the title on Mac OSX, Windows or Linux. The containers themselves are available on Dockerhub at https://hub.docker.com/u/crops/dashboard/

You may wonder why you would use these containers on Linux. The main reason is it gives you a guaranteed clean environment from which to build. Also it means you don't need to install the dependent packages required by the build tools. Measurements show no speed degradation when running in the container. This wiki assumes you have followed the basic documentation on the CROPS github Readme's (like https://github.com/crops/poky-container) and are looking for more tips.


NOTE: ALL the CROPS containers take a --help argument in case you forget the options! For example:

 docker run -it --rm crops/poky --help
usage: poky-entry.py [-h] [--workdir WORKDIR] [--id ID]
optional arguments:
 -h, --help         show this help message and exit
 --workdir WORKDIR  The active directory once the container is running. In
                    the abscence of the "id" argument, the uid and gid of the
                    workdir will also be used for the user in the container.
 --id ID            uid and gid to use for the user inside the container. It
                    should be in the form uid:gid

Variations Explained

Poky

The default Poky container is quite generic and will work with most recent releases of YP. Despite the name, it simply contains all the dependent packages required by Poky but not the meta-data. It will work equally well for an OE Core setup. The default container is based on the latest Ubuntu LTS that YP supports. We are in the process of creating ones based on the rest of the standard supported Linux Distro's. For the common usage; however, which Distro is inside is irrelevant since everything is already set up for the user.

eSDK

The eSDK container is also generic in that it takes an extensible sdk install script as an argument so it can be used with a fairly arbitrary ext-sdk. It works equally well with an old fashioned sdk (e.g. one without devtool but with a sysroot and a toolchain).

Toaster

Toaster is more complicated. To facilitate quick startup, the Toaster containers include a database prepopulated from the layer index https://layers.openembedded.org. Because of this, the toaster containers come in a couple of varieties.

Operating System Oddities

While the purpose of the CROPS cli containers is to insulate the user from the vagaries of the host os, sometimes the oddness creeps in. Here's some of the host specific issues we've run into so far in case they affect you too.

Mac OSX

Samba/Files

Sometimes you may find yourself unable to delete files from you docker volume from the host os. If you see something like:


$ rm  /Volumes/workdir/.git/objects/pack/pack-67ce6b1222786a14656905bd779637f00fb7225e.pack
override rwxrwxrwx  bavery/staff arch,uchg for/Volumes/workdir/.git/objects/pack/pack-67ce6b1222786a14656905bd779637f00fb7225e.pack? y

it means that a flag has been set that is preventing you from deleting the file. To see what flags are set on the file do:


$ls -lO /Volumes/workdir/.git/objects/pack/pack-67ce6b1222786a14656905bd779637f00fb7225e.pack
-rwxrwxrwx  1 bavery  staff  arch,uchg 34188262 Oct 31 16:07 /Volumes/workdir/.git/objects/pack/pack-67ce6b1222786a14656905bd779637f00fb7225e.pack

In the above example , the uchg (user immutable) and arch (arvhived) flags are set. These need to be cleared using the command chflags To clear them do:


$chflags  noarch,nouchg   /Volumes/workdir/.git/objects/pack/pack-67ce6b1222786a14656905bd779637f00fb7225e.pack

Then you can rm the file. Alternatively, you could do the rm from with in a container and the linux side is less persnickety.

Windows

The biggest issue for Windows so far is that Windows 10 Pro, Enterprise, and Education can use Docker for Windows while earlier versions of Windows need to use Docker Toolbox. Docker for Windows matches what is used on the Mac and is very similar to the experience on Linux. Docker Toolbox insets a VM (by default Virtualbox) in between the host and the cotainers.

Issues with File Paths

While the default way to run the containers (using crops/poky as an example but this applies equally well to the others).

 docker run --rm -it -v /home/myuser/mystuff:/workdir crops/poky --workdir=/workdir

highlights the fact that the directory path inside the container is independent of the directory path on the host, this can sometimes be confusing. So, it is also quite reasonable to run the container like so:

cd /home/myuser/mystuff
docker run --rm -it -v $(pwd):$(pwd) crops/poky --workdir=$(pwd)

This way, inside the container you have the same directory path as you do outside of the container. For things like

devtool modify busybox
devtool find-recipe busybox

this can make cutting and pasting easier from the "in container terminal" which lacks an editor into the editor or terminal with an editor on the host system.