From b49e5af8c6ef0abaabce36e5e7d8ddc399e02f53 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Sun, 1 Mar 2015 13:54:15 +0100 Subject: wic: add fsimage plugin The fsimage plugin allows to add an already existing filesystem image in the partition layout. Signed-off-by: Alexandre Belloni Signed-off-by: Ross Burton --- scripts/lib/wic/plugins/source/fsimage.py | 70 +++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 scripts/lib/wic/plugins/source/fsimage.py 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 @@ +# 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 FSImagePlugin(SourcePlugin): + name = 'fsimage' + + @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']) + + + msger.debug('Preparing partition using image %s' % (src)) + part.prepare_rootfs_from_fs_image(cr_workdir, src, "") -- cgit 1.2.3-korg