From 3f2546b2ef55b661fd8dd69682b38992225e86f6 Mon Sep 17 00:00:00 2001 From: fishsoupisgood Date: Mon, 29 Apr 2019 01:17:54 +0100 Subject: Initial import of qemu-2.4.1 --- roms/seabios/scripts/buildrom.py | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 roms/seabios/scripts/buildrom.py (limited to 'roms/seabios/scripts/buildrom.py') diff --git a/roms/seabios/scripts/buildrom.py b/roms/seabios/scripts/buildrom.py new file mode 100755 index 00000000..0499049c --- /dev/null +++ b/roms/seabios/scripts/buildrom.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# Fill in checksum/size of an option rom, and pad it to proper length. +# +# Copyright (C) 2009 Kevin O'Connor +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +import sys, struct + +from python23compat import as_bytes + +def alignpos(pos, alignbytes): + mask = alignbytes - 1 + return (pos + mask) & ~mask + +def checksum(data): + if (sys.version_info > (3, 0)): + cksum = sum(data) + else: + cksum = sum(map(ord, data)) + return struct.pack('