# Independent GPT validator (does not share code with gptedit.py) import struct, zlib, sys DISK_SECTORS = 7634944 def check(prim_path, back_path): P = open(prim_path, "rb").read(); B = open(back_path, "rb").read() ok = True def fail(m): nonlocal ok; ok = False; print(" FAIL:", m) def hdr(buf, label, expect_my, expect_alt): h = buf sig, rev, hsz, hcrc, _, my, alt, fu, lu = struct.unpack("<8sIII4sQQQQ", h[:56]) guid = h[56:72]; ent_lba, n, esz, ecrc = struct.unpack(" %s" % (prim_path, len(parts), hp["fu"], hp["lu"], "OK" if ok else "INVALID")) return ok for p, b in (("../gpt/gpt-primary-34sectors.bin", "../gpt/gpt-backup-33sectors.bin"), ("aurora-new-gpt-primary-34sectors.bin", "aurora-new-gpt-backup-33sectors.bin")): check(p, b)