summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/utils
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-06-05 09:13:08 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-11 23:59:11 +0100
commit4f9fe5b6165f9e8c02af199887404ad1d33e2c74 (patch)
tree456febcb4752eca533571463d31d00754d30da0d /scripts/lib/wic/utils
parentdec9156ce86eb00153493d3d49344f0623ec4562 (diff)
downloadpoky-4f9fe5b6165f9e8c02af199887404ad1d33e2c74.tar.gz
wic: replaced __run_parted with exec_native_cmd
There is no need for yet another wrapper around exec_native_cmd. (From OE-Core rev: f0f163e55865dc10d2a4188b5f2d759836c13f68) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/utils')
-rw-r--r--scripts/lib/wic/utils/partitionedfs.py32
1 files changed, 13 insertions, 19 deletions
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 8fd44a6a96..dcb63e584a 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -220,15 +220,6 @@ class Image:
220 220
221 d['min_size'] *= self.sector_size 221 d['min_size'] *= self.sector_size
222 222
223 def __run_parted(self, args):
224 """ Run parted with arguments specified in the 'args' list. """
225
226 args.insert(0, "parted")
227 args = ' '.join(args)
228 msger.debug(args)
229
230 exec_native_cmd(args, self.native_sysroot)
231
232 def __create_partition(self, device, parttype, fstype, start, size): 223 def __create_partition(self, device, parttype, fstype, start, size):
233 """ Create a partition on an image described by the 'device' object. """ 224 """ Create a partition on an image described by the 'device' object. """
234 225
@@ -237,12 +228,12 @@ class Image:
237 msger.debug("Added '%s' partition, sectors %d-%d, size %d sectors" % 228 msger.debug("Added '%s' partition, sectors %d-%d, size %d sectors" %
238 (parttype, start, end, size)) 229 (parttype, start, end, size))
239 230
240 args = ["-s", device, "unit", "s", "mkpart", parttype] 231 cmd = "parted -s %s unit s mkpart %s" % (device, parttype)
241 if fstype: 232 if fstype:
242 args.extend([fstype]) 233 cmd += " %s" % fstype
243 args.extend(["%d" % start, "%d" % end]) 234 cmd += " %d %d" % (start, end)
244 235
245 return self.__run_parted(args) 236 return exec_native_cmd(cmd, self.native_sysroot)
246 237
247 def __format_disks(self): 238 def __format_disks(self):
248 self.layout_partitions() 239 self.layout_partitions()
@@ -251,8 +242,9 @@ class Image:
251 d = self.disks[dev] 242 d = self.disks[dev]
252 msger.debug("Initializing partition table for %s" % \ 243 msger.debug("Initializing partition table for %s" % \
253 (d['disk'].device)) 244 (d['disk'].device))
254 self.__run_parted(["-s", d['disk'].device, "mklabel", 245 exec_native_cmd("parted -s %s mklabel %s" % \
255 d['ptable_format']]) 246 (d['disk'].device, d['ptable_format']),
247 self.native_sysroot)
256 248
257 msger.debug("Creating partitions") 249 msger.debug("Creating partitions")
258 250
@@ -305,8 +297,9 @@ class Image:
305 flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot" 297 flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot"
306 msger.debug("Set '%s' flag for partition '%s' on disk '%s'" % \ 298 msger.debug("Set '%s' flag for partition '%s' on disk '%s'" % \
307 (flag_name, p['num'], d['disk'].device)) 299 (flag_name, p['num'], d['disk'].device))
308 self.__run_parted(["-s", d['disk'].device, "set", 300 exec_native_cmd("parted -s %s set %d %s on" % \
309 "%d" % p['num'], flag_name, "on"]) 301 (d['disk'].device, p['num'], flag_name),
302 self.native_sysroot)
310 303
311 # Parted defaults to enabling the lba flag for fat16 partitions, 304 # Parted defaults to enabling the lba flag for fat16 partitions,
312 # which causes compatibility issues with some firmware (and really 305 # which causes compatibility issues with some firmware (and really
@@ -315,8 +308,9 @@ class Image:
315 if d['ptable_format'] == 'msdos': 308 if d['ptable_format'] == 'msdos':
316 msger.debug("Disable 'lba' flag for partition '%s' on disk '%s'" % \ 309 msger.debug("Disable 'lba' flag for partition '%s' on disk '%s'" % \
317 (p['num'], d['disk'].device)) 310 (p['num'], d['disk'].device))
318 self.__run_parted(["-s", d['disk'].device, "set", 311 exec_native_cmd("parted -s %s set %d lba off" % \
319 "%d" % p['num'], "lba", "off"]) 312 (d['disk'].device, p['num']),
313 self.native_sysroot)
320 314
321 def cleanup(self): 315 def cleanup(self):
322 if self.disks: 316 if self.disks: