summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-02-09 00:16:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-14 08:40:58 +0000
commitcf3e21e71e6815b76d58d018719e8bf7ec977d7b (patch)
tree57f7e6b311fb8d624acfc6da2acf1e5d9496352b
parentd84742c39f39fefb7810c6f902cada222c7e4252 (diff)
downloadpoky-cf3e21e71e6815b76d58d018719e8bf7ec977d7b.tar.gz
wic: allow to configure overhead factor per partition
Introduce a new option --overhead-factor to replace IMAGE_OVERHEAD_FACTOR. (From OE-Core rev: 20fe0c7202724187dbe80eb2101d8ef69e86b94e) Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/image/help.py6
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/partition.py14
-rw-r--r--scripts/lib/wic/utils/oe/misc.py1
3 files changed, 18 insertions, 3 deletions
diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py
index 8e026986aa..e1eb265979 100644
--- a/scripts/lib/image/help.py
+++ b/scripts/lib/image/help.py
@@ -749,6 +749,12 @@ DESCRIPTION
749 beyond the size specified by --size. 749 beyond the size specified by --size.
750 By default, 10MB. 750 By default, 10MB.
751 751
752 --overhead-factor: This option is specific to wic. The
753 size of the partition is multiplied by
754 this factor. It has to be greater than or
755 equal to 1.
756 The default value is 1.3.
757
752 * bootloader 758 * bootloader
753 759
754 This command allows the user to specify various bootloader 760 This command allows the user to specify various bootloader
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index 8bde1b80e1..44df20c58a 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -51,6 +51,7 @@ class Wic_PartData(Mic_PartData):
51 self.rootfs = kwargs.get("rootfs-dir", None) 51 self.rootfs = kwargs.get("rootfs-dir", None)
52 self.no_table = kwargs.get("no-table", False) 52 self.no_table = kwargs.get("no-table", False)
53 self.extra_space = kwargs.get("extra-space", "10M") 53 self.extra_space = kwargs.get("extra-space", "10M")
54 self.overhead_factor = kwargs.get("overhead-factor", 1.3)
54 self.source_file = "" 55 self.source_file = ""
55 self.size = 0 56 self.size = 0
56 57
@@ -66,6 +67,7 @@ class Wic_PartData(Mic_PartData):
66 if self.no_table: 67 if self.no_table:
67 retval += " --no-table" 68 retval += " --no-table"
68 retval += " --extra-space=%d" % self.extra_space 69 retval += " --extra-space=%d" % self.extra_space
70 retval += " --overhead-factor=%f" % self.overhead_factor
69 71
70 return retval 72 return retval
71 73
@@ -233,7 +235,7 @@ class Wic_PartData(Mic_PartData):
233 extra_blocks = self.extra_space 235 extra_blocks = self.extra_space
234 236
235 rootfs_size = actual_rootfs_size + extra_blocks 237 rootfs_size = actual_rootfs_size + extra_blocks
236 rootfs_size *= IMAGE_OVERHEAD_FACTOR 238 rootfs_size *= self.overhead_factor
237 239
238 msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ 240 msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
239 (extra_blocks, self.mountpoint, rootfs_size)) 241 (extra_blocks, self.mountpoint, rootfs_size))
@@ -280,7 +282,7 @@ class Wic_PartData(Mic_PartData):
280 extra_blocks = self.extra_space 282 extra_blocks = self.extra_space
281 283
282 rootfs_size = actual_rootfs_size + extra_blocks 284 rootfs_size = actual_rootfs_size + extra_blocks
283 rootfs_size *= IMAGE_OVERHEAD_FACTOR 285 rootfs_size *= self.overhead_factor
284 286
285 msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ 287 msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
286 (extra_blocks, self.mountpoint, rootfs_size)) 288 (extra_blocks, self.mountpoint, rootfs_size))
@@ -512,6 +514,11 @@ class Wic_Partition(Mic_Partition):
512 removedAttrs = Mic_Partition.removedAttrs 514 removedAttrs = Mic_Partition.removedAttrs
513 515
514 def _getParser(self): 516 def _getParser(self):
517 def overhead_cb (option, opt_str, value, parser):
518 if (value < 1):
519 raise OptionValueError("Option %s: invalid value: %r" % (option, value))
520 setattr(parser.values, option.dest, value)
521
515 op = Mic_Partition._getParser(self) 522 op = Mic_Partition._getParser(self)
516 # use specified source file to fill the partition 523 # use specified source file to fill the partition
517 # and calculate partition size 524 # and calculate partition size
@@ -529,4 +536,7 @@ class Wic_Partition(Mic_Partition):
529 # extra space beyond the partition size 536 # extra space beyond the partition size
530 op.add_option("--extra-space", dest="extra_space", action="store", 537 op.add_option("--extra-space", dest="extra_space", action="store",
531 type="size", nargs=1, default="10M") 538 type="size", nargs=1, default="10M")
539 op.add_option("--overhead-factor", dest="overhead_factor",
540 action="callback", callback=overhead_cb, type="float",
541 nargs=1, default=1.3)
532 return op 542 return op
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index fa14fee1ab..ea9b6e8ec4 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -122,7 +122,6 @@ def add_wks_var(key, val):
122 wks_vars[key] = val 122 wks_vars[key] = val
123 123
124BOOTDD_EXTRA_SPACE = 16384 124BOOTDD_EXTRA_SPACE = 16384
125IMAGE_OVERHEAD_FACTOR = 1.3
126 125
127__bitbake_env_lines = "" 126__bitbake_env_lines = ""
128 127