Comments
Patch
===================================================================
@@ -0,0 +1,55 @@
+#!/usr/bin/perl -w
+use strict;
+#
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2009 Maciej Pijanka <maciej.pijanka@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+use warnings;
+
+
+my $file = shift @ARGV || die "Give me an elf file name";
+
+die "No such file: $!" unless (-e $file);
+
+my $GAP = 0;
+
+my $SIZE = 0;
+
+open IN,'readelf -W -S '.$file.'|';
+while (not eof IN) {
+ my $line = <IN>;
+ chomp $line;
+
+ next unless ($line =~ /^ *\[ *[0-9]+\] ([\.a-z]+) *[A-Z]+ *([0-9a-f]+) ([0-9a-f]+) ([0-9a-f]+) [0-9a-f]{2} /);
+
+ my ($name, $start, $off, $len) = ($1, hex $2, hex $3, hex $4);
+
+ next unless ($name eq '.rom' or $name eq '.text' or $name eq '.id');
+
+ if (($start & 0x0F) != 0) {
+ my $shift = $start & 0x0F;
+ printf STDERR "Section %s aligned to 16byte boundary (%d bytes added)\n", $name, $shift;
+ $len += $shift;
+ $start -= $shift;
+ }
+
+ #printf "%s %x %x %x\n", $name, $start, $off, $len;
+ $SIZE += $len;
+}
+close IN;
+
+printf "CONFIG_GAPSIZE = 0x%x;\n", 0x0000fff0 - $SIZE;
Property changes on: util/compute_gapsize
___________________________________________________________________
Added: svn:executable
+ *
===================================================================
@@ -38,7 +38,7 @@
/* cut _start into last 64k*/
_x = .;
- . = (_x < (CONFIG_ROMBASE - 0x10000 + CONFIG_ROM_IMAGE_SIZE)) ? (CONFIG_ROMBASE - 0x10000 + CONFIG_ROM_IMAGE_SIZE) : _x;
+ . = ((_x < (CONFIG_ROMBASE - 0x10000 + CONFIG_ROM_IMAGE_SIZE)) ? (CONFIG_ROMBASE - 0x10000 + CONFIG_ROM_IMAGE_SIZE) : _x) + CONFIG_GAPSIZE;
/* This section might be better named .setup */
.rom . : {
===================================================================
@@ -43,6 +43,7 @@
$(obj)/ldscript.ld: $(ldscripts) $(obj)/ldoptions
printf 'INCLUDE "ldoptions"\n' > $@
+ printf 'INCLUDE "ldgap"\n' >> $@
printf '$(foreach ldscript,$(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@
$(obj)/crt0_includes.h: $(crt0s)
@@ -56,7 +57,10 @@
$(obj)/coreboot: $(initobjs) $(obj)/ldscript.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
+ printf 'CONFIG_GAPSIZE = 0;\n' > $(obj)/ldgap
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(obj)/ldscript.ld $(initobjs)
+ ./util/compute_gapsize $@ > $(obj)/ldgap
+ $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(obj)/ldscript.ld $(initobjs)
$(NM) -n $(obj)/coreboot | sort > $(obj)/coreboot.map
#######################################################################