summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/engine.py
diff options
context:
space:
mode:
authorVince Chang <vince_chang@aspeedtech.com>2024-10-28 11:46:17 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-10-29 11:19:57 +0000
commit6d90d0ba44a00fc92861040b05f39e0ef93d9b99 (patch)
treed9b103c49909d94ae7bfac24f2e524e374c2fb65 /scripts/lib/wic/engine.py
parente402454a619435c554e2a433f9752cd15b228c60 (diff)
downloadpoky-6d90d0ba44a00fc92861040b05f39e0ef93d9b99.tar.gz
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>
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r--scripts/lib/wic/engine.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index ce7e6c5d75..64b1d52882 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -232,6 +232,16 @@ class Disk:
232 self._psector_size = None 232 self._psector_size = None
233 self._ptable_format = None 233 self._ptable_format = None
234 234
235 # define sector size
236 sector_size_str = get_bitbake_var('WIC_SECTOR_SIZE')
237 if sector_size_str is not None:
238 try:
239 self.sector_size = int(sector_size_str)
240 except ValueError:
241 self.sector_size = None
242 else:
243 self.sector_size = None
244
235 # find parted 245 # find parted
236 # read paths from $PATH environment variable 246 # read paths from $PATH environment variable
237 # if it fails, use hardcoded paths 247 # if it fails, use hardcoded paths
@@ -258,7 +268,13 @@ class Disk:
258 def get_partitions(self): 268 def get_partitions(self):
259 if self._partitions is None: 269 if self._partitions is None:
260 self._partitions = OrderedDict() 270 self._partitions = OrderedDict()
261 out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath)) 271
272 if self.sector_size is not None:
273 out = exec_cmd("export PARTED_SECTOR_SIZE=%d; %s -sm %s unit B print" % \
274 (self.sector_size, self.parted, self.imagepath), True)
275 else:
276 out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath))
277
262 parttype = namedtuple("Part", "pnum start end size fstype") 278 parttype = namedtuple("Part", "pnum start end size fstype")
263 splitted = out.splitlines() 279 splitted = out.splitlines()
264 # skip over possible errors in exec_cmd output 280 # skip over possible errors in exec_cmd output