1
0
mirror of https://git.yoctoproject.org/poky synced 2026-07-16 03:47:03 +00:00

wic: add WIC_SECTOR_SIZE variable

Currently WIC is unable to generate images that requires a sector
size different of 512. Add WIC_SECTOR_SIZE variable to handle
the sector size of 4096 for UFS.

For "wic ls" command modify get_partitions() to support WIC_SECTOR_SIZE.

(From OE-Core rev: 2255f28b579bc5db4138bcacbb829661ae0ee721)

Signed-off-by: Vince Chang <vince_chang@aspeedtech.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Vince Chang
2024-10-28 11:46:17 +08:00
committed by Richard Purdie
parent e402454a61
commit 6d90d0ba44
2 changed files with 50 additions and 24 deletions
+17 -1
View File
@@ -232,6 +232,16 @@ class Disk:
self._psector_size = None
self._ptable_format = None
# define sector size
sector_size_str = get_bitbake_var('WIC_SECTOR_SIZE')
if sector_size_str is not None:
try:
self.sector_size = int(sector_size_str)
except ValueError:
self.sector_size = None
else:
self.sector_size = None
# find parted
# read paths from $PATH environment variable
# if it fails, use hardcoded paths
@@ -258,7 +268,13 @@ class Disk:
def get_partitions(self):
if self._partitions is None:
self._partitions = OrderedDict()
out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath))
if self.sector_size is not None:
out = exec_cmd("export PARTED_SECTOR_SIZE=%d; %s -sm %s unit B print" % \
(self.sector_size, self.parted, self.imagepath), True)
else:
out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath))
parttype = namedtuple("Part", "pnum start end size fstype")
splitted = out.splitlines()
# skip over possible errors in exec_cmd output