From f1afa918b6f5d3069cc8c772b4cca254d21cba6b Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 9 Dec 2013 09:14:24 +0100
Subject: [PATCH 1/2] build: explicitly set ROM size
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1386580465-6692-2-git-send-email-kraxel@redhat.com>
Patchwork-id: 56028
O-Subject: [RHEL-7 seabios PATCH 1/2] build: explicitly set ROM size
Bugzilla: 1038604
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
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>
(cherry picked from commit 85f8fac87526341d775b02a0bfbc29d97f3ba22a)
Conflicts:
Makefile
---
Makefile | 3 ++-
src/Kconfig | 11 +++++++++++
tools/checkrom.py | 21 +++++++++++++++------
3 files changed, 28 insertions(+), 7 deletions(-)
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
Makefile | 3 ++-
src/Kconfig | 11 +++++++++++
tools/checkrom.py | 21 +++++++++++++++------
3 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 409aefa..b82bd58 100644
--- a/Makefile
+++ b/Makefile
@@ -167,7 +167,8 @@ $(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o tools/checkrom.py
@echo " Prepping $@"
$(Q)$(OBJDUMP) -thr $< > $<.objdump
$(Q)$(OBJCOPY) -O binary $< $(OUT)bios.bin.raw
- $(Q)$(PYTHON) ./tools/checkrom.py $<.objdump $(OUT)bios.bin.raw $(OUT)bios.bin
+ $(Q)$(PYTHON) ./tools/checkrom.py $<.objdump $(CONFIG_ROM_SIZE) \
+ $(OUT)bios.bin.raw $(OUT)bios.bin
$(Q)$(STRIP) -R .comment $< -o $(OUT)bios.bin.elf
diff --git a/src/Kconfig b/src/Kconfig
index d00c66c..f5dce60 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -90,6 +90,17 @@ endchoice
help
Support floppy images in coreboot flash.
+ config ROM_SIZE
+ int "ROM size (in KB)"
+ default 0
+ help
+ Set the ROM size. Say '0' here to make seabios figure the
+ needed size automatically.
+
+ Currently SeaBIOS will easily fit into 256 KB. To make it fit
+ it into 128 KB (which was big enough for a long time) you'll
+ probably have to disable some featues such as xhci support.
+
endmenu
menu "Hardware support"
diff --git a/tools/checkrom.py b/tools/checkrom.py
index 69d65e8..b997e8c 100755
--- a/tools/checkrom.py
+++ b/tools/checkrom.py
@@ -10,7 +10,7 @@ import layoutrom
def main():
# Get args
- objinfo, rawfile, outfile = sys.argv[1:]
+ objinfo, finalsize, rawfile, outfile = sys.argv[1:]
# Read in symbols
objinfofile = open(objinfo, 'rb')
@@ -21,11 +21,20 @@ def main():
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 increase 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
--
1.7.1