]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: ensure generated disk system identifier is non-zero
authorJonathan Liu <net147@gmail.com>
Fri, 28 Jul 2017 14:45:27 +0000 (00:45 +1000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 30 Jul 2017 07:45:13 +0000 (08:45 +0100)
Zero may be interpreted as no MBR signature present and another
partitioning program might install a new MBR signature.

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/plugins/imager/direct.py

index 0a65a9c58d696cd14ba6202af3363d0e2b122729..51bdd3a9849e83106d572569c25716953ebd25d6 100644 (file)
@@ -303,7 +303,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')
+        self.identifier = int.from_bytes(os.urandom(4), 'little') or 0xffffffff
 
         self.partitions = partitions
         self.partimages = []