summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-21 16:00:57 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-30 12:35:50 +0100
commitb2c1e64ecd3ab7c569feb50ea74f3235e4e7d66a (patch)
treef46a4bb26daf8706a50b2121c5452b40399ac141 /scripts
parent69c63728dae38d5b1cc9874268f235a07e04d3db (diff)
downloadpoky-b2c1e64ecd3ab7c569feb50ea74f3235e4e7d66a.tar.gz
devtool: implement build-image plugin
Implemented new plugin to build image from workspace packages. Plugin creates <image>.bbappend file, adds all workspace packages to the image using IMAGE_INSTALL_append variable in bbappend file. After that it runs 'bitbake <image>'. (From OE-Core rev: 00bc43868da3ea2a4532215d3abef8e150c7b2e5) (From OE-Core rev: fc35c10fed382e385f00b76abcee94a0148b4aee) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/build-image.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/lib/devtool/build-image.py b/scripts/lib/devtool/build-image.py
new file mode 100644
index 0000000000..d8e7b12832
--- /dev/null
+++ b/scripts/lib/devtool/build-image.py
@@ -0,0 +1,56 @@
1# Development tool - build-image plugin
2#
3# Copyright (C) 2015 Intel Corporation
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18"""Devtool plugin containing the build-image subcommand."""
19
20import os
21import logging
22
23from bb.process import ExecutionError
24from devtool import exec_build_env_command, add_md5
25
26LOG = logging.getLogger('devtool')
27
28def plugin_init(pluginlist):
29 """Plugin initialization"""
30 pass
31
32def build_image(args, config, basepath, workspace):
33 """Entry point for the devtool 'build-image' subcommand."""
34 image = args.recipe
35 appendfile = os.path.join(config.workspace_path, 'appends',
36 '%s.bbappend' % image)
37 with open(appendfile, 'w') as afile:
38 afile.write('IMAGE_INSTALL_append = " %s"\n' % \
39 ' '.join(workspace.keys()))
40
41 add_md5(config, image, appendfile)
42
43 try:
44 exec_build_env_command(config.init_path, basepath,
45 'bitbake %s' % image, watch=True)
46 except ExecutionError as err:
47 return err.exitcode
48
49 LOG.info('Successfully built %s', image)
50
51def register_commands(subparsers, context):
52 """Register devtool subcommands from the build-image plugin"""
53 parser_package = subparsers.add_parser('build-image', help='Build image')
54 parser_package.add_argument('recipe', help='Image recipe to build')
55 parser_package.set_defaults(func=build_image)
56