summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/engine.py
diff options
context:
space:
mode:
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