aboutsummaryrefslogtreecommitdiffstats
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:04 +0100
commit5619e72facbc9228d3cf8f844f198e03b536ac8c (patch)
treed95dc973324f8c3b506f20b53cb04b43f95d6123
parent609f7f4ecd17c8299b97d9face098e3cc44fa6eb (diff)
downloadopenembedded-core-5619e72facbc9228d3cf8f844f198e03b536ac8c.tar.gz
openembedded-core-5619e72facbc9228d3cf8f844f198e03b536ac8c.tar.bz2
openembedded-core-5619e72facbc9228d3cf8f844f198e03b536ac8c.zip
wic: improve generating disk system identifier
This should reduce the chance of generating 0xffffffff as the disk system identifier. Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 @@
import logging
import os
+import random
import shutil
import tempfile
import uuid
@@ -303,7 +304,7 @@ class PartitionedImage():
# all partitions (in bytes)
self.ptable_format = ptable_format # Partition table format
# Disk system identifier
- self.identifier = int.from_bytes(os.urandom(4), 'little') or 0xffffffff
+ self.identifier = random.SystemRandom().randint(1, 0xffffffff)
self.partitions = partitions
self.partimages = []