build: explicitly set ROM size

Add a config option to specify the rom size wanted.  Default is zero,
which will automatically figure the needed size.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
diff --git a/scripts/checkrom.py b/scripts/checkrom.py
index 6f07ac8..aa3dd0d 100755
--- a/scripts/checkrom.py
+++ b/scripts/checkrom.py
@@ -21,7 +21,7 @@
 
 def main():
     # Get args
-    objinfo, rawfile, outfile = sys.argv[1:]
+    objinfo, finalsize, rawfile, outfile = sys.argv[1:]
 
     # Read in symbols
     objinfofile = open(objinfo, 'rb')
@@ -32,11 +32,20 @@
     rawdata = f.read()
     f.close()
     datasize = len(rawdata)
-    finalsize = 64*1024
-    if datasize > 64*1024:
-        finalsize = 128*1024
-        if datasize > 128*1024:
-            finalsize = 256*1024
+    finalsize = int(finalsize) * 1024
+    if finalsize == 0:
+        finalsize = 64*1024
+        if datasize > 64*1024:
+            finalsize = 128*1024
+            if datasize > 128*1024:
+                finalsize = 256*1024
+    if datasize > finalsize:
+        print "Error!  ROM doesn't fit (%d > %d)" % (datasize, finalsize)
+        print "   You have to either increate the size (CONFIG_ROM_SIZE)"
+        print "   or turn off some features (such as hardware support not"
+        print "   needed) to make it fit.  Trying a more recent gcc version"
+        print "   might work too."
+        sys.exit(1)
 
     # Sanity checks
     start = symbols['code32flat_start'].offset