summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/partition.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/partition.py')
-rw-r--r--scripts/lib/wic/partition.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 8731238337..c0b67d829f 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -26,6 +26,7 @@
26 26
27import logging 27import logging
28import os 28import os
29import uuid
29 30
30from wic import WicError 31from wic import WicError
31from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var 32from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var
@@ -61,6 +62,7 @@ class Partition():
61 self.system_id = args.system_id 62 self.system_id = args.system_id
62 self.use_uuid = args.use_uuid 63 self.use_uuid = args.use_uuid
63 self.uuid = args.uuid 64 self.uuid = args.uuid
65 self.fsuuid = args.fsuuid
64 66
65 self.lineno = lineno 67 self.lineno = lineno
66 self.source_file = "" 68 self.source_file = ""
@@ -264,8 +266,8 @@ class Partition():
264 if self.label: 266 if self.label:
265 label_str = "-L %s" % self.label 267 label_str = "-L %s" % self.label
266 268
267 mkfs_cmd = "mkfs.%s %s %s %s -d %s" % \ 269 mkfs_cmd = "mkfs.%s %s %s %s -U %s -d %s" % \
268 (self.fstype, extraopts, rootfs, label_str, rootfs_dir) 270 (self.fstype, extraopts, rootfs, label_str, self.fsuuid, rootfs_dir)
269 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) 271 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
270 272
271 mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) 273 mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs)
@@ -289,9 +291,9 @@ class Partition():
289 if self.label: 291 if self.label:
290 label_str = "-L %s" % self.label 292 label_str = "-L %s" % self.label
291 293
292 mkfs_cmd = "mkfs.%s -b %d -r %s %s %s %s" % \ 294 mkfs_cmd = "mkfs.%s -b %d -r %s %s %s -U %s %s" % \
293 (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, 295 (self.fstype, rootfs_size * 1024, rootfs_dir, label_str,
294 self.mkfs_extraopts, rootfs) 296 self.mkfs_extraopts, self.fsuuid, rootfs)
295 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) 297 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
296 298
297 def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir, 299 def prepare_rootfs_msdos(self, rootfs, oe_builddir, rootfs_dir,
@@ -315,8 +317,9 @@ class Partition():
315 317
316 extraopts = self.mkfs_extraopts or '-S 512' 318 extraopts = self.mkfs_extraopts or '-S 512'
317 319
318 dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \ 320 dosfs_cmd = "mkdosfs %s -i %s %s %s -C %s %d" % \
319 (label_str, size_str, extraopts, rootfs, rootfs_size) 321 (label_str, self.fsuuid, size_str, extraopts, rootfs,
322 rootfs_size)
320 exec_native_cmd(dosfs_cmd, native_sysroot) 323 exec_native_cmd(dosfs_cmd, native_sysroot)
321 324
322 mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir) 325 mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
@@ -352,8 +355,8 @@ class Partition():
352 if self.label: 355 if self.label:
353 label_str = "-L %s" % self.label 356 label_str = "-L %s" % self.label
354 357
355 mkfs_cmd = "mkfs.%s -F %s %s %s" % \ 358 mkfs_cmd = "mkfs.%s -F %s %s -U %s %s" % \
356 (self.fstype, extraopts, label_str, rootfs) 359 (self.fstype, extraopts, label_str, self.fsuuid, rootfs)
357 exec_native_cmd(mkfs_cmd, native_sysroot) 360 exec_native_cmd(mkfs_cmd, native_sysroot)
358 361
359 def prepare_empty_partition_btrfs(self, rootfs, oe_builddir, 362 def prepare_empty_partition_btrfs(self, rootfs, oe_builddir,
@@ -369,8 +372,8 @@ class Partition():
369 if self.label: 372 if self.label:
370 label_str = "-L %s" % self.label 373 label_str = "-L %s" % self.label
371 374
372 mkfs_cmd = "mkfs.%s -b %d %s %s %s" % \ 375 mkfs_cmd = "mkfs.%s -b %d %s -U %s %s %s" % \
373 (self.fstype, self.size * 1024, label_str, 376 (self.fstype, self.size * 1024, label_str, self.fsuuid,
374 self.mkfs_extraopts, rootfs) 377 self.mkfs_extraopts, rootfs)
375 exec_native_cmd(mkfs_cmd, native_sysroot) 378 exec_native_cmd(mkfs_cmd, native_sysroot)
376 379
@@ -391,8 +394,9 @@ class Partition():
391 394
392 extraopts = self.mkfs_extraopts or '-S 512' 395 extraopts = self.mkfs_extraopts or '-S 512'
393 396
394 dosfs_cmd = "mkdosfs %s %s %s -C %s %d" % \ 397 dosfs_cmd = "mkdosfs %s -i %s %s %s -C %s %d" % \
395 (label_str, extraopts, size_str, rootfs, blocks) 398 (label_str, self.fsuuid, extraopts, size_str, rootfs,
399 blocks)
396 400
397 exec_native_cmd(dosfs_cmd, native_sysroot) 401 exec_native_cmd(dosfs_cmd, native_sysroot)
398 402
@@ -410,9 +414,9 @@ class Partition():
410 with open(path, 'w') as sparse: 414 with open(path, 'w') as sparse:
411 os.ftruncate(sparse.fileno(), self.size * 1024) 415 os.ftruncate(sparse.fileno(), self.size * 1024)
412 416
413 import uuid
414 label_str = "" 417 label_str = ""
415 if self.label: 418 if self.label:
416 label_str = "-L %s" % self.label 419 label_str = "-L %s" % self.label
417 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path) 420
421 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, self.fsuuid, path)
418 exec_native_cmd(mkswap_cmd, native_sysroot) 422 exec_native_cmd(mkswap_cmd, native_sysroot)