Use ld to build final rom; remove custom build utilities.
[seabios.git] / tools / checkrom.py
1 #!/usr/bin/env python
2 # Script to check a bios image and report info on it.
3 #
4 # Copyright (C) 2008  Kevin O'Connor <kevin@koconnor.net>
5 #
6 # This file may be distributed under the terms of the GNU GPLv3 license.
7
8 import sys
9
10 def main():
11     # Read in symbols (that are valid)
12     syms = {}
13     for line in sys.stdin.readlines():
14         try:
15             addr, type, sym = line.split()
16             syms[sym] = int(addr, 16)
17         except:
18             pass
19
20     if syms['code16_start'] != syms['_code32_code16_start']:
21         print "Error!  16bit code moved during linking"
22         sys.exit(1)
23
24     size16 = syms['code16_end'] - syms['code16_start']
25     size32 = syms['code32_end'] - syms['code32_start']
26     sizefree = syms['freespace1_end'] - syms['freespace1_start']
27     print "16bit C-code size: %d" % size16
28     print "32bit C-code size: %d" % size32
29     print "Total C-code size: %d" % (size16+size32)
30     print "Free C-code space: %d" % sizefree
31
32 if __name__ == '__main__':
33     main()