summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/imager/direct.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/mic/imager/direct.py')
-rw-r--r--scripts/lib/mic/imager/direct.py42
1 files changed, 10 insertions, 32 deletions
diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index 2e6914b86d..b96740d0f4 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -79,9 +79,10 @@ class DirectImageCreator(BaseImageCreator):
79 self.staging_data_dir = staging_data_dir 79 self.staging_data_dir = staging_data_dir
80 80
81 def __write_fstab(self, image_rootfs): 81 def __write_fstab(self, image_rootfs):
82 """overriden to generate fstab (temporarily) in rootfs. This 82 """overriden to generate fstab (temporarily) in rootfs. This is called
83 is called from mount_instroot, make sure it doesn't get called 83 from _create, make sure it doesn't get called from
84 from BaseImage.mount()""" 84 BaseImage.create()
85 """
85 if image_rootfs is None: 86 if image_rootfs is None:
86 return None 87 return None
87 88
@@ -217,29 +218,15 @@ class DirectImageCreator(BaseImageCreator):
217 # 218 #
218 # Actual implemention 219 # Actual implemention
219 # 220 #
220 def _mount_instroot(self): 221 def _create(self):
221 """ 222 """
222 For 'wic', we already have our build artifacts and don't want 223 For 'wic', we already have our build artifacts - we just create
223 to loop mount anything to install into, we just create
224 filesystems from the artifacts directly and combine them into 224 filesystems from the artifacts directly and combine them into
225 a partitioned image. 225 a partitioned image.
226
227 We still want to reuse as much of the basic mic machinery
228 though; despite the fact that we don't actually do loop or any
229 other kind of mounting we still want to do many of the same
230 things to prepare images, so we basically just adapt to the
231 basic framework and reinterpret what 'mounting' means in our
232 context.
233
234 _instroot would normally be something like
235 /var/tmp/wic/build/imgcreate-s_9AKQ/install_root, for
236 installing packages, etc. We don't currently need to do that,
237 so we simplify life by just using /var/tmp/wic/build as our
238 workdir.
239 """ 226 """
240 parts = self._get_parts() 227 parts = self._get_parts()
241 228
242 self.__instimage = PartitionedMount(self._instroot) 229 self.__instimage = PartitionedMount()
243 230
244 for p in parts: 231 for p in parts:
245 # as a convenience, set source to the boot partition source 232 # as a convenience, set source to the boot partition source
@@ -250,20 +237,11 @@ class DirectImageCreator(BaseImageCreator):
250 for p in parts: 237 for p in parts:
251 # need to create the filesystems in order to get their 238 # need to create the filesystems in order to get their
252 # sizes before we can add them and do the layout. 239 # sizes before we can add them and do the layout.
253 # PartitionedMount.mount() actually calls __format_disks() 240 # PartitionedMount.create() actually calls __format_disks()
254 # to create the disk images and carve out the partitions, 241 # to create the disk images and carve out the partitions,
255 # then self.install() calls PartitionedMount.install() 242 # then self.install() calls PartitionedMount.install()
256 # which calls __install_partitition() for each partition 243 # which calls __install_partitition() for each partition
257 # to dd the fs into the partitions. It would be nice to 244 # to dd the fs into the partitions.
258 # be able to use e.g. ExtDiskMount etc to create the
259 # filesystems, since that's where existing e.g. mkfs code
260 # is, but those are only created after __format_disks()
261 # which needs the partition sizes so needs them created
262 # before its called. Well, the existing setup is geared
263 # to installing packages into mounted filesystems - maybe
264 # when/if we need to actually do package selection we
265 # should modify things to use those objects, but for now
266 # we can avoid that.
267 245
268 fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) 246 fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
269 247
@@ -294,7 +272,7 @@ class DirectImageCreator(BaseImageCreator):
294 self.__disks[disk_name] = disk_obj 272 self.__disks[disk_name] = disk_obj
295 self.__instimage.add_disk(disk_name, disk_obj) 273 self.__instimage.add_disk(disk_name, disk_obj)
296 274
297 self.__instimage.mount() 275 self.__instimage.create()
298 276
299 def install(self): 277 def install(self):
300 """ 278 """