[oe-commits] [openembedded-core] 08/17: wic/engine: fix errors when expanding partitions
git at git.openembedded.org
git at git.openembedded.org
Sun Jul 29 23:03:19 UTC 2018
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch sumo
in repository openembedded-core.
commit 2217c4ec7682adce1fe683233d80c6d54888300b
Author: Anuj Mittal <anuj.mittal at intel.com>
AuthorDate: Thu Jul 12 10:05:24 2018 +0800
wic/engine: fix errors when expanding partitions
The UEFI spec implies that GPT partitions should be assumed to be on a 2048
sector boundary (for a 512 byte sector) and the current logic just
divides the free sectors available by the number of partitions that need
re-sizing, which may or may not align and the final result might
overshoot the limits imposed after alignment.
Since we are expanding already aligned partitions, just divide up the
free space in multiples of 2048. Also use the exec_cmd wrapper instead
of the subprocess call directly.
Fixes [YOCTO #12840]
(From OE-Core rev: 5eef63f5afdfbab8e30748cb1bf42bf2e6524759)
Signed-off-by: Anuj Mittal <anuj.mittal at intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
scripts/lib/wic/engine.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 9499236..fe036f6 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -391,11 +391,8 @@ class Disk:
def write_ptable(parts, target):
with tempfile.NamedTemporaryFile(prefix="wic-sfdisk-", mode='w') as outf:
write_sfdisk_script(outf, parts)
- cmd = "{} --no-reread {} < {} 2>/dev/null".format(self.sfdisk, target, outf.name)
- try:
- subprocess.check_output(cmd, shell=True)
- except subprocess.CalledProcessError as err:
- raise WicError("Can't run '{}' command: {}".format(cmd, err))
+ cmd = "{} --no-reread {} < {} ".format(self.sfdisk, target, outf.name)
+ exec_cmd(cmd, as_shell=True)
if expand is None:
sparse_copy(self.imagepath, target)
@@ -412,6 +409,8 @@ class Disk:
for line in exec_cmd("{} -F {}".format(self.sfdisk, target)).splitlines():
if line.startswith("Unpartitioned space ") and line.endswith("sectors"):
free = int(line.split()[-2])
+ # Align free space to a 2048 sector boundary. YOCTO #12840.
+ free = free - (free % 2048)
if free is None:
raise WicError("Can't get size of unpartitioned space")
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list