Patchwork boot-directdisk: ensure generated MBR disk signature is non-zero

login
register
mail settings
Submitter Jonathan Liu
Date Sept. 27, 2013, 1:30 a.m.
Message ID <1380245410-11696-1-git-send-email-net147@gmail.com>
Download mbox | patch
Permalink /patch/59057/
State Accepted
Commit df18dc084e071b83d49ee42e706f203296599432
Headers show

Comments

Jonathan Liu - Sept. 27, 2013, 1:30 a.m.
A zero MBR disk signature is generally seen as no signature and
another partitioning program might install a new signature.

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 meta/classes/boot-directdisk.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 4b9d7bd..8641e85 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -148,7 +148,11 @@  python do_bootdirectdisk() {
 def generate_disk_signature():
     import uuid
 
-    return str(uuid.uuid4())[:8]
+    while True:
+        signature = str(uuid.uuid4())[:8]
+
+        if signature != '00000000':
+            return signature
 
 def validate_disk_signature(d):
     import re