diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-06-14 19:52:03 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-28 03:22:11 +0300 |
commit | d5ae7d902a40f26a8c26f4c6d300226689738716 (patch) | |
tree | 85c711404990dd5e37447cd7492c3017815790b7 /poky/scripts/lib/wic/engine.py | |
parent | 0639c5b2c542e0ed9465cc9d8e5100ac0063038f (diff) | |
download | openbmc-d5ae7d902a40f26a8c26f4c6d300226689738716.tar.xz |
Sumo refresh
Update external subtrees to latest Yocto sumo.
Change-Id: I8364f32bef079841c6e57f1c587f4b1bedf62fef
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/scripts/lib/wic/engine.py')
-rw-r--r-- | poky/scripts/lib/wic/engine.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/poky/scripts/lib/wic/engine.py b/poky/scripts/lib/wic/engine.py index edcfab39ef..f0c5ff0aaf 100644 --- a/poky/scripts/lib/wic/engine.py +++ b/poky/scripts/lib/wic/engine.py @@ -284,8 +284,8 @@ class Disk: aname = "_%s" % name if aname not in self.__dict__: setattr(self, aname, find_executable(name, self.paths)) - if aname not in self.__dict__: - raise WicError("Can't find executable {}".format(name)) + if aname not in self.__dict__ or self.__dict__[aname] is None: + raise WicError("Can't find executable '{}'".format(name)) return self.__dict__[aname] return self.__dict__[name] @@ -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,11 +409,14 @@ 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") # calculate expanded partitions sizes sizes = {} + num_auto_resize = 0 for num, part in enumerate(parts['partitiontable']['partitions'], 1): if num in expand: if expand[num] != 0: # don't resize partition if size is set to 0 @@ -426,10 +426,11 @@ class Disk: sizes[num] = sectors elif part['type'] != 'f': sizes[num] = -1 + num_auto_resize += 1 for num, part in enumerate(parts['partitiontable']['partitions'], 1): if sizes.get(num) == -1: - part['size'] += free // len(sizes) + part['size'] += free // num_auto_resize # write resized partition table to the target write_ptable(parts, target) |