aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2016-05-11 22:06:46 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2016-05-23 16:53:45 +0200
commitfd28938b7adb33f8af11849cdd0d0b2fb92990e3 (patch)
tree95b722a9e423f9e9695428e8848e338cf229033e
parent6f71b779c8b05cf60ea0fffbcd8c02adfe845ece (diff)
scripts/signrom.py: Check for magic in option ROMs.
Because of the risk that compilers might not emit the asm() block at the beginning of the option ROM, check that the ROM contains the required magic signature. Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Message-Id: <1463000807-18015-3-git-send-email-rjones@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--scripts/signrom.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/signrom.py b/scripts/signrom.py
index 6c8b9bf406..5629bca222 100644
--- a/scripts/signrom.py
+++ b/scripts/signrom.py
@@ -17,7 +17,10 @@ if len(sys.argv) < 3:
fin = open(sys.argv[1], 'rb')
fout = open(sys.argv[2], 'wb')
-fin.seek(2)
+magic = fin.read(2)
+if magic != '\x55\xaa':
+ sys.exit("%s: option ROM does not begin with magic 55 aa" % sys.argv[1])
+
size_byte = ord(fin.read(1))
fin.seek(0)