[OE-core] [PATCH] wic/bootimg-efi: Respect fixed partition size

Andrei Gherzan andrei at gherzan.ro
Mon Mar 16 15:28:20 UTC 2020


Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 21 +++++++++++--------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 2cfdc10ecd..6c3d7b8491 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -263,19 +263,22 @@ class BootimgEFIPlugin(SourcePlugin):
             cp_cmd = "cp %s %s/" % (startup, hdddir)
             exec_cmd(cp_cmd, True)
 
-        du_cmd = "du -bks %s" % hdddir
-        out = exec_cmd(du_cmd)
-        blocks = int(out.split()[0])
+        if part.fixed-size:
+            blocks = part.fixed_size
+        else:
+            du_cmd = "du -bks %s" % hdddir
+            out = exec_cmd(du_cmd)
+            blocks = int(out.split()[0])
 
-        extra_blocks = part.get_extra_block_count(blocks)
+            extra_blocks = part.get_extra_block_count(blocks)
 
-        if extra_blocks < BOOTDD_EXTRA_SPACE:
-            extra_blocks = BOOTDD_EXTRA_SPACE
+            if extra_blocks < BOOTDD_EXTRA_SPACE:
+                extra_blocks = BOOTDD_EXTRA_SPACE
 
-        blocks += extra_blocks
+            blocks += extra_blocks
 
-        logger.debug("Added %d extra blocks to %s to get to %d total blocks",
-                     extra_blocks, part.mountpoint, blocks)
+            logger.debug("Added %d extra blocks to %s to get to %d total blocks",
+                         extra_blocks, part.mountpoint, blocks)
 
         # dosfs image, created by mkdosfs
         bootimg = "%s/boot.img" % cr_workdir
-- 
2.17.1



More information about the Openembedded-core mailing list