summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-08-25 23:12:23 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-27 22:30:07 +0100
commit60efc91d2b57255b032ac9e26e4b698256215a25 (patch)
treebe2a801411cc9e65c382aac1b6997821813c869c /scripts
parentff0bbdafa466aa006dc91a32814ecbe7ae093724 (diff)
downloadpoky-60efc91d2b57255b032ac9e26e4b698256215a25.tar.gz
wic: get more info from the 'parted print' output
Got partition type and sector sizes from the output of 'parted print'. This info may be used in the implementation of 'wic write' command. (From OE-Core rev: 5c0926d8efa468177b7cb43a5f06b35058255644) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/engine.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index b23dd65de2..a965b8b901 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -237,6 +237,9 @@ class Disk:
237 self.native_sysroot = native_sysroot 237 self.native_sysroot = native_sysroot
238 self._partitions = None 238 self._partitions = None
239 self._partimages = {} 239 self._partimages = {}
240 self._lsector_size = None
241 self._psector_size = None
242 self._ptable_format = None
240 243
241 # find parted 244 # find parted
242 self.paths = "/bin:/usr/bin:/usr/sbin:/sbin/" 245 self.paths = "/bin:/usr/bin:/usr/sbin:/sbin/"
@@ -258,7 +261,11 @@ class Disk:
258 self._partitions = OrderedDict() 261 self._partitions = OrderedDict()
259 out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath)) 262 out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath))
260 parttype = namedtuple("Part", "pnum start end size fstype") 263 parttype = namedtuple("Part", "pnum start end size fstype")
261 for line in out.splitlines()[2:]: 264 splitted = out.splitlines()
265 lsector_size, psector_size, self._ptable_format = splitted[1].split(":")[3:6]
266 self._lsector_size = int(lsector_size)
267 self._psector_size = int(psector_size)
268 for line in splitted[2:]:
262 pnum, start, end, size, fstype = line.split(':')[:5] 269 pnum, start, end, size, fstype = line.split(':')[:5]
263 partition = parttype(pnum, int(start[:-1]), int(end[:-1]), 270 partition = parttype(pnum, int(start[:-1]), int(end[:-1]),
264 int(size[:-1]), fstype) 271 int(size[:-1]), fstype)