[SeaBIOS] [PATCH] build: explicitly set rom size

2013-09-25 Thread Gerd Hoffmann
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 
---
 Makefile|  3 ++-
 scripts/checkrom.py | 21 +++--
 src/Kconfig | 11 +++
 3 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 229fe54..cdda3d5 100644
--- a/Makefile
+++ b/Makefile
@@ -178,7 +178,8 @@ $(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o 
scripts/checkrom.py
@echo "  Prepping $@"
$(Q)$(OBJDUMP) -thr $< > $<.objdump
$(Q)$(OBJCOPY) -O binary $< $(OUT)bios.bin.raw
-   $(Q)$(PYTHON) ./scripts/checkrom.py $<.objdump $(OUT)bios.bin.raw 
$(OUT)bios.bin
+   $(Q)$(PYTHON) ./scripts/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/scripts/checkrom.py b/scripts/checkrom.py
index 6f07ac8..aa3dd0d 100755
--- a/scripts/checkrom.py
+++ b/scripts/checkrom.py
@@ -21,7 +21,7 @@ def checksum(data, start, size, csum):
 
 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 @@ 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 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
diff --git a/src/Kconfig b/src/Kconfig
index c40cc61..00a6840 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -122,6 +122,17 @@ endchoice
 selected, the memory is instead allocated from the
 "9-segment" (0x9-0xa).
 
+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 256k. To make it fit
+it into 128k (which was big enougth for a long time) you'll
+probably have to disable some featues.
+
 endmenu
 
 menu "Hardware support"
-- 
1.8.3.1


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] build: explicitly set rom size

2013-09-24 Thread Fred .
Maybe QEMU live migration could be improved to handle ROM changing size?


On Tue, Sep 24, 2013 at 2:01 PM, Kevin O'Connor  wrote:

> On Tue, Sep 24, 2013 at 10:12:36AM +0200, Gerd Hoffmann wrote:
> > Replace the automatic rom sizing with an explicit kconfig option.
> > ROM changing size is a problem for qemu live migration, therefore
> > an explicit size is prefered.
> >
> > Make the default rom size 256k, with the recent xhci support merge
> > seabios doesn't fit into 128k any more.
>
> If you want to add a size override then that's fine, but I think the
> default should remain auto-sizing.
>
> -Kevin
>
> ___
> SeaBIOS mailing list
> SeaBIOS@seabios.org
> http://www.seabios.org/mailman/listinfo/seabios
>
___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios

Re: [SeaBIOS] [PATCH] build: explicitly set rom size

2013-09-24 Thread Kevin O'Connor
On Tue, Sep 24, 2013 at 10:12:36AM +0200, Gerd Hoffmann wrote:
> Replace the automatic rom sizing with an explicit kconfig option.
> ROM changing size is a problem for qemu live migration, therefore
> an explicit size is prefered.
> 
> Make the default rom size 256k, with the recent xhci support merge
> seabios doesn't fit into 128k any more.

If you want to add a size override then that's fine, but I think the
default should remain auto-sizing.

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


[SeaBIOS] [PATCH] build: explicitly set rom size

2013-09-24 Thread Gerd Hoffmann
Replace the automatic rom sizing with an explicit kconfig option.
ROM changing size is a problem for qemu live migration, therefore
an explicit size is prefered.

Make the default rom size 256k, with the recent xhci support merge
seabios doesn't fit into 128k any more.

Signed-off-by: Gerd Hoffmann 
---
 Makefile|  3 ++-
 scripts/checkrom.py | 15 +--
 src/Kconfig |  8 
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index e801720..c8bed85 100644
--- a/Makefile
+++ b/Makefile
@@ -178,7 +178,8 @@ $(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o 
scripts/checkrom.py
@echo "  Prepping $@"
$(Q)$(OBJDUMP) -thr $< > $<.objdump
$(Q)$(OBJCOPY) -O binary $< $(OUT)bios.bin.raw
-   $(Q)$(PYTHON) ./scripts/checkrom.py $<.objdump $(OUT)bios.bin.raw 
$(OUT)bios.bin
+   $(Q)$(PYTHON) ./scripts/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/scripts/checkrom.py b/scripts/checkrom.py
index 6f07ac8..0ef7299 100755
--- a/scripts/checkrom.py
+++ b/scripts/checkrom.py
@@ -21,7 +21,7 @@ def checksum(data, start, size, csum):
 
 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,14 @@ 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 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
diff --git a/src/Kconfig b/src/Kconfig
index c40cc61..dde9b7c 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -122,6 +122,14 @@ endchoice
 selected, the memory is instead allocated from the
 "9-segment" (0x9-0xa).
 
+config ROM_SIZE
+int "ROM size (in kB)"
+default 256
+help
+Set the rom size.  Currently SeaBIOS will easily fit into 256k.
+To make it fit it into 128k (which was big enougth for a long
+time) you'll probably have to disable some featues.
+
 endmenu
 
 menu "Hardware support"
-- 
1.8.3.1


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios