summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicholas Chin <nic.c3.14@gmail.com>2024-06-14 21:42:09 -0600
committerFelix Singer <service+coreboot-gerrit@felixsinger.de>2024-06-16 13:47:11 +0000
commit090f352c2cc6fb869d1d9046788d6cf72d7bc61b (patch)
treec5841ec5e320f5476f413ed38347b83ca004755b /src
parent32bf60ee5ce046d1ba17192a5767faa505564b96 (diff)
console: Only add non-stub code to romstage if SEPARATE_ROMSTAGE=y
If both CONFIG_SEPARATE_ROMSTAGE and CONFIG_BOOTBLOCK_CONSOLE are not set, compilation will fail with errors indicating redefinitions of various console methods. When BOOTBLOCK_CONSOLE is not set, the __CONSOLE_ENABLE__ macro in include/console/console.h evaluates to zero when compiling the bootblock, resulting in various console methods being defined as stubs in the header. In a typical build with a separate bootblock and romstage, this will not cause a conflict as the non-stub definitions found in the console/*.c files are added conditionally to the bootblock depending on CONFIG_BOOTBLOCK_CONSOLE. When SEPARATE_ROMSTAGE is not set, the list of romstage objects gets added to the bootblock. Since the console sources were unconditionally added to romstage, the non-stub definitions were able to slip into the bootblock, causing a redefinition of the stubs. Avoid this by conditionally adding these sources to romstage depending on CONFIG_SEPARATE_ROMSTAGE. If SEPARATE_ROMSTAGE is set, the non-stub definitions are handled in the same way as they were before. If it is not set, the union of bootblock and romstage objects will only include the non-stub definitions based on CONFIG_BOOTBLOCK_CONSOLE, which uses existing console/Makefile.mk rules for the bootblock. TEST=qemu-i440fx builds successfully with all possible settings of CONFIG_SEPARATE_ROMSTAGE and CONFIG_BOOTBLOCK_CONSOLE. Change-Id: I59b3f0c52a4338b1573e0a647bc16cec4943fd7f Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83088 Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/console/Makefile.mk4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/console/Makefile.mk b/src/console/Makefile.mk
index fd98cf7354..e104632287 100644
--- a/src/console/Makefile.mk
+++ b/src/console/Makefile.mk
@@ -24,8 +24,8 @@ verstage-y += die.c
verstage-y += init.c
verstage-y += vtxprintf.c vsprintf.c
-romstage-y += vtxprintf.c printk.c vsprintf.c
-romstage-y += init.c console.c
+romstage-$(CONFIG_SEPARATE_ROMSTAGE) += vtxprintf.c printk.c vsprintf.c
+romstage-$(CONFIG_SEPARATE_ROMSTAGE) += init.c console.c
romstage-y += post.c
romstage-y += die.c