summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-02-09 00:16:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-14 08:40:34 +0000
commit5f237238a1fab87668068d042ac86b67d2c5224b (patch)
tree70aecff9acacf1e6269567492df02075f71587ab
parent233b631ece5ee14d057932c146327065064b5196 (diff)
downloadopenembedded-core-5f237238a1fab87668068d042ac86b67d2c5224b.tar.gz
openembedded-core-5f237238a1fab87668068d042ac86b67d2c5224b.tar.bz2
openembedded-core-5f237238a1fab87668068d042ac86b67d2c5224b.zip
wic: add rawcopy source plugin
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--scripts/lib/wic/plugins/source/rawcopy.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
new file mode 100644
index 0000000000..b3b55fa022
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -0,0 +1,77 @@
+# 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
+import re
+
+from wic import msger
+from wic.pluginbase import SourcePlugin
+from wic.utils.oe.misc import *
+
+class RawCopyPlugin(SourcePlugin):
+ name = 'rawcopy'
+
+ @classmethod
+ def do_install_disk(self, 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(self, 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(self, 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)
+
+ if ('file' not in source_params):
+ msger.error("No file specified\n")
+ return
+
+ src = os.path.join(bootimg_dir, source_params['file'])
+
+ # get the size in the right units for kickstart (kB)
+ du_cmd = "du -Lbks %s" % src
+ out = exec_cmd(du_cmd)
+ filesize = out.split()[0]
+
+ if filesize > part.size:
+ part.size = filesize
+
+ part.source_file = src
+