[SeaBIOS] [PATCH RFC 4/7] buildrom.py: Handle PCI header checksum

Julian Pidancet julian.pidancet at gmail.com
Fri Dec 16 15:15:10 CET 2011


This patch makes buildrom.py check if a PCI is present in the ROM,
and fills in the image size field.

Signed-off-by: Julian Pidancet <julian.pidancet at gmail.com>
---
 tools/buildrom.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tools/buildrom.py b/tools/buildrom.py
index 19b715a..7ed8107 100755
--- a/tools/buildrom.py
+++ b/tools/buildrom.py
@@ -28,6 +28,11 @@ def main():
     data += "\0" * (alignpos(count, 512) - count)
     count = len(data)
 
+    # Check if a pci header is present
+    pcidata = ord(data[24:25]) + (ord(data[25:26]) << 8)
+    if pcidata != 0:
+        data = data[:pcidata + 16] + chr(count/512) + chr(0) + data[pcidata + 18:]
+
     # Fill in size field; clear checksum field
     data = data[:2] + chr(count/512) + data[3:6] + "\0" + data[7:]
 
-- 
Julian Pidancet




More information about the SeaBIOS mailing list