[coreboot-gerrit] Change in coreboot[master]: vboot: Compile bootmode.c conditionally based on CONFIG_VBOOT

Julius Werner (Code Review) gerrit at coreboot.org
Tue Mar 28 22:17:07 CEST 2017


Julius Werner has submitted this change and it was merged. ( https://review.coreboot.org/18982 )

Change subject: vboot: Compile bootmode.c conditionally based on CONFIG_VBOOT
......................................................................


vboot: Compile bootmode.c conditionally based on CONFIG_VBOOT

Currently, src/vboot/bootmode.c gets compiled even if vboot is disabled.
It seems that this was only done to support calling certain
developer/recovery mode functions in this case. There is no reason to
compile the whole file for that -- we can just differentiate with a
stub in the header instead, which is what other parts of coreboot
usually do for cases like this.

Change-Id: If83e1b3e0f34f75c2395b4c464651e373724b2e6
Signed-off-by: Julius Werner <jwerner at chromium.org>
Reviewed-on: https://review.coreboot.org/18982
Reviewed-by: Aaron Durbin <adurbin at chromium.org>
Tested-by: build bot (Jenkins)
---
M src/vboot/Makefile.inc
M src/vboot/bootmode.c
M src/vboot/vboot_common.h
3 files changed, 8 insertions(+), 11 deletions(-)

Approvals:
  Aaron Durbin: Looks good to me, approved
  build bot (Jenkins): Verified



diff --git a/src/vboot/Makefile.inc b/src/vboot/Makefile.inc
index fb373c3..a09811b 100644
--- a/src/vboot/Makefile.inc
+++ b/src/vboot/Makefile.inc
@@ -13,13 +13,13 @@
 ## GNU General Public License for more details.
 ##
 
+ifeq ($(CONFIG_VBOOT),y)
+
 bootblock-y += bootmode.c
 romstage-y += bootmode.c
 ramstage-y += bootmode.c
 verstage-y += bootmode.c
 postcar-y += bootmode.c
-
-ifeq ($(CONFIG_VBOOT),y)
 
 libverstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
 verstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
diff --git a/src/vboot/bootmode.c b/src/vboot/bootmode.c
index 21922d4..d66911f 100644
--- a/src/vboot/bootmode.c
+++ b/src/vboot/bootmode.c
@@ -74,9 +74,6 @@
  */
 static int vboot_possibly_executed(void)
 {
-	if (!IS_ENABLED(CONFIG_VBOOT))
-		return 0;
-
 	if (IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK)) {
 		if (ENV_BOOTBLOCK && IS_ENABLED(CONFIG_SEPARATE_VERSTAGE))
 			return 0;
@@ -141,9 +138,6 @@
 
 int vboot_recovery_mode_enabled(void)
 {
-	if (!IS_ENABLED(CONFIG_VBOOT))
-		return 0;
-
 	return !!vboot_check_recovery_request();
 }
 
@@ -159,9 +153,6 @@
 
 int vboot_developer_mode_enabled(void)
 {
-	if (!IS_ENABLED(CONFIG_VBOOT))
-		return 0;
-
 	if (cbmem_possibly_online() && vboot_handoff_check_developer_flag())
 		return 1;
 
diff --git a/src/vboot/vboot_common.h b/src/vboot/vboot_common.h
index aa01f28..8421ecb 100644
--- a/src/vboot/vboot_common.h
+++ b/src/vboot/vboot_common.h
@@ -104,8 +104,14 @@
 void verstage_mainboard_init(void);
 
 /* Check boot modes */
+#if IS_ENABLED(CONFIG_VBOOT)
 int vboot_developer_mode_enabled(void);
 int vboot_recovery_mode_enabled(void);
 int vboot_recovery_mode_memory_retrain(void);
+#else /* !CONFIG_VBOOT */
+static inline int vboot_developer_mode_enabled(void) { return 0; }
+static inline int vboot_recovery_mode_enabled(void) { return 0; }
+static inline int vboot_recovery_mode_memory_retrain(void) { return 0; }
+#endif
 
 #endif /* __VBOOT_VBOOT_COMMON_H__ */

-- 
To view, visit https://review.coreboot.org/18982
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If83e1b3e0f34f75c2395b4c464651e373724b2e6
Gerrit-PatchSet: 13
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Aaron Durbin <adurbin at chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan at google.com>
Gerrit-Reviewer: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi at google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter at users.sourceforge.net>
Gerrit-Reviewer: build bot (Jenkins)



More information about the coreboot-gerrit mailing list