mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
d84742c39f
commit
cf3e21e71e
@@ -749,6 +749,12 @@ DESCRIPTION
|
|||||||
beyond the size specified by --size.
|
beyond the size specified by --size.
|
||||||
By default, 10MB.
|
By default, 10MB.
|
||||||
|
|
||||||
|
--overhead-factor: This option is specific to wic. The
|
||||||
|
size of the partition is multiplied by
|
||||||
|
this factor. It has to be greater than or
|
||||||
|
equal to 1.
|
||||||
|
The default value is 1.3.
|
||||||
|
|
||||||
* bootloader
|
* bootloader
|
||||||
|
|
||||||
This command allows the user to specify various bootloader
|
This command allows the user to specify various bootloader
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class Wic_PartData(Mic_PartData):
|
|||||||
self.rootfs = kwargs.get("rootfs-dir", None)
|
self.rootfs = kwargs.get("rootfs-dir", None)
|
||||||
self.no_table = kwargs.get("no-table", False)
|
self.no_table = kwargs.get("no-table", False)
|
||||||
self.extra_space = kwargs.get("extra-space", "10M")
|
self.extra_space = kwargs.get("extra-space", "10M")
|
||||||
|
self.overhead_factor = kwargs.get("overhead-factor", 1.3)
|
||||||
self.source_file = ""
|
self.source_file = ""
|
||||||
self.size = 0
|
self.size = 0
|
||||||
|
|
||||||
@@ -66,6 +67,7 @@ class Wic_PartData(Mic_PartData):
|
|||||||
if self.no_table:
|
if self.no_table:
|
||||||
retval += " --no-table"
|
retval += " --no-table"
|
||||||
retval += " --extra-space=%d" % self.extra_space
|
retval += " --extra-space=%d" % self.extra_space
|
||||||
|
retval += " --overhead-factor=%f" % self.overhead_factor
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
@@ -233,7 +235,7 @@ class Wic_PartData(Mic_PartData):
|
|||||||
extra_blocks = self.extra_space
|
extra_blocks = self.extra_space
|
||||||
|
|
||||||
rootfs_size = actual_rootfs_size + extra_blocks
|
rootfs_size = actual_rootfs_size + extra_blocks
|
||||||
rootfs_size *= IMAGE_OVERHEAD_FACTOR
|
rootfs_size *= self.overhead_factor
|
||||||
|
|
||||||
msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
|
msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
|
||||||
(extra_blocks, self.mountpoint, rootfs_size))
|
(extra_blocks, self.mountpoint, rootfs_size))
|
||||||
@@ -280,7 +282,7 @@ class Wic_PartData(Mic_PartData):
|
|||||||
extra_blocks = self.extra_space
|
extra_blocks = self.extra_space
|
||||||
|
|
||||||
rootfs_size = actual_rootfs_size + extra_blocks
|
rootfs_size = actual_rootfs_size + extra_blocks
|
||||||
rootfs_size *= IMAGE_OVERHEAD_FACTOR
|
rootfs_size *= self.overhead_factor
|
||||||
|
|
||||||
msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
|
msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
|
||||||
(extra_blocks, self.mountpoint, rootfs_size))
|
(extra_blocks, self.mountpoint, rootfs_size))
|
||||||
@@ -512,6 +514,11 @@ class Wic_Partition(Mic_Partition):
|
|||||||
removedAttrs = Mic_Partition.removedAttrs
|
removedAttrs = Mic_Partition.removedAttrs
|
||||||
|
|
||||||
def _getParser(self):
|
def _getParser(self):
|
||||||
|
def overhead_cb (option, opt_str, value, parser):
|
||||||
|
if (value < 1):
|
||||||
|
raise OptionValueError("Option %s: invalid value: %r" % (option, value))
|
||||||
|
setattr(parser.values, option.dest, value)
|
||||||
|
|
||||||
op = Mic_Partition._getParser(self)
|
op = Mic_Partition._getParser(self)
|
||||||
# use specified source file to fill the partition
|
# use specified source file to fill the partition
|
||||||
# and calculate partition size
|
# and calculate partition size
|
||||||
@@ -529,4 +536,7 @@ class Wic_Partition(Mic_Partition):
|
|||||||
# extra space beyond the partition size
|
# extra space beyond the partition size
|
||||||
op.add_option("--extra-space", dest="extra_space", action="store",
|
op.add_option("--extra-space", dest="extra_space", action="store",
|
||||||
type="size", nargs=1, default="10M")
|
type="size", nargs=1, default="10M")
|
||||||
|
op.add_option("--overhead-factor", dest="overhead_factor",
|
||||||
|
action="callback", callback=overhead_cb, type="float",
|
||||||
|
nargs=1, default=1.3)
|
||||||
return op
|
return op
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ def add_wks_var(key, val):
|
|||||||
wks_vars[key] = val
|
wks_vars[key] = val
|
||||||
|
|
||||||
BOOTDD_EXTRA_SPACE = 16384
|
BOOTDD_EXTRA_SPACE = 16384
|
||||||
IMAGE_OVERHEAD_FACTOR = 1.3
|
|
||||||
|
|
||||||
__bitbake_env_lines = ""
|
__bitbake_env_lines = ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user