summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-02-10 16:23:59 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-15 20:06:34 -0800
commit700aa424f0aa239cf4149eed4bfb1dc7d9677431 (patch)
tree1f098e39ac392084658088804e4d615e29e198a3
parent361b890da1c7b24de0a62516545e4c164830081d (diff)
downloadopenembedded-core-contrib-700aa424f0aa239cf4149eed4bfb1dc7d9677431.tar.gz
openembedded-core-contrib-700aa424f0aa239cf4149eed4bfb1dc7d9677431.tar.bz2
openembedded-core-contrib-700aa424f0aa239cf4149eed4bfb1dc7d9677431.zip
wic: direct: add PartitionedImage.prepare method
Moved code that calls prepare method of Partition objects from DirectPlugin to PartitionedImage.prepare. The idea is to have all code that works with partitions in PartitionedImage class. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 64a3368526..9c4109e6b8 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -182,12 +182,8 @@ class DirectPlugin(ImagerPlugin):
rsize_bb = get_bitbake_var('ROOTFS_SIZE', image_name)
if rsize_bb:
part.size = int(round(float(rsize_bb)))
- # need to create the filesystems in order to get their
- # sizes before we can add them and do the layout.
- part.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir,
- self.bootimg_dir, self.kernel_dir, self.native_sysroot)
- self._image.add_partition(part)
+ self._image.prepare(self)
if fstab_path:
shutil.move(fstab_path + ".orig", fstab_path)
@@ -329,15 +325,17 @@ class PartitionedImage():
else: # msdos partition table
part.uuid = '%0x-%02d' % (self.identifier, part.realnum)
- def add_partition(self, part):
- """
- Add the next partition. Partitions have to be added in the
- first-to-last order.
- """
- part.ks_pnum = len(self.partitions)
+ def prepare(self, imager):
+ """Prepare an image. Call prepare method of all image partitions."""
+ for part in self.partitions:
+ # need to create the filesystems in order to get their
+ # sizes before we can add them and do the layout.
+ part.prepare(imager, imager.workdir, imager.oe_builddir,
+ imager.rootfs_dir, imager.bootimg_dir,
+ imager.kernel_dir, imager.native_sysroot)
- # Converting kB to sectors for parted
- part.size_sec = part.disk_size * 1024 // self.sector_size
+ # Converting kB to sectors for parted
+ part.size_sec = part.disk_size * 1024 // self.sector_size
def layout_partitions(self):
""" Layout the partitions, meaning calculate the position of every