diff -u src/cpu/x86/smm/Makefile.inc src/cpu/x86/smm/Makefile.inc --- src/cpu/x86/smm/Makefile.inc (Arbeitskopie) +++ src/cpu/x86/smm/Makefile.inc (Arbeitskopie) @@ -36,5 +36,5 @@ # ELF symbol names. -$(obj)/cpu/x86/smm/smm_wrap.o: $(obj)/cpu/x86/smm/smm +$(obj)/cpu/x86/smm/smm_wrap.ramstage.o: $(obj)/cpu/x86/smm/smm @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" - cd $(obj)/cpu/x86/smm; $(OBJCOPY) -I binary smm -O elf32-i386 -B i386 smm_wrap.o + cd $(obj)/cpu/x86/smm; $(OBJCOPY) -I binary smm -O elf32-i386 -B i386 smm_wrap.ramstage.o diff -u src/console/Makefile.inc src/console/Makefile.inc --- src/console/Makefile.inc (Arbeitskopie) +++ src/console/Makefile.inc (Arbeitskopie) @@ -19,3 +19,3 @@ -$(obj)/console/console.o : $(obj)/build.h +$(obj)/console/console.ramstage.o : $(obj)/build.h $(obj)/console/console.romstage.o : $(obj)/build.h diff -u src/lib/Makefile.inc src/lib/Makefile.inc --- src/lib/Makefile.inc (Arbeitskopie) +++ src/lib/Makefile.inc (Arbeitskopie) @@ -37 +37 @@ -$(obj)/lib/version.o : $(obj)/build.h +$(obj)/lib/version.ramstage.o : $(obj)/build.h diff -u src/pc80/Makefile.inc src/pc80/Makefile.inc --- src/pc80/Makefile.inc (Arbeitskopie) +++ src/pc80/Makefile.inc (Arbeitskopie) @@ -5,7 +5,8 @@ ramstage-y += keyboard.o + romstage-$(CONFIG_USE_OPTION_TABLE) += mc146818rtc_early.o romstage-$(CONFIG_CACHE_AS_RAM) += serial.o subdirs-y += vga -$(obj)/pc80/mc146818rtc.o : $(OPTION_TABLE_H) +$(obj)/pc80/mc146818rtc.ramstage.o : $(OPTION_TABLE_H) $(obj)/pc80/mc146818rtc_early.romstage.o : $(OPTION_TABLE_H) diff -u src/arch/i386/boot/Makefile.inc src/arch/i386/boot/Makefile.inc --- src/arch/i386/boot/Makefile.inc (Arbeitskopie) +++ src/arch/i386/boot/Makefile.inc (Arbeitskopie) @@ -11,3 +11,3 @@ -$(obj)/arch/i386/boot/coreboot_table.o : $(OPTION_TABLE_H) +$(obj)/arch/i386/boot/coreboot_table.ramstage.o : $(OPTION_TABLE_H) diff -u src/arch/i386/Makefile.inc src/arch/i386/Makefile.inc --- src/arch/i386/Makefile.inc (Arbeitskopie) +++ src/arch/i386/Makefile.inc (Arbeitskopie) @@ -111,9 +111,9 @@ $(OBJCOPY) --strip-debug $@ $(OBJCOPY) --add-gnu-debuglink=$(obj)/coreboot_ram.debug $@ -$(obj)/coreboot_ram.o: $(obj)/arch/i386/lib/c_start.o $$(driver-objs) $(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 $(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 + $(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: $$(ramstage-objs) @printf " AR $(subst $(obj)/,,$(@))\n" diff -u src/arch/i386/lib/Makefile.inc src/arch/i386/lib/Makefile.inc --- src/arch/i386/lib/Makefile.inc (Arbeitskopie) +++ src/arch/i386/lib/Makefile.inc (Arbeitskopie) @@ -13 +13 @@ -$(obj)/arch/i386/lib/console.o :: $(obj)/build.h +$(obj)/arch/i386/lib/console.ramstage.o :: $(obj)/build.h diff -u Makefile Makefile --- Makefile (Arbeitskopie) +++ Makefile (Arbeitskopie) @@ -173,7 +173,7 @@ @printf " HOSTCC $(subst $(objutil)/,,$(@))\n" $(HOSTCC) -MMD -I$(subst $(objutil)/,util/,$(dir $<)) -I$(dir $<) $(HOSTCFLAGS) -c -o $@ $< -$(obj)/%.o: $(obj)/%.c $(obj)/config.h +$(obj)/%.ramstage.o: $(obj)/%.c $(obj)/config.h @printf " CC $(subst $(obj)/,,$(@))\n" $(CC) -MMD $(CFLAGS) -c -o $@ $< @@ -211,6 +211,7 @@ subdirs:=$(PLATFORM-y) $(BUILD-y) $(eval $(call evaluate_subdirs)) +ramstage-objs:=$(addsuffix .ramstage.o, $(basename $(ramstage-objs))) romstage-objs:=$(addsuffix .romstage.o, $(basename $(romstage-objs))) driver-objs:=$(addsuffix .driver.o, $(basename $(driver-objs))) smm-objs:=$(addsuffix .smm.o, $(basename $(smm-objs))) @@ -221,40 +222,38 @@ allsrc=$(wildcard $(call source_with_ext,c) $(call source_with_ext,S)) define ramstage-objs_asl_template -$(obj)/$(1)%.o: src/$(1)%.asl +$(obj)/$(1)%.ramstage.o: src/$(1)%.asl @printf " IASL $$(subst $(top)/,,$$(@))\n" $(CPP) -D__ACPI__ -P -include $(abspath $(obj)/config.h) -I$(src) -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$(basename $$@).asl - iasl -p $$(basename $$@) -tc $$(basename $$@).asl - mv $$(basename $$@).hex $$(basename $$@).c - $(CC) $$(CFLAGS) $$(if $$(subst dsdt,,$$(basename $$(notdir $$@))), -DAmlCode=AmlCode_$$(basename $$(notdir $$@))) -c -o $$@ $$(basename $$@).c + iasl -p $$(obj)/$(1) -tc $$(basename $$@).asl + mv $$(obj)/$(1).hex $$(basename $$@).c + $(CC) $$(CFLAGS) $$(if $$(subst dsdt,,$$(basename $$(notdir $(1)))), -DAmlCode=AmlCode_$$(basename $$(notdir $(1)))) -c -o $$@ $$(basename $$@).c # keep %.o: %.c rule from catching the temporary .c file after a make clean mv $$(basename $$@).c $$(basename $$@).hex endef # macro to define template macros that are used by use_template macro define create_cc_template -# $1 obj class (objs, initobjs, ...) +# $1 obj class (ramstage, romstage, driver, smm) # $2 source suffix (c, S) -# $3 .o infix ("" ".initobj", ...) -# $4 additional compiler flags -de$(EMPTY)fine $(1)_$(2)_template -$(obj)/$$(1)%$(3).o: src/$$(1)%.$(2) $(obj)/config.h +# $3 additional compiler flags +de$(EMPTY)fine $(1)-objs_$(2)_template +$(obj)/$$(1)%.$(1).o: src/$$(1)%.$(2) $(obj)/config.h @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" - $(CC) $(4) -MMD $$$$(CFLAGS) -c -o $$$$@ $$$$< + $(CC) $(3) -MMD $$$$(CFLAGS) -c -o $$$$@ $$$$< en$(EMPTY)def endef -$(eval $(call create_cc_template,ramstage-objs,c)) -$(eval $(call create_cc_template,ramstage-objs,S,,-DASSEMBLY)) -$(eval $(call create_cc_template,romstage-objs,c,.romstage,-D__PRE_RAM__)) -$(eval $(call create_cc_template,romstage-objs,S,.romstage,-DASSEMBLY -D__PRE_RAM__)) -$(eval $(call create_cc_template,driver-objs,c,.driver)) -$(eval $(call create_cc_template,driver-objs,S,.driver,-DASSEMBLY)) -$(eval $(call create_cc_template,smm-objs,c,.smm)) -$(eval $(call create_cc_template,smm-objs,S,.smm)) +$(eval $(call create_cc_template,ramstage,c)) +$(eval $(call create_cc_template,ramstage,S,-DASSEMBLY)) +$(eval $(call create_cc_template,romstage,c,-D__PRE_RAM__)) +$(eval $(call create_cc_template,romstage,S,-DASSEMBLY -D__PRE_RAM__)) +$(eval $(call create_cc_template,driver,c)) +$(eval $(call create_cc_template,driver,S,-DASSEMBLY)) +$(eval $(call create_cc_template,smm,c)) +$(eval $(call create_cc_template,smm,S)) usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d))))) -usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d))))) $(eval $(call usetemplate,ramstage-objs,asl)) $(eval $(call usetemplate,ramstage-objs,c)) $(eval $(call usetemplate,ramstage-objs,S))