Generate and extract debug sysmbols for coreboot. *.debug files can be
[coreboot.git] / src / arch / i386 / Makefile.inc
index 5f8d110eb687a04ca7ff02293287f1f5538269c8..ba6489030f19f124d2e584c5cf439d6395925fa4 100644 (file)
@@ -1,3 +1,23 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2009-2010 coresystems GmbH
+## Copyright (C) 2009 Ronald G. Minnich
+##
+## 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
+##
+
 #######################################################################
 # Take care of subdirectories
 subdirs-y += boot
@@ -25,6 +45,9 @@ endif
 ifeq ($(CONFIG_AP_CODE_IN_CAR),y)
 COREBOOT_ROM_DEPENDENCIES+=$(obj)/coreboot_ap
 endif
+ifeq ($(CONFIG_GEODE_VSA_FILE),y)
+COREBOOT_ROM_DEPENDENCIES+=$(CONFIG_VSA_FILENAME)
+endif
 
 $(obj)/coreboot.rom: $(obj)/coreboot.pre $(obj)/coreboot_ram $(CBFSTOOL) $(call strip_quotes,$(COREBOOT_ROM_DEPENDENCIES))
        @printf "    CBFS       $(subst $(obj)/,,$(@))\n"
@@ -51,6 +74,12 @@ endif
 ifeq ($(CONFIG_BOOTSPLASH),y)
        @printf "    BOOTSPLASH $(CONFIG_FALLBACK_BOOTSPLASH_FILE)\n"
        $(CBFSTOOL) $@.tmp add $(CONFIG_FALLBACK_BOOTSPLASH_FILE) bootsplash.jpg bootsplash
+endif
+ifeq ($(CONFIG_GEODE_VSA_FILE),y)
+       @printf "    VSA        $(CONFIG_VSA_FILENAME)\n"
+       $(OBJCOPY) --set-start 0x20 --adjust-vma 0x60000 -I binary -O elf32-i386 -B i386 $(CONFIG_VSA_FILENAME) $(obj)/vsa.o
+       $(LD) -m elf_i386 -e 0x60020 --section-start .data=0x60000 $(obj)/vsa.o -o $(obj)/vsa.elf
+       $(CBFSTOOL) $@.tmp add-stage $(obj)/vsa.elf vsa
 endif
        mv $@.tmp $@
        @printf "    CBFSPRINT  $(subst $(obj)/,,$(@))\n\n"
@@ -78,6 +107,9 @@ $(obj)/coreboot_ram: $(obj)/coreboot_ram.o $(src)/arch/i386/coreboot_ram.ld #ldo
        @printf "    CC         $(subst $(obj)/,,$(@))\n"
        $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/i386/coreboot_ram.ld $(obj)/coreboot_ram.o
        $(NM) -n $(obj)/coreboot_ram | sort > $(obj)/coreboot_ram.map
+       $(OBJCOPY) --only-keep-debug $@ $(obj)/coreboot_ram.debug
+       $(OBJCOPY) --strip-debug $@
+       $(OBJCOPY) --add-gnu-debuglink=$(obj)/coreboot_ram.debug $@
 
 $(obj)/coreboot_ram.o: $(obj)/arch/i386/lib/c_start.o $$(drivers) $(obj)/coreboot.a $(LIBGCC_FILE_NAME)
        @printf "    CC         $(subst $(obj)/,,$(@))\n"
@@ -96,6 +128,9 @@ ifeq ($(CONFIG_AP_CODE_IN_CAR),y)
 $(obj)/coreboot_ap: $(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o
        @printf "    CC         $(subst $(obj)/,,$(@))\n"
        $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/i386/init/ldscript_apc.lb $^
+       $(OBJCOPY) --only-keep-debug $@ $(obj)/coreboot_ap.debug
+       $(OBJCOPY) --strip-debug $@
+       $(OBJCOPY) --add-gnu-debuglink=$(obj)/coreboot_ap.debug $@
        $(NM) -n $(obj)/coreboot_ap | sort > $(obj)/coreboot_ap.map
 
 
@@ -104,7 +139,7 @@ endif
 #######################################################################
 # done
 
-crt0s = $(src)/arch/i386/init/crt0_prologue.inc
+crt0s = $(src)/arch/i386/init/prologue.inc
 ldscripts =
 ldscripts += $(src)/arch/i386/init/ldscript_fallback_cbfs.lb
 ifeq ($(CONFIG_BIG_BOOTBLOCK),y)