Drop unused and incorrect RTC_DEV for Winbond W83627EHG.
[coreboot.git] / src / arch / i386 / Makefile.inc
index 24fd02ababf6c6980ff7999ef8ca88e75a720d57..c0bc852dc0505809b740e5d5a3bf9162bc0cf881 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
@@ -5,7 +25,11 @@ subdirs-y += boot
 subdirs-y += lib
 subdirs-y += smp
 
-obj-$(CONFIG_HAVE_OPTION_TABLE) += ../../option_table.o
+OPTION_TABLE_H:=
+ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
+ramstage-srcs += $(obj)/option_table.c
+OPTION_TABLE_H:=$(obj)/option_table.h
+endif
 
 #######################################################################
 # Build the final rom image
@@ -25,8 +49,8 @@ endif
 ifeq ($(CONFIG_AP_CODE_IN_CAR),y)
 COREBOOT_ROM_DEPENDENCIES+=$(obj)/coreboot_ap
 endif
-ifeq ($(CONFIG_GEODE_VSA),y)
-COREBOOT_ROM_DEPENDENCIES+=$(CONFIG_VSA_FILE)
+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))
@@ -55,10 +79,10 @@ 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),y)
-       @printf "    VSA        $(CONFIG_VSA_FILE)\n"
-       $(OBJCOPY) --set-start 0x20 --adjust-vma 0x60000 -I binary -O elf32-i386 -B i386 $(CONFIG_VSA_FILE) $(obj)/vsa.o
-       $(LD) -e 0x60020 --section-start .data=0x60000 $(obj)/vsa.o -o $(obj)/vsa.elf
+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 $@
@@ -68,13 +92,13 @@ endif
 #######################################################################
 # i386 specific tools
 
-$(obj)/option_table.h: $(objutil)/options/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
+$(OPTION_TABLE_H): $(objutil)/options/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
        @printf "    OPTION     $(subst $(obj)/,,$(@))\n"
-       $(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --header $(obj)/option_table.h
+       $(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --header $@
 
 $(obj)/option_table.c: $(objutil)/options/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
        @printf "    OPTION     $(subst $(obj)/,,$(@))\n"
-       $(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --option $(obj)/option_table.c
+       $(objutil)/options/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --option $@
 
 $(objutil)/options/build_opt_tbl: $(top)/util/options/build_opt_tbl.c $(top)/src/include/pc80/mc146818rtc.h $(top)/src/include/boot/coreboot_tables.h
        @printf "    HOSTCC     $(subst $(obj)/,,$(@))\n"
@@ -87,12 +111,15 @@ $(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)
+$(obj)/coreboot_ram.o: $(obj)/arch/i386/lib/c_start.ramstage.o $$(driver-objs) $(obj)/coreboot.a $(LIBGCC_FILE_NAME)
        @printf "    CC         $(subst $(obj)/,,$(@))\n"
-       $(CC) -nostdlib -r -o $@ $(obj)/arch/i386/lib/c_start.o $(drivers) -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(obj)/coreboot.a $(LIBGCC_FILE_NAME) -Wl,--end-group
+       $(CC) -nostdlib -r -o $@ $(obj)/arch/i386/lib/c_start.ramstage.o $(driver-objs) -Wl,--wrap,__divdi3 -Wl,--wrap,__udivdi3 -Wl,--wrap,__moddi3 -Wl,--wrap,__umoddi3 -Wl,--start-group $(obj)/coreboot.a $(LIBGCC_FILE_NAME) -Wl,--end-group
 
-$(obj)/coreboot.a: $$(objs)
+$(obj)/coreboot.a: $$(ramstage-objs)
        @printf "    AR         $(subst $(obj)/,,$(@))\n"
        rm -f $(obj)/coreboot.a
        $(AR) cr $(obj)/coreboot.a $^
@@ -105,6 +132,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
 
 
@@ -113,7 +143,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)
@@ -165,11 +195,6 @@ ifeq ($(CONFIG_ROMCC),y)
 crt0s += $(src)/arch/i386/init/crt0_romcc_epilogue.inc
 endif
 
-OPTION_TABLE_H:=
-ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
-OPTION_TABLE_H:=$(obj)/option_table.h
-endif
-
 ifeq ($(CONFIG_ROMCC),y)
 ROMCCFLAGS ?= -mcpu=p2 -O2
 
@@ -180,11 +205,11 @@ else
 
 $(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o: $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c $(OPTION_TABLE_H)
        @printf "    CC         $(subst $(obj)/,,$(@))\n"
-       $(CC) -MMD $(CFLAGS) -I$(src) -I. -c $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c -o $@
+       $(CC) -MMD $(CFLAGS) -I$(src) -I. -I$(obj) -c $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c -o $@
 
 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h
        @printf "    CC         romstage.inc\n"
-       $(CC) -MMD $(CFLAGS) -D__PRE_RAM__ -I$(src) -I. -c -S $< -o $@
+       $(CC) -MMD $(CFLAGS) -D__PRE_RAM__ -I$(src) -I. -I$(obj) -c -S $< -o $@
 
 $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/romstage.pre.inc
        @printf "    POST       romstage.inc\n"
@@ -193,36 +218,36 @@ $(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(obj)/mainboard/$(MAINBOARDDIR)/
 endif
 
 # Things that appear in every board
-initobjs += $(obj)/mainboard/$(MAINBOARDDIR)/crt0.o
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/mainboard.o
+romstage-srcs += $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c
 ifeq ($(CONFIG_GENERATE_MP_TABLE),y)
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/mptable.o
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mptable.c
 endif
 ifeq ($(CONFIG_GENERATE_PIRQ_TABLE),y)
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/irq_tables.o
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/irq_tables.c
 endif
 ifeq ($(CONFIG_BOARD_HAS_HARD_RESET),y)
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/reset.o
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/reset.c
 endif
 ifeq ($(CONFIG_GENERATE_ACPI_TABLES),y)
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/acpi_tables.o
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/dsdt.o
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/dsdt.asl
 # make doesn't have arithmetic operators or greater-than comparisons
 ifeq ($(subst 5,4,$(CONFIG_ACPI_SSDTX_NUM)),4)
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/ssdt2.o
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/ssdt3.o
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/ssdt4.o
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt2.asl
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt3.asl
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt4.asl
 endif
 ifeq ($(CONFIG_ACPI_SSDTX_NUM),5)
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/ssdt5.o
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/ssdt5.asl
 endif
 ifeq ($(CONFIG_BOARD_HAS_FADT),y)
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/fadt.o
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/fadt.c
 endif
 endif
 
 ifeq ($(CONFIG_HAVE_BUS_CONFIG),y)
-objs += $(obj)/mainboard/$(MAINBOARDDIR)/get_bus_conf.o
+ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/get_bus_conf.c
 endif
 
 ifeq ($(CONFIG_TINY_BOOTBLOCK),y)