vboot: split class in library and stage
The build system includes a bunch of files into verstage that
also exist in romstage - generic drivers etc.
These create link time conflicts when trying to link both the
verstage copy and romstage copy together in a combined configuration,
so separate "stage" parts (that allow things to run) from "library" parts
(that contain the vboot specifics).
Change-Id: Ieed910fcd642693e5e89e55f3e6801887d94462f
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/10041
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
diff --git a/src/arch/arm/Makefile.inc b/src/arch/arm/Makefile.inc
index afb8d20..c05b33e 100644
--- a/src/arch/arm/Makefile.inc
+++ b/src/arch/arm/Makefile.inc
@@ -73,9 +73,9 @@
ifeq ($(CONFIG_ARCH_VERSTAGE_ARM),y)
-$(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld
+$(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $$(verstage-objs) $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
- $(LD_verstage) --gc-sections -static -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld --start-group $(objgenerated)/libverstage.a --end-group
+ $(LD_verstage) --gc-sections -static -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld --start-group $(objgenerated)/libverstage.a $$(verstage-objs) --end-group
verstage-y += div0.c
verstage-y += eabi_compat.c
diff --git a/src/arch/arm/armv4/Makefile.inc b/src/arch/arm/armv4/Makefile.inc
index 5f12a6a..6b01056 100644
--- a/src/arch/arm/armv4/Makefile.inc
+++ b/src/arch/arm/armv4/Makefile.inc
@@ -45,6 +45,8 @@
################################################################################
ifeq ($(CONFIG_ARCH_VERSTAGE_ARMV4),y)
+libverstage-c-ccopts += $(armv4_flags)
+libverstage-S-ccopts += $(armv4_flags)
verstage-c-ccopts += $(armv4_flags)
verstage-S-ccopts += $(armv4_flags)
diff --git a/src/arch/arm/armv7/Makefile.inc b/src/arch/arm/armv7/Makefile.inc
index e9daf11..3a71d98 100644
--- a/src/arch/arm/armv7/Makefile.inc
+++ b/src/arch/arm/armv7/Makefile.inc
@@ -66,6 +66,8 @@
################################################################################
ifeq ($(CONFIG_ARCH_VERSTAGE_ARMV7),y)
+libverstage-c-ccopts += $(armv7-a_flags)
+libverstage-S-ccopts += $(armv7-a_asm_flags)
verstage-c-ccopts += $(armv7-a_flags)
verstage-S-ccopts += $(armv7-a_asm_flags)
@@ -76,6 +78,8 @@
verstage-y += mmu.c
else ifeq ($(CONFIG_ARCH_VERSTAGE_ARMV7_M),y)
+libverstage-c-ccopts += $(armv7-m_flags)
+libverstage-S-ccopts += $(armv7-m_asm_flags)
verstage-c-ccopts += $(armv7-m_flags)
verstage-S-ccopts += $(armv7-m_asm_flags)
diff --git a/src/arch/arm64/Makefile.inc b/src/arch/arm64/Makefile.inc
index adaba8e..3791ae7 100644
--- a/src/arch/arm64/Makefile.inc
+++ b/src/arch/arm64/Makefile.inc
@@ -84,9 +84,9 @@
ifeq ($(CONFIG_ARCH_VERSTAGE_ARM64),y)
-$(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld $(obj)/config.h
+$(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $$(verstage-objs) $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld $(obj)/config.h
@printf " LINK $(subst $(obj)/,,$(@))\n"
- $(LD_verstage) --gc-sections -static -o $@ -L$(obj) --start-group $(objgenerated)/libverstage.a --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld
+ $(LD_verstage) --gc-sections -static -o $@ -L$(obj) --start-group $(objgenerated)/libverstage.a $$(verstage-objs)--end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld
verstage-$(CONFIG_EARLY_CONSOLE) += early_console.c
verstage-y += div0.c
diff --git a/src/arch/arm64/armv8/Makefile.inc b/src/arch/arm64/armv8/Makefile.inc
index d043921..19684b2 100644
--- a/src/arch/arm64/armv8/Makefile.inc
+++ b/src/arch/arm64/armv8/Makefile.inc
@@ -56,6 +56,8 @@
verstage-y += cache_helpers.S
verstage-y += exception.c
+libverstage-c-ccopts += $(armv8_flags)
+libverstage-S-ccopts += $(armv8_asm_flags)
verstage-c-ccopts += $(armv8_flags)
verstage-S-ccopts += $(armv8_asm_flags)
diff --git a/src/drivers/i2c/ww_ring/Makefile.inc b/src/drivers/i2c/ww_ring/Makefile.inc
index 56de190..eabd3bf 100644
--- a/src/drivers/i2c/ww_ring/Makefile.inc
+++ b/src/drivers/i2c/ww_ring/Makefile.inc
@@ -1,2 +1,2 @@
-verstage-$(CONFIG_DRIVERS_I2C_WW_RING) += ww_ring.c
-verstage-$(CONFIG_DRIVERS_I2C_WW_RING) += ww_ring_programs.c
+libverstage-$(CONFIG_DRIVERS_I2C_WW_RING) += ww_ring.c
+libverstage-$(CONFIG_DRIVERS_I2C_WW_RING) += ww_ring_programs.c
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 318fe4d..82dd5c5 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -39,9 +39,9 @@
verstage-$(CONFIG_COMMON_CBFS_SPI_WRAPPER) += cbfs_spi.c
ifeq ($(MOCK_TPM),1)
-verstage-y += mocked_tlcl.c
+libverstage-y += mocked_tlcl.c
else
-verstage-y += tlcl.c
+libverstage-y += tlcl.c
endif
verstage-$(CONFIG_GENERIC_UDELAY) += timer.c
diff --git a/src/soc/qualcomm/ipq806x/Makefile.inc b/src/soc/qualcomm/ipq806x/Makefile.inc
index 3eb070e..8cf8d7a 100644
--- a/src/soc/qualcomm/ipq806x/Makefile.inc
+++ b/src/soc/qualcomm/ipq806x/Makefile.inc
@@ -27,10 +27,10 @@
verstage-y += clock.c
verstage-y += gpio.c
-verstage-y += gsbi.c
-verstage-y += i2c.c
-verstage-y += qup.c
-verstage-y += spi.c
+libverstage-y += gsbi.c
+libverstage-y += i2c.c
+libverstage-y += qup.c
+libverstage-y += spi.c
verstage-y += timer.c
verstage-$(CONFIG_CONSOLE_SERIAL_IPQ806X) += uart.c
diff --git a/src/soc/rockchip/rk3288/Makefile.inc b/src/soc/rockchip/rk3288/Makefile.inc
index be41327..0c7585a 100644
--- a/src/soc/rockchip/rk3288/Makefile.inc
+++ b/src/soc/rockchip/rk3288/Makefile.inc
@@ -39,7 +39,7 @@
verstage-$(CONFIG_DRIVERS_UART) += uart.c
verstage-y += gpio.c
verstage-y += clock.c
-verstage-y += crypto.c
+libverstage-y += crypto.c
verstage-y += i2c.c
verstage-$(CONFIG_SOFTWARE_I2C) += software_i2c.c
diff --git a/src/vendorcode/google/chromeos/vboot2/Makefile.inc b/src/vendorcode/google/chromeos/vboot2/Makefile.inc
index 4c53aed..29115de 100644
--- a/src/vendorcode/google/chromeos/vboot2/Makefile.inc
+++ b/src/vendorcode/google/chromeos/vboot2/Makefile.inc
@@ -17,7 +17,7 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-verstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
+libverstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
bootblock-y += ../vboot_common.c
verstage-y += ../vboot_common.c
@@ -25,14 +25,14 @@
ramstage-y += ../vboot_common.c
bootblock-y += verstub.c
-verstage-y += verstub.c
+libverstage-y += verstub.c
bootblock-y += common.c
-verstage-y += verstage.c
+libverstage-y += verstage.c
verstage-y += common.c
ifeq (${CONFIG_VBOOT2_MOCK_SECDATA},y)
-verstage-y += secdata_mock.c
+libverstage-y += secdata_mock.c
else
-verstage-y += antirollback.c
+libverstage-y += antirollback.c
endif
romstage-y += vboot_handoff.c common.c
@@ -41,7 +41,7 @@
VB_FIRMWARE_ARCH := $(ARCHDIR-$(ARCH-VERSTAGE-y))
VB2_LIB = $(obj)/external/vboot_reference/vboot_fw20.a
VBOOT_CFLAGS += $(patsubst -I%,-I$(top)/%,$(filter-out -include $(src)/include/kconfig.h, $(CPPFLAGS_verstage)))
-VBOOT_CFLAGS += $(verstage-c-ccopts)
+VBOOT_CFLAGS += $(libverstage-c-ccopts)
VBOOT_CFLAGS += -include $(top)/src/include/kconfig.h -Wno-missing-prototypes
VBOOT_CFLAGS += -DVBOOT_DEBUG
@@ -55,7 +55,7 @@
V=$(V) \
fwlib20
-verstage-srcs += $(VB2_LIB)
+libverstage-srcs += $(VB2_LIB)
ifeq ($(CONFIG_SEPARATE_VERSTAGE),y)
cbfs-files-y += $(call strip_quotes,$(CONFIG_CBFS_PREFIX))/verstage