diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-07-06 14:32:33 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-21 22:51:38 +0100 |
| commit | 9f481f5ac9b392c7178955756bdaf11cdd76e0c6 (patch) | |
| tree | d785dbbb281999fa8878fea69398112c1ad231b8 /scripts/lib/wic/partition.py | |
| parent | fedac61ad973981b824a2c79ffc9feaa6d754dba (diff) | |
| download | poky-9f481f5ac9b392c7178955756bdaf11cdd76e0c6.tar.gz | |
wic: implement wks option --mkfs-extraopts
This option specifies extra options to pass to mkfs.<fstype> utilities.
[YOCTO #11709]
(From OE-Core rev: 67b7c67edba305fbd31967baa10d27c2e603ec77)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/partition.py')
| -rw-r--r-- | scripts/lib/wic/partition.py | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 5aa68c93c1..b623bb9e6d 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py | |||
| @@ -46,6 +46,7 @@ class Partition(): | |||
| 46 | self.fsopts = args.fsopts | 46 | self.fsopts = args.fsopts |
| 47 | self.fstype = args.fstype | 47 | self.fstype = args.fstype |
| 48 | self.label = args.label | 48 | self.label = args.label |
| 49 | self.mkfs_extraopts = args.mkfs_extraopts | ||
| 49 | self.mountpoint = args.mountpoint | 50 | self.mountpoint = args.mountpoint |
| 50 | self.no_table = args.no_table | 51 | self.no_table = args.no_table |
| 51 | self.num = None | 52 | self.num = None |
| @@ -256,14 +257,14 @@ class Partition(): | |||
| 256 | with open(rootfs, 'w') as sparse: | 257 | with open(rootfs, 'w') as sparse: |
| 257 | os.ftruncate(sparse.fileno(), rootfs_size * 1024) | 258 | os.ftruncate(sparse.fileno(), rootfs_size * 1024) |
| 258 | 259 | ||
| 259 | extra_imagecmd = "-i 8192" | 260 | extraopts = self.mkfs_extraopts or "-F -i 8192" |
| 260 | 261 | ||
| 261 | label_str = "" | 262 | label_str = "" |
| 262 | if self.label: | 263 | if self.label: |
| 263 | label_str = "-L %s" % self.label | 264 | label_str = "-L %s" % self.label |
| 264 | 265 | ||
| 265 | mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \ | 266 | mkfs_cmd = "mkfs.%s %s %s %s -d %s" % \ |
| 266 | (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir) | 267 | (self.fstype, extraopts, rootfs, label_str, rootfs_dir) |
| 267 | exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) | 268 | exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) |
| 268 | 269 | ||
| 269 | mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) | 270 | mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) |
| @@ -289,8 +290,9 @@ class Partition(): | |||
| 289 | if self.label: | 290 | if self.label: |
| 290 | label_str = "-L %s" % self.label | 291 | label_str = "-L %s" % self.label |
| 291 | 292 | ||
| 292 | mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \ | 293 | mkfs_cmd = "mkfs.%s -b %d -r %s %s %s %s" % \ |
| 293 | (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs) | 294 | (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, |
| 295 | self.mkfs_extraopts, rootfs) | ||
| 294 | exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) | 296 | exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) |
| 295 | 297 | ||
| 296 | def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir, | 298 | def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir, |
| @@ -312,8 +314,10 @@ class Partition(): | |||
| 312 | if self.fstype == 'msdos': | 314 | if self.fstype == 'msdos': |
| 313 | size_str = "-F 16" # FAT 16 | 315 | size_str = "-F 16" # FAT 16 |
| 314 | 316 | ||
| 315 | dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str, | 317 | extraopts = self.mkfs_extraopts or '-S 512' |
| 316 | rootfs, rootfs_size) | 318 | |
| 319 | dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \ | ||
| 320 | (label_str, size_str, extraopts, rootfs, rootfs_size) | ||
| 317 | exec_native_cmd(dosfs_cmd, native_sysroot) | 321 | exec_native_cmd(dosfs_cmd, native_sysroot) |
| 318 | 322 | ||
| 319 | mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir) | 323 | mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir) |
| @@ -329,8 +333,9 @@ class Partition(): | |||
| 329 | """ | 333 | """ |
| 330 | Prepare content for a squashfs rootfs partition. | 334 | Prepare content for a squashfs rootfs partition. |
| 331 | """ | 335 | """ |
| 332 | squashfs_cmd = "mksquashfs %s %s -noappend" % \ | 336 | extraopts = self.mkfs_extraopts or '-noappend' |
| 333 | (rootfs_dir, rootfs) | 337 | squashfs_cmd = "mksquashfs %s %s %s" % \ |
| 338 | (rootfs_dir, rootfs, extraopts) | ||
| 334 | exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo) | 339 | exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo) |
| 335 | 340 | ||
| 336 | def prepare_empty_partition_ext(self, rootfs, oe_builddir, | 341 | def prepare_empty_partition_ext(self, rootfs, oe_builddir, |
| @@ -342,14 +347,14 @@ class Partition(): | |||
| 342 | with open(rootfs, 'w') as sparse: | 347 | with open(rootfs, 'w') as sparse: |
| 343 | os.ftruncate(sparse.fileno(), size * 1024) | 348 | os.ftruncate(sparse.fileno(), size * 1024) |
| 344 | 349 | ||
| 345 | extra_imagecmd = "-i 8192" | 350 | extraopts = self.mkfs_extraopts or "-i 8192" |
| 346 | 351 | ||
| 347 | label_str = "" | 352 | label_str = "" |
| 348 | if self.label: | 353 | if self.label: |
| 349 | label_str = "-L %s" % self.label | 354 | label_str = "-L %s" % self.label |
| 350 | 355 | ||
| 351 | mkfs_cmd = "mkfs.%s -F %s %s %s" % \ | 356 | mkfs_cmd = "mkfs.%s -F %s %s %s" % \ |
| 352 | (self.fstype, extra_imagecmd, label_str, rootfs) | 357 | (self.fstype, extraopts, label_str, rootfs) |
| 353 | exec_native_cmd(mkfs_cmd, native_sysroot) | 358 | exec_native_cmd(mkfs_cmd, native_sysroot) |
| 354 | 359 | ||
| 355 | def prepare_empty_partition_btrfs(self, rootfs, oe_builddir, | 360 | def prepare_empty_partition_btrfs(self, rootfs, oe_builddir, |
| @@ -365,8 +370,9 @@ class Partition(): | |||
| 365 | if self.label: | 370 | if self.label: |
| 366 | label_str = "-L %s" % self.label | 371 | label_str = "-L %s" % self.label |
| 367 | 372 | ||
| 368 | mkfs_cmd = "mkfs.%s -b %d %s %s" % \ | 373 | mkfs_cmd = "mkfs.%s -b %d %s %s %s" % \ |
| 369 | (self.fstype, self.size * 1024, label_str, rootfs) | 374 | (self.fstype, self.size * 1024, label_str, |
| 375 | self.mkfs_extraopts, rootfs) | ||
| 370 | exec_native_cmd(mkfs_cmd, native_sysroot) | 376 | exec_native_cmd(mkfs_cmd, native_sysroot) |
| 371 | 377 | ||
| 372 | def prepare_empty_partition_msdos(self, rootfs, oe_builddir, | 378 | def prepare_empty_partition_msdos(self, rootfs, oe_builddir, |
| @@ -384,8 +390,11 @@ class Partition(): | |||
| 384 | if self.fstype == 'msdos': | 390 | if self.fstype == 'msdos': |
| 385 | size_str = "-F 16" # FAT 16 | 391 | size_str = "-F 16" # FAT 16 |
| 386 | 392 | ||
| 387 | dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str, | 393 | extraopts = self.mkfs_extraopts or '-S 512' |
| 388 | rootfs, blocks) | 394 | |
| 395 | dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \ | ||
| 396 | (label_str, extraopts, size_str, rootfs, blocks) | ||
| 397 | |||
| 389 | exec_native_cmd(dosfs_cmd, native_sysroot) | 398 | exec_native_cmd(dosfs_cmd, native_sysroot) |
| 390 | 399 | ||
| 391 | chmod_cmd = "chmod 644 %s" % rootfs | 400 | chmod_cmd = "chmod 644 %s" % rootfs |
