2 # Script to check a bios image and report info on it.
4 # Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
6 # This file may be distributed under the terms of the GNU GPLv3 license.
11 # Read in symbols (that are valid)
13 for line in sys.stdin.readlines():
15 addr, type, sym = line.split()
16 syms[sym] = int(addr, 16)
20 c16e = syms['code16_end'] + 0xf0000
21 f16e = syms['final_code16_end']
23 print "Error! 16bit code moved during linking (0x%x vs 0x%x)" % (
27 sizefree = syms['freespace1_end'] - syms['freespace1_start']
28 size16 = syms['code16_end'] - syms['code16_start'] - sizefree
29 size32 = syms['code32_end'] - syms['code32_start']
30 totalc = size16+size32
31 print "16bit size: %d" % size16
32 print "32bit size: %d" % size32
33 print "Total size: %d Free space: %d Percent used: %.1f%%" % (
35 , (totalc / float(size16+size32+sizefree)) * 100.0)
37 if __name__ == '__main__':