summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/imager/direct.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/imager/direct.py')
-rw-r--r--scripts/lib/wic/imager/direct.py70
1 files changed, 35 insertions, 35 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 761e436db5..31c0edc7d3 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -80,11 +80,11 @@ class DirectImageCreator(BaseImageCreator):
80 in the partition table and logical partitions 80 in the partition table and logical partitions
81 """ 81 """
82 realnum = 0 82 realnum = 0
83 for n, p in enumerate(parts, 1): 83 for pnum, part in enumerate(parts, 1):
84 if not p.no_table: 84 if not part.no_table:
85 realnum += 1 85 realnum += 1
86 if n == num: 86 if pnum == num:
87 if p.no_table: 87 if part.no_table:
88 return 0 88 return 0
89 if self.ptable_format == 'msdos' and realnum > 3: 89 if self.ptable_format == 'msdos' and realnum > 3:
90 # account for logical partition numbering, ex. sda5.. 90 # account for logical partition numbering, ex. sda5..
@@ -154,9 +154,9 @@ class DirectImageCreator(BaseImageCreator):
154 if not self.ks.handler.partition.partitions: 154 if not self.ks.handler.partition.partitions:
155 partstr = "part / --size 1900 --ondisk sda --fstype=ext3" 155 partstr = "part / --size 1900 --ondisk sda --fstype=ext3"
156 args = partstr.split() 156 args = partstr.split()
157 pd = self.ks.handler.partition.parse(args[1:]) 157 part = self.ks.handler.partition.parse(args[1:])
158 if pd not in self.ks.handler.partition.partitions: 158 if part not in self.ks.handler.partition.partitions:
159 self.ks.handler.partition.partitions.append(pd) 159 self.ks.handler.partition.partitions.append(part)
160 160
161 # partitions list from kickstart file 161 # partitions list from kickstart file
162 return kickstart.get_partitions(self.ks) 162 return kickstart.get_partitions(self.ks)
@@ -221,19 +221,19 @@ class DirectImageCreator(BaseImageCreator):
221 221
222 self.__image = Image(self.native_sysroot) 222 self.__image = Image(self.native_sysroot)
223 223
224 for p in parts: 224 for part in parts:
225 # as a convenience, set source to the boot partition source 225 # as a convenience, set source to the boot partition source
226 # instead of forcing it to be set via bootloader --source 226 # instead of forcing it to be set via bootloader --source
227 if not self.ks.handler.bootloader.source and p.mountpoint == "/boot": 227 if not self.ks.handler.bootloader.source and part.mountpoint == "/boot":
228 self.ks.handler.bootloader.source = p.source 228 self.ks.handler.bootloader.source = part.source
229 229
230 fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) 230 fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
231 231
232 for p in parts: 232 for part in parts:
233 # get rootfs size from bitbake variable if it's not set in .ks file 233 # get rootfs size from bitbake variable if it's not set in .ks file
234 if not p.size: 234 if not part.size:
235 # and if rootfs name is specified for the partition 235 # and if rootfs name is specified for the partition
236 image_name = p.get_rootfs() 236 image_name = part.get_rootfs()
237 if image_name: 237 if image_name:
238 # Bitbake variable ROOTFS_SIZE is calculated in 238 # Bitbake variable ROOTFS_SIZE is calculated in
239 # Image._get_rootfs_size method from meta/lib/oe/image.py 239 # Image._get_rootfs_size method from meta/lib/oe/image.py
@@ -242,7 +242,7 @@ class DirectImageCreator(BaseImageCreator):
242 rsize_bb = get_bitbake_var('ROOTFS_SIZE', image_name) 242 rsize_bb = get_bitbake_var('ROOTFS_SIZE', image_name)
243 if rsize_bb: 243 if rsize_bb:
244 # convert from Kb to Mb 244 # convert from Kb to Mb
245 p.size = int(rsize_bb) / 1024 245 part.size = int(rsize_bb) / 1024
246 # need to create the filesystems in order to get their 246 # need to create the filesystems in order to get their
247 # sizes before we can add them and do the layout. 247 # sizes before we can add them and do the layout.
248 # Image.create() actually calls __format_disks() to create 248 # Image.create() actually calls __format_disks() to create
@@ -250,22 +250,22 @@ class DirectImageCreator(BaseImageCreator):
250 # self.assemble() calls Image.assemble() which calls 250 # self.assemble() calls Image.assemble() which calls
251 # __write_partitition() for each partition to dd the fs 251 # __write_partitition() for each partition to dd the fs
252 # into the partitions. 252 # into the partitions.
253 p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir, 253 part.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir,
254 self.bootimg_dir, self.kernel_dir, self.native_sysroot) 254 self.bootimg_dir, self.kernel_dir, self.native_sysroot)
255 255
256 256
257 self.__image.add_partition(int(p.size), 257 self.__image.add_partition(int(part.size),
258 p.disk, 258 part.disk,
259 p.mountpoint, 259 part.mountpoint,
260 p.source_file, 260 part.source_file,
261 p.fstype, 261 part.fstype,
262 p.label, 262 part.label,
263 fsopts=p.fsopts, 263 fsopts=part.fsopts,
264 boot=p.active, 264 boot=part.active,
265 align=p.align, 265 align=part.align,
266 no_table=p.no_table, 266 no_table=part.no_table,
267 part_type=p.part_type, 267 part_type=part.part_type,
268 uuid=p.uuid) 268 uuid=part.uuid)
269 269
270 if fstab_path: 270 if fstab_path:
271 shutil.move(fstab_path + ".orig", fstab_path) 271 shutil.move(fstab_path + ".orig", fstab_path)
@@ -336,14 +336,14 @@ class DirectImageCreator(BaseImageCreator):
336 msg += ' %s\n\n' % full_path 336 msg += ' %s\n\n' % full_path
337 337
338 msg += 'The following build artifacts were used to create the image(s):\n' 338 msg += 'The following build artifacts were used to create the image(s):\n'
339 for p in parts: 339 for part in parts:
340 if p.get_rootfs() is None: 340 if part.get_rootfs() is None:
341 continue 341 continue
342 if p.mountpoint == '/': 342 if part.mountpoint == '/':
343 suffix = ':' 343 suffix = ':'
344 else: 344 else:
345 suffix = '["%s"]:' % (p.mountpoint or p.label) 345 suffix = '["%s"]:' % (part.mountpoint or part.label)
346 msg += ' ROOTFS_DIR%s%s\n' % (suffix.ljust(20), p.get_rootfs()) 346 msg += ' ROOTFS_DIR%s%s\n' % (suffix.ljust(20), part.get_rootfs())
347 347
348 msg += ' BOOTIMG_DIR: %s\n' % self.bootimg_dir 348 msg += ' BOOTIMG_DIR: %s\n' % self.bootimg_dir
349 msg += ' KERNEL_DIR: %s\n' % self.kernel_dir 349 msg += ' KERNEL_DIR: %s\n' % self.kernel_dir