summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/source/rootfs.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2014-08-08 15:53:52 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-11 10:53:12 +0100
commitd8f9d05baee3abd4feb0a5b2f2afe467e919c6b9 (patch)
treeedc6ba90a220ad5bbba41998c3c5c82e1e97760d /scripts/lib/wic/plugins/source/rootfs.py
parenta43c1f94205d95c6eb77af2f0a494b4143f9eaf8 (diff)
downloadpoky-d8f9d05baee3abd4feb0a5b2f2afe467e919c6b9.tar.gz
wic: Rename /mic to /wic
As well as any other stray instances of mic in the codebase that can be removed. We don't really need to carry around legacy naming, and the history is in git. (From OE-Core rev: 598b120406dc1d2b7e377bd1ab6f0acbef034b22) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins/source/rootfs.py')
-rw-r--r--scripts/lib/wic/plugins/source/rootfs.py91
1 files changed, 91 insertions, 0 deletions
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
new file mode 100644
index 0000000000..919e97e6b6
--- /dev/null
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -0,0 +1,91 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# Copyright (c) 2014, Intel Corporation.
5# All rights reserved.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# DESCRIPTION
21# This implements the 'rootfs' source plugin class for 'wic'
22#
23# AUTHORS
24# Tom Zanussi <tom.zanussi (at] linux.intel.com>
25# Joao Henrique Ferreira de Freitas <joaohf (at] gmail.com>
26#
27
28import os
29import shutil
30import re
31import tempfile
32
33from wic import kickstart, msger
34from wic.utils import misc, fs_related, errors, runner, cmdln
35from wic.conf import configmgr
36from wic.plugin import pluginmgr
37import wic.imager.direct as direct
38from wic.pluginbase import SourcePlugin
39from wic.utils.oe.misc import *
40from wic.imager.direct import DirectImageCreator
41
42class RootfsPlugin(SourcePlugin):
43 name = 'rootfs'
44
45 @staticmethod
46 def __get_rootfs_dir(rootfs_dir):
47 if os.path.isdir(rootfs_dir):
48 return rootfs_dir
49
50 bitbake_env_lines = find_bitbake_env_lines(rootfs_dir)
51 if not bitbake_env_lines:
52 msg = "Couldn't get bitbake environment, exiting."
53 msger.error(msg)
54
55 image_rootfs_dir = find_artifact(bitbake_env_lines, "IMAGE_ROOTFS")
56 if not os.path.isdir(image_rootfs_dir):
57 msg = "No valid artifact IMAGE_ROOTFS from image named"
58 msg += " %s has been found at %s, exiting.\n" % \
59 (rootfs_dir, image_rootfs_dir)
60 msger.error(msg)
61
62 return image_rootfs_dir
63
64 @classmethod
65 def do_prepare_partition(self, part, cr, cr_workdir, oe_builddir, bootimg_dir,
66 kernel_dir, krootfs_dir, native_sysroot):
67 """
68 Called to do the actual content population for a partition i.e. it
69 'prepares' the partition to be incorporated into the image.
70 In this case, prepare content for legacy bios boot partition.
71 """
72 if part.rootfs is None:
73 if not 'ROOTFS_DIR' in krootfs_dir:
74 msg = "Couldn't find --rootfs-dir, exiting"
75 msger.error(msg)
76 rootfs_dir = krootfs_dir['ROOTFS_DIR']
77 else:
78 if part.rootfs in krootfs_dir:
79 rootfs_dir = krootfs_dir[part.rootfs]
80 elif part.rootfs:
81 rootfs_dir = part.rootfs
82 else:
83 msg = "Couldn't find --rootfs-dir=%s connection"
84 msg += " or it is not a valid path, exiting"
85 msger.error(msg % part.rootfs)
86
87 real_rootfs_dir = self.__get_rootfs_dir(rootfs_dir)
88
89 part.set_rootfs(real_rootfs_dir)
90 part.prepare_rootfs(cr_workdir, oe_builddir, real_rootfs_dir, native_sysroot)
91