]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: allow to configure extra space per partition
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sun, 8 Feb 2015 23:16:22 +0000 (00:16 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 14 Feb 2015 08:40:34 +0000 (08:40 +0000)
Introduce a new option --extra-space instead of using IMAGE_EXTRA_SPACE.
This is useful for boot partitions where the extra space is often
useless or for huge partition where 10MiB may not be enough.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/image/help.py
scripts/lib/wic/kickstart/custom_commands/partition.py
scripts/lib/wic/utils/oe/misc.py

index aab0b609afd537b68643309b2dd2e8ca95e25c16..8e026986aa97519313726bf834d09c620060ab32 100644 (file)
@@ -743,6 +743,12 @@ DESCRIPTION
                      partition table. It may be useful for
                      bootloaders.
 
+         --extra-space: This option is specific to wic. It adds extra
+                        space after the space filled by the content
+                        of the partition. The final size can go
+                        beyond the size specified by --size.
+                        By default, 10MB.
+
     * bootloader
 
       This command allows the user to specify various bootloader
index 9be6b0457b486ea173fb35173a7561ef0f9d9658..8bde1b80e16ab9d23e29d3771fafb5ba49c9204d 100644 (file)
@@ -50,6 +50,7 @@ class Wic_PartData(Mic_PartData):
         self.sourceparams = kwargs.get("sourceparams", None)
         self.rootfs = kwargs.get("rootfs-dir", None)
         self.no_table = kwargs.get("no-table", False)
+        self.extra_space = kwargs.get("extra-space", "10M")
         self.source_file = ""
         self.size = 0
 
@@ -64,6 +65,7 @@ class Wic_PartData(Mic_PartData):
                 retval += " --rootfs-dir=%s" % self.rootfs
         if self.no_table:
             retval += " --no-table"
+        retval += " --extra-space=%d" % self.extra_space
 
         return retval
 
@@ -227,9 +229,8 @@ class Wic_PartData(Mic_PartData):
         actual_rootfs_size = int(out.split()[0])
 
         extra_blocks = self.get_extra_block_count(actual_rootfs_size)
-
-        if extra_blocks < IMAGE_EXTRA_SPACE:
-            extra_blocks = IMAGE_EXTRA_SPACE
+        if extra_blocks < self.extra_space:
+            extra_blocks = self.extra_space
 
         rootfs_size = actual_rootfs_size + extra_blocks
         rootfs_size *= IMAGE_OVERHEAD_FACTOR
@@ -275,9 +276,8 @@ class Wic_PartData(Mic_PartData):
         actual_rootfs_size = int(out.split()[0])
 
         extra_blocks = self.get_extra_block_count(actual_rootfs_size)
-
-        if extra_blocks < IMAGE_EXTRA_SPACE:
-            extra_blocks = IMAGE_EXTRA_SPACE
+        if extra_blocks < self.extra_space:
+            extra_blocks = self.extra_space
 
         rootfs_size = actual_rootfs_size + extra_blocks
         rootfs_size *= IMAGE_OVERHEAD_FACTOR
@@ -316,9 +316,8 @@ class Wic_PartData(Mic_PartData):
         blocks = int(out.split()[0])
 
         extra_blocks = self.get_extra_block_count(blocks)
-
-        if extra_blocks < IMAGE_EXTRA_SPACE:
-            extra_blocks = IMAGE_EXTRA_SPACE
+        if extra_blocks < self.extra_space:
+            extra_blocks = self.extra_space
 
         blocks += extra_blocks
 
@@ -527,4 +526,7 @@ class Wic_Partition(Mic_Partition):
         # wether to add the partition in the partition table
         op.add_option("--no-table", dest="no_table", action="store_true",
                       default=False)
+        # extra space beyond the partition size
+        op.add_option("--extra-space", dest="extra_space", action="store",
+                      type="size", nargs=1, default="10M")
         return op
index b0b5baab7322a295441dd189fdd67657afc148c9..fa14fee1abc9b59f190dea5f24abf0d787177bed 100644 (file)
@@ -122,7 +122,6 @@ def add_wks_var(key, val):
     wks_vars[key] = val
 
 BOOTDD_EXTRA_SPACE = 16384
-IMAGE_EXTRA_SPACE = 10240
 IMAGE_OVERHEAD_FACTOR = 1.3
 
 __bitbake_env_lines = ""