summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins/source
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-02-09 15:52:55 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-15 20:06:44 -0800
commitadf5e2956ca4e3136be0ee785115a7e1941a135b (patch)
treef15fb103786bbf8437fee80c89956bbe5be60e02 /scripts/lib/wic/plugins/source
parent47ee6c2153db204a9fda718b92616d4bf851057e (diff)
downloadpoky-adf5e2956ca4e3136be0ee785115a7e1941a135b.tar.gz
wic: move disk operations to PartitionImage class
Disk operations were spread over DirectPlugin, DiskImage and Image code making the code hard to understand. Renamed Image class to PartitionedImage. Removed DiskImage class. Moved disk operations to PartitionedImage. There was an implicit support for multiple disks: if different devices were specified in .wks file (e.g. --ondisk sda and --ondisk sdb), wic would theoretically generate multiple images. This is quite confusing option and the code supporting it was broken for a long time. The same effect (multiple output images) can be achieved in obvious and clear way - by using multiple .wks files. This functionality was removed. PartitionedImage works only with one image. This makes the code less complex and easier to maintain. (From OE-Core rev: 4dc9dbfc7fbc16d349a019e8973d50905cd28244) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins/source')
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-pcbios.py2
-rw-r--r--scripts/lib/wic/plugins/source/isoimage-isohybrid.py10
-rw-r--r--scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py4
3 files changed, 6 insertions, 10 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 4b9b26552a..0be2b78e51 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -63,7 +63,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
63 63
64 full_path = creator._full_path(workdir, disk_name, "direct") 64 full_path = creator._full_path(workdir, disk_name, "direct")
65 msger.debug("Installing MBR on disk %s as %s with size %s bytes" \ 65 msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
66 % (disk_name, full_path, disk['min_size'])) 66 % (disk_name, full_path, disk.min_size))
67 67
68 rcode = runner.show(['dd', 'if=%s' % mbrfile, 68 rcode = runner.show(['dd', 'if=%s' % mbrfile,
69 'of=%s' % full_path, 'conv=notrunc']) 69 'of=%s' % full_path, 'conv=notrunc'])
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index ca28bc0fa3..fb34235631 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -473,13 +473,12 @@ class IsoImagePlugin(SourcePlugin):
473 utility for booting via BIOS from disk storage devices. 473 utility for booting via BIOS from disk storage devices.
474 """ 474 """
475 475
476 iso_img = "%s.p1" % disk.path
476 full_path = creator._full_path(workdir, disk_name, "direct") 477 full_path = creator._full_path(workdir, disk_name, "direct")
477 iso_img = "%s.p1" % full_path
478 full_path_iso = creator._full_path(workdir, disk_name, "iso") 478 full_path_iso = creator._full_path(workdir, disk_name, "iso")
479 479
480 isohybrid_cmd = "isohybrid -u %s" % iso_img 480 isohybrid_cmd = "isohybrid -u %s" % iso_img
481 msger.debug("running command: %s" % \ 481 msger.debug("running command: %s" % isohybrid_cmd)
482 isohybrid_cmd)
483 exec_native_cmd(isohybrid_cmd, native_sysroot) 482 exec_native_cmd(isohybrid_cmd, native_sysroot)
484 483
485 # Replace the image created by direct plugin with the one created by 484 # Replace the image created by direct plugin with the one created by
@@ -487,9 +486,6 @@ class IsoImagePlugin(SourcePlugin):
487 # mkisofs has a very specific MBR is system area of the ISO image, and 486 # mkisofs has a very specific MBR is system area of the ISO image, and
488 # direct plugin adds and configures an another MBR. 487 # direct plugin adds and configures an another MBR.
489 msger.debug("Replaceing the image created by direct plugin\n") 488 msger.debug("Replaceing the image created by direct plugin\n")
490 os.remove(full_path) 489 os.remove(disk.path)
491 shutil.copy2(iso_img, full_path_iso) 490 shutil.copy2(iso_img, full_path_iso)
492 shutil.copy2(full_path_iso, full_path) 491 shutil.copy2(full_path_iso, full_path)
493
494 # Remove temporary ISO file
495 os.remove(iso_img)
diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
index cb1da93d30..9e79a139da 100644
--- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
+++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
@@ -204,9 +204,9 @@ class RootfsPlugin(SourcePlugin):
204 if not os.path.exists(mbrfile): 204 if not os.path.exists(mbrfile):
205 msger.error("Couldn't find %s. Has syslinux-native been baked?" % mbrfile) 205 msger.error("Couldn't find %s. Has syslinux-native been baked?" % mbrfile)
206 206
207 full_path = disk['disk'].device 207 full_path = disk.path
208 msger.debug("Installing MBR on disk %s as %s with size %s bytes" \ 208 msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
209 % (disk_name, full_path, disk['min_size'])) 209 % (disk_name, full_path, disk.min_size))
210 210
211 ret_code = runner.show(['dd', 'if=%s' % mbrfile, 'of=%s' % full_path, 'conv=notrunc']) 211 ret_code = runner.show(['dd', 'if=%s' % mbrfile, 'of=%s' % full_path, 'conv=notrunc'])
212 if ret_code != 0: 212 if ret_code != 0: