Developer Workflow Improvements: Difference between revisions
Henry Bruce (talk | contribs) |
Henry Bruce (talk | contribs) |
||
Line 23: | Line 23: | ||
== Creating Extensible SDK == | == Creating Extensible SDK == | ||
These tasks are performed by os-dev | These tasks are performed by os-dev | ||
# On OS of your choice start containerized | # On OS of your choice start containerized Poky or Toaster instance. If running on Windows or Mac you must also start the samba container so that host OS has access to files in the container. | ||
# Add new | # Add new layers and packages as required to create OS on which applications will run | ||
# Build image and validate | # Build image and validate | ||
# | # Create and publish components required for app development | ||
## OS image | ## OS image | ||
## eSDK installer | ## eSDK installer |
Revision as of 00:02, 25 October 2016
Back to Yocto Project Main Page
Introduction
The page describes how new tools such as Toaster, Extensible SDK (eSDK) and CROPS make it easier to get the best out of Yocto. We envisage two distinct workflows, layer maintenance and application development.
Layer Maintenance
- Layers and recipes are edited as necessary. Poky or Toaster is used to build image that exercises layers under test
Application Development
- Poky or Toaster is used to generate a minimal eSDK installer.
- A developer uses resulting eSDK to create/modify an application by using devtool (iterative process).
- Once application is complete its recipe is added to a layer and Toaster is used to build an image that includes it
There are two personas in this scenario; 'os-dev' who maintains the OS image and generates its extensible SDK and the 'app-dev' who creates new C/C++ applications to run on OS. The scenario assumes that an early version of the application exists but it needs features added and to be integrated into OS image. We recognize that in smaller organizations the roles of os-dev and app-dev may be blurry but the concept of two separate personas simplifies description of workflow.
The set-up instructions at the end of this page represent the "what can currently be done" version of the workflows.
I have a concern that the focus on C/C++ is misplaced as IoT is not proving to be just more embedded development as we knew it. Other languages are proving popular, with many pundits putting JavaScript at the forefront. [1] [2] [3]
Workflow Vision
This section calls out the workflows in more detail, describing specific use of tools in each step.
Creating Extensible SDK
These tasks are performed by os-dev
- On OS of your choice start containerized Poky or Toaster instance. If running on Windows or Mac you must also start the samba container so that host OS has access to files in the container.
- Add new layers and packages as required to create OS on which applications will run
- Build image and validate
- Create and publish components required for app development
- OS image
- eSDK installer
- eSDK updater files
- sstate-cache (created by building image and its eSDK)
Application Development
- One time set-up on OS of your choice
- app-dev: On OS of your choice optionally install Eclipse and CROPS plug-in. Development can also be done on the command line.
- app-dev: Create docker volume so that files fetched and created in the container are visible to host OS.
- app-dev: Use extensible SDK container to install eSDK to volume.
- App development
- app-dev: Start extensible SDK container so you can run devtool from command line or invoke it from Eclipse plug-in.
- app-dev: Start samba container so that files are visible to host OS
- app-dev: Use devtool to 'add' application project. This pulls down source code, tries to work out dependent packages and generates a recipe
- app-dev: Although generated recipe will likely build, it may need some tweaks to some of the tasks (e.g. configure, compile, install)
- app-dev: Once app is building, iteratvely develop using devtool to deploy and test on target
- app-dev: Check in "completed" code
- app-dev: Edit recipe until it builds app correctly
- app-dev: Build new image using Eclipse devtool plug-in and test
- app-dev: Hand off recipe to os-dev
- os-dev: Create base image
- os-dev: Add recipe to layer or create a new one
- os-dev: Add new layer and application package to Toaster
- os-dev: Build image and validate
Layer Maintenance
- os-dev: On OS of your choice install containerized 'production' toaster instance. There will a number of containers; one with toaster and core tools, the other with a toaster database. These will have to be hooked together via bind mounts. Details TBD.
- os-dev: Set up your base distro build with toaster by simply importing appropriate configuration (e.g. Ostro)
- os-dev: Add layer(s) required by packages you add to image
- os-dev: Update and/or add layers as required with iterative image builds
- os-dev: Push layer updates to appropriate repo when done
- os-dev: Add new layer and application package to Toaster
- os-dev: Build image and validate
Missing Features
These are the features currently missing from the above workflow vision. Think of these as stories in an Agile development environment, rather than bugs. Where possible these are linked to bugzilla entries.
- Toaster: Base configuration (e.g. define what was Ostro in single configuration file) [9588]
- Toaster: Simple generation of eSDK installer in Toaster. [9297]
- Toaster: Layer Maintenance workflow. Requires "local layers" re-design. No bugzilla entry, but see design proposal video
- Toaster: Publish layer to Layer Index from Toaster [9895]
- CROPS: Application builder (but running eSDK in a container gets us close). [10119] [4209]
- CROPS: Eclipse integration. In progress. No bugzilla entry.
Instructions for Workflow in Current Form
Toaster Setup
Install Toaster
- Install docker for your Linux distro. Install using your distro's package feed as this will also configure you to be a docker user so you don't need to use sudo when running a container
- If inside a corporate firewall, install and configure the Chameleonsocks container based proxy solution.
- Make a folder for toaster output files on your workstation.
mkdir /path/to/toaster/tmp_files
Start Toaster Web Service
Start toaster container so it's only available on localhost
docker run -it --rm -p 127.0.0.1:18000:8000 -v /path/to/toaster/tmp_files:/workdir crops/toaster
Or start toaster container so anyone can access it remotely
docker run -it --rm -p 18000:8000 -v /path/to/toaster/tmp_files:/workdir crops/toaster
For more details on Toaster container see https://github.com/crops/toaster-container.
Build and Publish eSDK
This section is not part of the developer workflow but documents how the SDK components are generated and published.
This step creates a small installer that is made available to the developer. You must have access to an http server so you can publish SDK update files.
Building and publishing the SDK takes a number of steps. Toaster will be updated to make this process much simpler.
Configure and build extensible SDK
Set the following variables. Normally this would be done in local.conf but as we are using toaster we add them as bitbake variables.
- SDK_EXT_TYPE = "minimal" ensure a minimal SDK build. This produces a small installer and enable components to de downloaded as they are installed
- SDK_INCLUDE_PKGDATA = "1" forces a 'world' build up to do_packagedata and is required to populate sstate-cache with all packages, as we don't know which ones developers will need. If you know the packages the application developers will require, add then the your build and avoid setting SDK_INCLUDE_PKGDATA for a much faster build.
- SDK_UPDATE_URL points eSDK to URL that contains updates
SDK_EXT_TYPE = "minimal" SDK_INCLUDE_PKGDATA = "1" SDK_UPDATE_URL = "http://my.server.com/path/to/esdk-update"
Now set SSTATE_MIRRORS URL so devtool can use your sstate-cache to avoid re-building packages. This is normally done by setting SSTATE_MIRRORS in conf/sdk-extra.conf but this is not possible as we're using toaster. Instead ensure you are not already using an existing SSTATE_MIRROR and set bitbake variables as follows
SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" SSTATE_MIRRORS = "file://.* http://my.server.com/path/to/sstate-cache/PATH"
Build SDK by building your-image:populate_sdk_ext in toaster.
Publish SDK Updater
The eSDK allows web updates, so you have to ensure they appeat at the URK specified by SDK_UPDATE_URL. Assume /var/www/html/path/to is served up as http://my.server.com/path/to
In the docker shell created when you started Toaster container run the following
oe-publish-sdk tmp/deploy/sdk/distro-image-toolchain-ext-ver.sh /var/www/html/path/to/esdk-update
Publish installer
Copy installer to web server and give this URL to your app developers.
cp tmp/deploy/sdk/distro-image-toolchain-ext-ver.sh /var/www/html/path/to/sdk-installer.sh
Publish SSTATE
cp -r build/sstate-cache /var/www/html/path/to/sstate-cache
Application Development
Install and Use eSDK
- This assumes you have docker already installed as per Toaster instructions. No other dependencies are required (that the beauty of containers).
- Create folder for esdk bind mount where output from container will appear, say /path/to/esdk/workdir
mkdir /path/to/esdk/workdir
- Run container, pointing to URL of eSDK minimal installer. You must do this every time you want to use eSDK. In this example I'm suing an eSDk installer I created that is available at https://downloads.yoctoproject.org/tools/support/workflow/poky-glibc-x86_64-core-image-minimal-i586-toolchain-ext-2.2.sh
docker run --rm -it -v /path/to/esdk-workdir:/workdir crops/extsdk-container --url https://downloads.yoctoproject.org/tools/support/workflow/poky-glibc-x86_64-core-image-minimal-i586-toolchain-ext-2.2.sh
If you see the error ERROR: The extensible sdk cannot be installed as root. it means that the folder /path/to/esdk-workdir does not exist
- You now be in the eSDK container shell.
- For more details on eSDK container see https://github.com/crops/extsdk-container.
- Now follow instructions from Yocto Project cookbook on building an app.
- Recipe will be available in /path/to/esdk/workdir/workspace/recipes/bbexample/