aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2022-12-15 22:12:10 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-04-22 16:20:49 +0000
commita9dd3c3fae07b8740c9da30c691a738e8d5e5fa4 (patch)
treedc502d28e1119ea1aa72ba7d499e8b7de05f6d7f /src/lib
parent5cabc29013759f667a9a08a88c58468485749ac9 (diff)
lib/version: Move board identification strings
These strings are now only expanded in lib/identity.c. This improves ccache hit rates slightly, as one built object file lib/version.o is used for all variants of a board. Also one built object file lib/identity.o can become a ccache hit for successive builds of a variant, while the commit hash changes. Change-Id: Ia7d5454d95c8698ab1c1744e63ea4c04d615bb3b Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/74449 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.inc8
-rw-r--r--src/lib/coreboot_table.c3
-rw-r--r--src/lib/identity.c14
-rw-r--r--src/lib/version.c10
4 files changed, 18 insertions, 17 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index c83004a866..385c87eb7c 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -229,12 +229,8 @@ ifeq ($(CONFIG_DEBUG_SMI),y)
smm-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
endif
-bootblock-y += version.c
-romstage-y += version.c
-ramstage-y += version.c
-smm-y += version.c
-verstage-y += version.c
-postcar-y += version.c
+all-y += identity.c version.c
+smm-y += identity.c version.c
$(call src-to-obj,bootblock,$(dir)/version.c) : $(obj)/build.h
$(call src-to-obj,romstage,$(dir)/version.c) : $(obj)/build.h
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index 0707fd3eca..bee389d0bf 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -4,12 +4,12 @@
#include <arch/cbconfig.h>
#include <console/console.h>
#include <console/uart.h>
+#include <identity.h>
#include <ip_checksum.h>
#include <boot/coreboot_tables.h>
#include <boot/tables.h>
#include <boot_device.h>
#include <string.h>
-#include <version.h>
#include <boardid.h>
#include <device/device.h>
#include <drivers/tpm/tpm_ppi.h>
@@ -23,6 +23,7 @@
#include <spi_flash.h>
#include <smmstore.h>
#include <types.h>
+#include <version.h>
#if CONFIG(USE_OPTION_TABLE)
#include <option_table.h>
diff --git a/src/lib/identity.c b/src/lib/identity.c
new file mode 100644
index 0000000000..04371a7382
--- /dev/null
+++ b/src/lib/identity.c
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <identity.h>
+
+#ifndef CONFIG_MAINBOARD_VENDOR
+#error CONFIG_MAINBOARD_VENDOR not defined
+#endif
+#ifndef CONFIG_MAINBOARD_PART_NUMBER
+#error CONFIG_MAINBOARD_PART_NUMBER not defined
+#endif
+
+const char mainboard_vendor[] = CONFIG_MAINBOARD_VENDOR;
+const char mainboard_part_number[] = CONFIG_MAINBOARD_PART_NUMBER;
+const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER;
diff --git a/src/lib/version.c b/src/lib/version.c
index 84718328f0..43d6a45821 100644
--- a/src/lib/version.c
+++ b/src/lib/version.c
@@ -3,13 +3,6 @@
#include <version.h>
#include <build.h>
-#ifndef CONFIG_MAINBOARD_VENDOR
-#error CONFIG_MAINBOARD_VENDOR not defined
-#endif
-#ifndef CONFIG_MAINBOARD_PART_NUMBER
-#error CONFIG_MAINBOARD_PART_NUMBER not defined
-#endif
-
#ifndef COREBOOT_VERSION
#error COREBOOT_VERSION not defined
#endif
@@ -25,9 +18,6 @@
#define COREBOOT_EXTRA_VERSION ""
#endif
-const char mainboard_vendor[] = CONFIG_MAINBOARD_VENDOR;
-const char mainboard_part_number[] = CONFIG_MAINBOARD_PART_NUMBER;
-
const char coreboot_version[] = COREBOOT_VERSION;
const char coreboot_extra_version[] = COREBOOT_EXTRA_VERSION;
const char coreboot_build[] = COREBOOT_BUILD;