[coreboot-gerrit] Patch set updated for coreboot: x86: link ramstage the same way regardless of RELOCATABLE_RAMSTAGE

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Sun Sep 6 17:41:35 CET 2015


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11524

-gerrit

commit 8caecddd634b185ac2aa83f1eb0f5cc9d2287a71
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Sun Sep 6 10:45:18 2015 -0500

    x86: link ramstage the same way regardless of RELOCATABLE_RAMSTAGE
    
    Previously there were 2 paths in linking ramstage. One was used for
    RELOCATABLE_RAMSTAGE while the other was fixed location. Now that
    rmodtool can handle multiple secitons for a single proram segment
    there's no need for linking ramstage using lib/rmodule.ld.  That
    also means true rmodules don't have symbols required for ramstage
    purposes so fix memlayout.h. Lastly add default rules for creating
    rmod files from the known file names and locations.
    
    BUG=chrome-os-partner:44827
    BRANCH=None
    TEST=Built rambi. Inspected ramstage.debug as well as rmodules
         created during the build.
    
    Change-Id: I98d249036c27cb4847512ab8bca5ea7b02ce04bd
    Signed-off-by: Aaron Durbin <adubin at chromium.org>
---
 src/arch/x86/Makefile.inc | 10 +---------
 src/include/memlayout.h   |  6 +++---
 src/lib/Makefile.inc      |  9 ++++++---
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index b018f7c..885bb7f 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -276,17 +276,11 @@ ramstage-libs ?=
 
 ifeq ($(CONFIG_RELOCATABLE_RAMSTAGE),y)
 
-ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
-$(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_32))
-else
-$(eval $(call rmodule_link,$(objcbfs)/ramstage.debug, $(objgenerated)/ramstage.o, $(CONFIG_HEAP_SIZE),x86_64))
-endif
-
 # The rmodule_link defintion creates an elf file with .rmod extension.
 $(objcbfs)/ramstage.elf: $(objcbfs)/ramstage.debug.rmod
 	cp $< $@
 
-else
+endif
 
 ramstage-y += memlayout.ld
 
@@ -294,8 +288,6 @@ $(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(obj)/arch/x86/memlayout.
 	@printf "    CC         $(subst $(obj)/,,$(@))\n"
 	$(LD_ramstage) $(CPPFLAGS) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(obj)/arch/x86/memlayout.ramstage.ld
 
-endif
-
 $(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs)
 	@printf "    CC         $(subst $(obj)/,,$(@))\n"
 ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
diff --git a/src/include/memlayout.h b/src/include/memlayout.h
index ef47f6b..82fa73e 100644
--- a/src/include/memlayout.h
+++ b/src/include/memlayout.h
@@ -166,7 +166,7 @@
 	REGION(watchdog_tombstone, addr, size, 4) \
 	_ = ASSERT(size == 4, "watchdog tombstones should be exactly 4 byte!");
 
-#if ENV_RAMSTAGE || ENV_ROMSTAGE || ENV_RMODULE
+#if ENV_RAMSTAGE || ENV_ROMSTAGE
 #define CBMEM_INIT_HOOKS \
 	POINTER_ALIGN \
 	SYMBOL_CURRENT_LOC(cbmem_init_hooks) \
@@ -176,7 +176,7 @@
 #define CBMEM_INIT_HOOKS
 #endif
 
-#if ENV_RAMSTAGE || ENV_RMODULE
+#if ENV_RAMSTAGE
 #define DRIVERS_RODATA \
 	POINTER_ALIGN \
 	SYMBOL_CURRENT_LOC(pci_drivers) \
@@ -206,7 +206,7 @@
 #define  DATA_EXTRA \
 	PROVIDE(_preram_cbmem_console = .); \
 	PROVIDE(_epreram_cbmem_console = _preram_cbmem_console);
-#elif ENV_RAMSTAGE || ENV_RMODULE
+#elif ENV_RAMSTAGE
 #define DATA_EXTRA \
 	SYMBOL_CURRENT_LOC(bs_init_begin) \
 	KEEP(*(.bs_init)); \
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index a89f7d4..f4d8c2c 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -218,9 +218,12 @@ define rmodule_link
 $(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(obj)/lib/rmodule.rmodules_$(4).ld | $$(RMODTOOL)
 	$$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(obj)/lib/rmodule.rmodules_$(4).ld --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group
 	$$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
-
-$(strip $(1)).rmod: $(strip $(1))
-	$$(RMODTOOL) -i $$^ -o $$@
 endef
 
 endif
+
+$(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL)
+	$(RMODTOOL) -i $< -o $@
+
+$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL)
+	$(RMODTOOL) -i $< -o $@



More information about the coreboot-gerrit mailing list