summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/kickstart/custom_commands/partition.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/kickstart/custom_commands/partition.py')
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/partition.py72
1 files changed, 36 insertions, 36 deletions
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index bac2067a5a..eee25a493d 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -154,7 +154,7 @@ class Wic_PartData(FC4_PartData):
154 else: 154 else:
155 return 0 155 return 0
156 156
157 def prepare(self, cr, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir, 157 def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir,
158 kernel_dir, native_sysroot): 158 kernel_dir, native_sysroot):
159 """ 159 """
160 Prepare content for individual partitions, depending on 160 Prepare content for individual partitions, depending on
@@ -199,18 +199,18 @@ class Wic_PartData(FC4_PartData):
199 self._source_methods = pluginmgr.get_source_plugin_methods(\ 199 self._source_methods = pluginmgr.get_source_plugin_methods(\
200 self.source, partition_methods) 200 self.source, partition_methods)
201 self._source_methods["do_configure_partition"](self, self.sourceparams_dict, 201 self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
202 cr, cr_workdir, 202 creator, cr_workdir,
203 oe_builddir, 203 oe_builddir,
204 bootimg_dir, 204 bootimg_dir,
205 kernel_dir, 205 kernel_dir,
206 native_sysroot) 206 native_sysroot)
207 self._source_methods["do_stage_partition"](self, self.sourceparams_dict, 207 self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
208 cr, cr_workdir, 208 creator, cr_workdir,
209 oe_builddir, 209 oe_builddir,
210 bootimg_dir, kernel_dir, 210 bootimg_dir, kernel_dir,
211 native_sysroot) 211 native_sysroot)
212 self._source_methods["do_prepare_partition"](self, self.sourceparams_dict, 212 self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
213 cr, cr_workdir, 213 creator, cr_workdir,
214 oe_builddir, 214 oe_builddir,
215 bootimg_dir, kernel_dir, rootfs_dir, 215 bootimg_dir, kernel_dir, rootfs_dir,
216 native_sysroot) 216 native_sysroot)
@@ -441,21 +441,21 @@ class Wic_PartData(FC4_PartData):
441 msger.warning("Creating of an empty squashfs %s partition was attempted. " \ 441 msger.warning("Creating of an empty squashfs %s partition was attempted. " \
442 "Proceeding as requested." % self.mountpoint) 442 "Proceeding as requested." % self.mountpoint)
443 443
444 fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) 444 path = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
445 os.path.isfile(fs) and os.remove(fs) 445 os.path.isfile(path) and os.remove(path)
446 446
447 # it is not possible to create a squashfs without source data, 447 # it is not possible to create a squashfs without source data,
448 # thus prepare an empty temp dir that is used as source 448 # thus prepare an empty temp dir that is used as source
449 tmpdir = tempfile.mkdtemp() 449 tmpdir = tempfile.mkdtemp()
450 450
451 squashfs_cmd = "mksquashfs %s %s -noappend" % \ 451 squashfs_cmd = "mksquashfs %s %s -noappend" % \
452 (tmpdir, fs) 452 (tmpdir, path)
453 exec_native_cmd(squashfs_cmd, native_sysroot) 453 exec_native_cmd(squashfs_cmd, native_sysroot)
454 454
455 os.rmdir(tmpdir) 455 os.rmdir(tmpdir)
456 456
457 # get the rootfs size in the right units for kickstart (kB) 457 # get the rootfs size in the right units for kickstart (kB)
458 du_cmd = "du -Lbks %s" % fs 458 du_cmd = "du -Lbks %s" % path
459 out = exec_cmd(du_cmd) 459 out = exec_cmd(du_cmd)
460 fs_size = out.split()[0] 460 fs_size = out.split()[0]
461 461
@@ -465,17 +465,17 @@ class Wic_PartData(FC4_PartData):
465 """ 465 """
466 Prepare a swap partition. 466 Prepare a swap partition.
467 """ 467 """
468 fs = "%s/fs.%s" % (cr_workdir, self.fstype) 468 path = "%s/fs.%s" % (cr_workdir, self.fstype)
469 469
470 dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ 470 dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
471 (fs, self.size) 471 (path, self.size)
472 exec_cmd(dd_cmd) 472 exec_cmd(dd_cmd)
473 473
474 import uuid 474 import uuid
475 label_str = "" 475 label_str = ""
476 if self.label: 476 if self.label:
477 label_str = "-L %s" % self.label 477 label_str = "-L %s" % self.label
478 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs) 478 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path)
479 exec_native_cmd(mkswap_cmd, native_sysroot) 479 exec_native_cmd(mkswap_cmd, native_sysroot)
480 480
481 481
@@ -490,37 +490,37 @@ class Wic_Partition(FC4_Partition):
490 (option, value)) 490 (option, value))
491 setattr(parser.values, option.dest, value) 491 setattr(parser.values, option.dest, value)
492 492
493 op = FC4_Partition._getParser(self) 493 parser = FC4_Partition._getParser(self)
494 494
495 # The alignment value is given in kBytes. e.g., value 8 means that 495 # The alignment value is given in kBytes. e.g., value 8 means that
496 # the partition is aligned to start from 8096 byte boundary. 496 # the partition is aligned to start from 8096 byte boundary.
497 op.add_option("--align", type="int", action="store", dest="align", 497 parser.add_option("--align", type="int", action="store", dest="align",
498 default=None) 498 default=None)
499 op.add_option("--extoptions", type="string", action="store", dest="extopts", 499 parser.add_option("--extoptions", type="string", action="store", dest="extopts",
500 default=None) 500 default=None)
501 op.add_option("--part-type", type="string", action="store", dest="part_type", 501 parser.add_option("--part-type", type="string", action="store", dest="part_type",
502 default=None) 502 default=None)
503 # use specified source file to fill the partition 503 # use specified source file to fill the partition
504 # and calculate partition size 504 # and calculate partition size
505 op.add_option("--source", type="string", action="store", 505 parser.add_option("--source", type="string", action="store",
506 dest="source", default=None) 506 dest="source", default=None)
507 # comma-separated list of param=value pairs 507 # comma-separated list of param=value pairs
508 op.add_option("--sourceparams", type="string", action="store", 508 parser.add_option("--sourceparams", type="string", action="store",
509 dest="sourceparams", default=None) 509 dest="sourceparams", default=None)
510 # use specified rootfs path to fill the partition 510 # use specified rootfs path to fill the partition
511 op.add_option("--rootfs-dir", type="string", action="store", 511 parser.add_option("--rootfs-dir", type="string", action="store",
512 dest="rootfs", default=None) 512 dest="rootfs", default=None)
513 # wether to add the partition in the partition table 513 # wether to add the partition in the partition table
514 op.add_option("--no-table", dest="no_table", action="store_true", 514 parser.add_option("--no-table", dest="no_table", action="store_true",
515 default=False) 515 default=False)
516 # extra space beyond the partition size 516 # extra space beyond the partition size
517 op.add_option("--extra-space", dest="extra_space", action="store", 517 parser.add_option("--extra-space", dest="extra_space", action="store",
518 type="size", nargs=1, default="10M") 518 type="size", nargs=1, default="10M")
519 op.add_option("--overhead-factor", dest="overhead_factor", 519 parser.add_option("--overhead-factor", dest="overhead_factor",
520 action="callback", callback=overhead_cb, type="float", 520 action="callback", callback=overhead_cb, type="float",
521 nargs=1, default=1.3) 521 nargs=1, default=1.3)
522 op.add_option("--use-uuid", dest="use_uuid", action="store_true", 522 parser.add_option("--use-uuid", dest="use_uuid", action="store_true",
523 default=False) 523 default=False)
524 op.add_option("--uuid") 524 parser.add_option("--uuid")
525 525
526 return op 526 return parser