summaryrefslogtreecommitdiffstats
path: root/meta-sota/scripts/lib/wic/plugins/source
diff options
context:
space:
mode:
authorAnton Gerasimov <anton@advancedtelematic.com>2017-02-20 10:45:20 +0100
committerAnton Gerasimov <anton@advancedtelematic.com>2017-04-06 10:20:31 +0200
commit607029521eb71dcf873ed911eae4a721a1d2605f (patch)
tree07d4fcb50c2d36e0986f7c01ac9838bbf28ab9cc /meta-sota/scripts/lib/wic/plugins/source
parent497d7db5bfc71367c6393a09a2f768b812fce83f (diff)
Add WKS for OTA-enabled bootable SD cards.
[oytis]: v2 deleted 'sleep 2' [oytis]: v3 disabled wic for devices that don't yet support sota+wic Bug-AGL: SPEC-413 Change-Id: I52a31c9bc66001ed83e83c2f883d046d99ee3c67 Signed-off-by: Anton Gerasimov <anton@advancedtelematic.com>
Diffstat (limited to 'meta-sota/scripts/lib/wic/plugins/source')
-rw-r--r--meta-sota/scripts/lib/wic/plugins/source/otaimage.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/meta-sota/scripts/lib/wic/plugins/source/otaimage.py b/meta-sota/scripts/lib/wic/plugins/source/otaimage.py
new file mode 100644
index 0000000..4ef3b69
--- /dev/null
+++ b/meta-sota/scripts/lib/wic/plugins/source/otaimage.py
@@ -0,0 +1,68 @@
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+import os
+
+from wic import msger
+from wic.pluginbase import SourcePlugin
+from wic.utils.oe.misc import get_bitbake_var
+
+class OTAImagePlugin(SourcePlugin):
+ """
+ Add an already existing filesystem image to the partition layout.
+ """
+
+ name = 'otaimage'
+
+ @classmethod
+ def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir,
+ bootimg_dir, kernel_dir, native_sysroot):
+ """
+ Called after all partitions have been prepared and assembled into a
+ disk image. Do nothing.
+ """
+ pass
+
+ @classmethod
+ def do_configure_partition(cls, part, source_params, cr, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ native_sysroot):
+ """
+ Called before do_prepare_partition(). Possibly prepare
+ configuration files of some sort.
+ """
+ pass
+
+ @classmethod
+ def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
+ oe_builddir, bootimg_dir, kernel_dir,
+ rootfs_dir, native_sysroot):
+ """
+ Called to do the actual content population for a partition i.e. it
+ 'prepares' the partition to be incorporated into the image.
+ """
+ if not bootimg_dir:
+ bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+ if not bootimg_dir:
+ msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
+
+ msger.debug('Bootimg dir: %s' % bootimg_dir)
+
+ src = bootimg_dir + "/" + get_bitbake_var("IMAGE_LINK_NAME") + ".otaimg"
+
+ msger.debug('Preparing partition using image %s' % (src))
+ part.prepare_rootfs_from_fs_image(cr_workdir, src, "")