summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2017-07-31 20:53:39 +1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-03 11:14:13 +0100
commit843a74d708a91b392f3293cf857495069bd14a13 (patch)
treeea14ca430048656347b91a321bdc0ee47d621aaf /scripts/lib/wic
parent7a25294b714a183ff18d1a95a0f8a8208ce51865 (diff)
downloadpoky-843a74d708a91b392f3293cf857495069bd14a13.tar.gz
wic: improve generating disk system identifier
This should reduce the chance of generating 0xffffffff as the disk system identifier. (From OE-Core rev: 5619e72facbc9228d3cf8f844f198e03b536ac8c) Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 51bdd3a984..5765bbb527 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -26,6 +26,7 @@
26 26
27import logging 27import logging
28import os 28import os
29import random
29import shutil 30import shutil
30import tempfile 31import tempfile
31import uuid 32import uuid
@@ -303,7 +304,7 @@ class PartitionedImage():
303 # all partitions (in bytes) 304 # all partitions (in bytes)
304 self.ptable_format = ptable_format # Partition table format 305 self.ptable_format = ptable_format # Partition table format
305 # Disk system identifier 306 # Disk system identifier
306 self.identifier = int.from_bytes(os.urandom(4), 'little') or 0xffffffff 307 self.identifier = random.SystemRandom().randint(1, 0xffffffff)
307 308
308 self.partitions = partitions 309 self.partitions = partitions
309 self.partimages = [] 310 self.partimages = []