diff options
-rw-r--r-- | scripts/lib/wic/plugins/source/fsimage.py | 70 |
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 | |||
18 | import os | ||
19 | import re | ||
20 | |||
21 | from wic import msger | ||
22 | from wic.pluginbase import SourcePlugin | ||
23 | from wic.utils.oe.misc import * | ||
24 | |||
25 | class 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, "") | ||