]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: fix vfat partition sector count only if needed
authorMaciej Borzecki <maciej.borzecki@open-rnd.pl>
Mon, 22 Sep 2014 11:35:15 +0000 (13:35 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 23 Sep 2014 19:35:41 +0000 (20:35 +0100)
VFAT rootfs partitions sector count would get updated always even if
there is no need. Since parition size in wic is expressed in MB, any
sub MB change will cause the generated partition image to be larger
than allocated space within the disk image. Fortunately, partitions
sized in MB will most of the time have a proper sector count.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/kickstart/custom_commands/partition.py

index f41d136d8fdc8683bbe3fad13fba921c3b59f78f..8b0ace6299d5107343231ce86ed2960467497265 100644 (file)
@@ -318,9 +318,11 @@ class Wic_PartData(Mic_PartData):
 
         # Ensure total sectors is an integral number of sectors per
         # track or mcopy will complain. Sectors are 512 bytes, and we
-        # generate images with 32 sectors per track. This calculation is
-        # done in blocks, thus the mod by 16 instead of 32.
-        blocks += (16 - (blocks % 16))
+        # generate images with 32 sectors per track. This calculation
+        # is done in blocks, thus the mod by 16 instead of 32. Apply
+        # sector count fix only when needed.
+        if blocks % 16 != 0:
+            blocks += (16 - (blocks % 16))
 
         dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (rootfs, blocks)
         exec_native_cmd(dosfs_cmd, native_sysroot)