summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-03-01 13:54:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-10 10:47:41 +0000
commit5e2dd63d2bd808ba2b406dddea61d262c5d01212 (patch)
tree9c0bd6353658d9229bb11145531a90fefc1a0721 /scripts/lib
parent0393438b94e5ef88d911029c54576314d38a62b2 (diff)
downloadpoky-5e2dd63d2bd808ba2b406dddea61d262c5d01212.tar.gz
wic: add fsimage plugin
The fsimage plugin allows to add an already existing filesystem image in the partition layout. (From OE-Core rev: b49e5af8c6ef0abaabce36e5e7d8ddc399e02f53) Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/wic/plugins/source/fsimage.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/scripts/lib/wic/plugins/source/fsimage.py b/scripts/lib/wic/plugins/source/fsimage.py
new file mode 100644
index 0000000000..0967883afa
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/fsimage.py
@@ -0,0 +1,70 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License version 2 as
6# published by the Free Software Foundation.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License along
14# with this program; if not, write to the Free Software Foundation, Inc.,
15# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16#
17
18import os
19import re
20
21from wic import msger
22from wic.pluginbase import SourcePlugin
23from wic.utils.oe.misc import *
24
25class FSImagePlugin(SourcePlugin):
26 name = 'fsimage'
27
28 @classmethod
29 def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir,
30 bootimg_dir, kernel_dir, native_sysroot):
31 """
32 Called after all partitions have been prepared and assembled into a
33 disk image. Do nothing.
34 """
35 pass
36
37 @classmethod
38 def do_configure_partition(self, part, source_params, cr, cr_workdir,
39 oe_builddir, bootimg_dir, kernel_dir,
40 native_sysroot):
41 """
42 Called before do_prepare_partition(). Possibly prepare
43 configuration files of some sort.
44 """
45 pass
46
47 @classmethod
48 def do_prepare_partition(self, part, source_params, cr, cr_workdir,
49 oe_builddir, bootimg_dir, kernel_dir,
50 rootfs_dir, native_sysroot):
51 """
52 Called to do the actual content population for a partition i.e. it
53 'prepares' the partition to be incorporated into the image.
54 """
55 if not bootimg_dir:
56 bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
57 if not bootimg_dir:
58 msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
59
60 msger.debug('Bootimg dir: %s' % bootimg_dir)
61
62 if ('file' not in source_params):
63 msger.error("No file specified\n")
64 return
65
66 src = os.path.join(bootimg_dir, source_params['file'])
67
68
69 msger.debug('Preparing partition using image %s' % (src))
70 part.prepare_rootfs_from_fs_image(cr_workdir, src, "")