diff options
| author | Jonathan Liu <net147@gmail.com> | 2017-07-31 20:53:39 +1000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-03 11:14:13 +0100 |
| commit | 843a74d708a91b392f3293cf857495069bd14a13 (patch) | |
| tree | ea14ca430048656347b91a321bdc0ee47d621aaf /scripts/lib/wic/plugins/imager/direct.py | |
| parent | 7a25294b714a183ff18d1a95a0f8a8208ce51865 (diff) | |
| download | poky-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/plugins/imager/direct.py')
| -rw-r--r-- | scripts/lib/wic/plugins/imager/direct.py | 3 |
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 | ||
| 27 | import logging | 27 | import logging |
| 28 | import os | 28 | import os |
| 29 | import random | ||
| 29 | import shutil | 30 | import shutil |
| 30 | import tempfile | 31 | import tempfile |
| 31 | import uuid | 32 | import 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 = [] |
