wic: Update/rename install-related code
The wic code inherited a basic image-creation flow based on installing packages, but wic doesn't actually install anything, so rename parts of the code dealing with installing to something more appropriate. (From OE-Core rev: b4232041534a79236eb8d8ab5c0024a0ef4da649) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
467bf7e68f
commit
d02c91fe4d
|
@ -62,7 +62,7 @@ class DirectImageCreator(BaseImageCreator):
|
|||
"""
|
||||
BaseImageCreator.__init__(self, creatoropts)
|
||||
|
||||
self.__instimage = None
|
||||
self.__image = None
|
||||
self.__disks = {}
|
||||
self.__disk_format = "direct"
|
||||
self._disk_names = []
|
||||
|
@ -226,7 +226,7 @@ class DirectImageCreator(BaseImageCreator):
|
|||
"""
|
||||
parts = self._get_parts()
|
||||
|
||||
self.__instimage = PartitionedMount()
|
||||
self.__image = PartitionedMount()
|
||||
|
||||
for p in parts:
|
||||
# as a convenience, set source to the boot partition source
|
||||
|
@ -250,39 +250,39 @@ class DirectImageCreator(BaseImageCreator):
|
|||
|
||||
self._restore_fstab(fstab)
|
||||
|
||||
self.__instimage.add_partition(int(p.size),
|
||||
p.disk,
|
||||
p.mountpoint,
|
||||
p.source_file,
|
||||
p.fstype,
|
||||
p.label,
|
||||
fsopts = p.fsopts,
|
||||
boot = p.active,
|
||||
align = p.align,
|
||||
part_type = p.part_type)
|
||||
self.__image.add_partition(int(p.size),
|
||||
p.disk,
|
||||
p.mountpoint,
|
||||
p.source_file,
|
||||
p.fstype,
|
||||
p.label,
|
||||
fsopts = p.fsopts,
|
||||
boot = p.active,
|
||||
align = p.align,
|
||||
part_type = p.part_type)
|
||||
|
||||
self.__instimage.layout_partitions(self._ptable_format)
|
||||
self.__image.layout_partitions(self._ptable_format)
|
||||
|
||||
self.__imgdir = self.workdir
|
||||
for disk_name, disk in self.__instimage.disks.items():
|
||||
for disk_name, disk in self.__image.disks.items():
|
||||
full_path = self._full_path(self.__imgdir, disk_name, "direct")
|
||||
msger.debug("Adding disk %s as %s with size %s bytes" \
|
||||
% (disk_name, full_path, disk['min_size']))
|
||||
disk_obj = fs_related.DiskImage(full_path, disk['min_size'])
|
||||
self.__disks[disk_name] = disk_obj
|
||||
self.__instimage.add_disk(disk_name, disk_obj)
|
||||
self.__image.add_disk(disk_name, disk_obj)
|
||||
|
||||
self.__instimage.create()
|
||||
self.__image.create()
|
||||
|
||||
def install(self):
|
||||
def assemble(self):
|
||||
"""
|
||||
Install fs images into partitions
|
||||
Assemble partitions into disk image(s)
|
||||
"""
|
||||
for disk_name, disk in self.__instimage.disks.items():
|
||||
for disk_name, disk in self.__image.disks.items():
|
||||
full_path = self._full_path(self.__imgdir, disk_name, "direct")
|
||||
msger.debug("Installing disk %s as %s with size %s bytes" \
|
||||
msger.debug("Assembling disk %s as %s with size %s bytes" \
|
||||
% (disk_name, full_path, disk['min_size']))
|
||||
self.__instimage.install(full_path)
|
||||
self.__image.assemble(full_path)
|
||||
|
||||
def configure(self):
|
||||
"""
|
||||
|
@ -294,7 +294,7 @@ class DirectImageCreator(BaseImageCreator):
|
|||
source_plugin = self.get_default_source_plugin()
|
||||
if source_plugin:
|
||||
self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods)
|
||||
for disk_name, disk in self.__instimage.disks.items():
|
||||
for disk_name, disk in self.__image.disks.items():
|
||||
self._source_methods["do_install_disk"](disk, disk_name, self,
|
||||
self.workdir,
|
||||
self.oe_builddir,
|
||||
|
@ -310,7 +310,7 @@ class DirectImageCreator(BaseImageCreator):
|
|||
|
||||
parts = self._get_parts()
|
||||
|
||||
for disk_name, disk in self.__instimage.disks.items():
|
||||
for disk_name, disk in self.__image.disks.items():
|
||||
full_path = self._full_path(self.__imgdir, disk_name, "direct")
|
||||
msg += ' %s\n\n' % full_path
|
||||
|
||||
|
@ -355,9 +355,9 @@ class DirectImageCreator(BaseImageCreator):
|
|||
return (rootdev, root_part_uuid)
|
||||
|
||||
def _cleanup(self):
|
||||
if not self.__instimage is None:
|
||||
if not self.__image is None:
|
||||
try:
|
||||
self.__instimage.cleanup()
|
||||
self.__image.cleanup()
|
||||
except MountError, err:
|
||||
msger.warning("%s" % err)
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class DirectPlugin(ImagerPlugin):
|
|||
|
||||
try:
|
||||
creator.create()
|
||||
creator.install()
|
||||
creator.assemble()
|
||||
creator.configure()
|
||||
creator.print_outimage_info()
|
||||
|
||||
|
|
|
@ -309,11 +309,11 @@ class PartitionedMount:
|
|||
except:
|
||||
pass
|
||||
|
||||
def __install_partition(self, num, source_file, start, size):
|
||||
def __write_partition(self, num, source_file, start, size):
|
||||
"""
|
||||
Install source_file contents into a partition.
|
||||
"""
|
||||
if not source_file: # nothing to install
|
||||
if not source_file: # nothing to write
|
||||
return
|
||||
|
||||
# Start is included in the size so need to substract one from the end.
|
||||
|
@ -325,7 +325,7 @@ class PartitionedMount:
|
|||
exec_cmd(dd_cmd)
|
||||
|
||||
|
||||
def install(self, image_file):
|
||||
def assemble(self, image_file):
|
||||
msger.debug("Installing partitions")
|
||||
|
||||
self.image_file = image_file
|
||||
|
@ -337,12 +337,12 @@ class PartitionedMount:
|
|||
# of the first _logical_ partition. This is why the extended
|
||||
# partition should start one sector before the first logical
|
||||
# partition.
|
||||
self.__install_partition(p['num'], p['source_file'],
|
||||
p['start'] - 1,
|
||||
d['offset'] - p['start'])
|
||||
self.__write_partition(p['num'], p['source_file'],
|
||||
p['start'] - 1,
|
||||
d['offset'] - p['start'])
|
||||
|
||||
self.__install_partition(p['num'], p['source_file'],
|
||||
p['start'], p['size'])
|
||||
self.__write_partition(p['num'], p['source_file'],
|
||||
p['start'], p['size'])
|
||||
|
||||
def create(self):
|
||||
for dev in self.disks.keys():
|
||||
|
|
Loading…
Reference in New Issue