mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 05:29:32 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
7a25294b71
commit
843a74d708
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user