From aa3da6e785ad731eacb8ad6da5f2ca4631658df8 Mon Sep 17 00:00:00 2001 From: Wonkyu Kim Date: Thu, 20 Mar 2025 15:23:43 -0700 Subject: [PATCH] src/lib: use RO CBFS file as fw_config source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The FW_CONFIG_SOURCE_CBFS option serves as a backup for FW_CONFIG_SOURCE_CHROMEEC_CBI, utilizing variables stored in CBFS. When using ChromeEC CBI as the firmware configuration source, changes to fw_config values can be made without updating the firmware image. However, using CBFS as the configuration source requires resigning the firmware because the current implementation reads from the RW firmware region (FW_MAIN_A/B), necessitating resigning for updates. To avoid this step, the code should be modified to use the RO CBFS for fw_config values instead of the RW (Read-Write) CBFS. TEST: 1. Add FW_CONFIG_SOURCE_CBFS in board Kconfig and build image 2. Modify fw_config value by cbfstool with built image 3. flash and boot up system 4. Check updated fw_config value Signed-off-by: Wonkyu Kim Change-Id: I4710a1043fe75888d2dcaee98c6957e6bd639be9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/86943 Reviewed-by: Julius Werner Reviewed-by: Cliff Huang Reviewed-by: Jamie Ryu Reviewed-by: Jérémy Compostella Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Bora Guvendik --- src/lib/fw_config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/fw_config.c b/src/lib/fw_config.c index e03256764b..74f3f8bc41 100644 --- a/src/lib/fw_config.c +++ b/src/lib/fw_config.c @@ -34,8 +34,8 @@ uint64_t fw_config_get(void) /* Look in CBFS to allow override of value. */ if (CONFIG(FW_CONFIG_SOURCE_CBFS) && fw_config_value == UNDEFINED_FW_CONFIG) { - if (cbfs_load(CONFIG_CBFS_PREFIX "/fw_config", &fw_config_value, - sizeof(fw_config_value)) != sizeof(fw_config_value)) + if (cbfs_ro_load(CONFIG_CBFS_PREFIX "/fw_config", &fw_config_value, + sizeof(fw_config_value)) != sizeof(fw_config_value)) printk(BIOS_WARNING, "%s: Could not get fw_config from CBFS\n", __func__); else