summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-06-29 11:19:38 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-02 23:08:38 +0100
commitd88af4f518307ec615520d66c96aa70546169f4b (patch)
tree505fccf7f55442df5bd35c2d5d73ab419ee3f7d7
parent0ef9cdd1ec20d5eed06fe0148de4b996f7c7a75c (diff)
downloadpoky-d88af4f518307ec615520d66c96aa70546169f4b.tar.gz
wic: Remove __write_partition method
Moved code of __write_partition to 'assemble' method. This way it should be more readable. (From OE-Core rev: f7059362053c87f96ce68d1ab850962defb76540) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/wic/utils/partitionedfs.py36
1 files changed, 15 insertions, 21 deletions
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index d61087a24d..ca4b1f06c0 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -334,30 +334,24 @@ class Image(object):
334 except: 334 except:
335 pass 335 pass
336 336
337 def __write_partition(self, num, source_file, start, size, image_file):
338 """
339 Install source_file contents into a partition.
340 """
341 if not source_file: # nothing to write
342 return
343
344 # Start is included in the size so need to substract one from the end.
345 end = start + size - 1
346 msger.debug("Installed %s in partition %d, sectors %d-%d, "
347 "size %d sectors" % (source_file, num, start, end, size))
348
349 dd_cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \
350 (source_file, image_file, self.sector_size, start, size)
351 exec_cmd(dd_cmd)
352
353
354 def assemble(self, image_file): 337 def assemble(self, image_file):
355 msger.debug("Installing partitions") 338 msger.debug("Installing partitions")
356 339
357 for p in self.partitions: 340 for part in self.partitions:
358 self.__write_partition(p['num'], p['source_file'], 341 source = part['source_file']
359 p['start'], p['size'], image_file) 342 if source:
360 os.rename(p['source_file'], image_file + '.p%d' % p['num']) 343 # install source_file contents into a partition
344 cmd = "dd if=%s of=%s bs=%d seek=%d count=%d conv=notrunc" % \
345 (source, image_file, self.sector_size,
346 part['start'], part['size'])
347 exec_cmd(cmd)
348
349 msger.debug("Installed %s in partition %d, sectors %d-%d, "
350 "size %d sectors" % \
351 (source, part['num'], part['start'],
352 part['start'] + part['size'] - 1, part['size']))
353
354 os.rename(source, image_file + '.p%d' % part['num'])
361 355
362 def create(self): 356 def create(self):
363 for dev in self.disks.keys(): 357 for dev in self.disks.keys():