From 7f7ebb7b3d11690bf1e77d178a43816e56122d39 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 14 Nov 2023 13:09:52 +0530 Subject: [PATCH] lib: Update locales for non-VBOOT platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch sets the default locales to English for platforms that do not have support for VBOOT configuration. This ensures that the system will use English locales if the platform does not provide its own locale settings. TEST=Built and booted the google/rex platform successfully. Change-Id: I7554c8bfd58411f460deeb22cf7218059ca8ba9f Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/79054 Reviewed-by: Hsuan-ting Chen Reviewed-by: Arthur Heymans Tested-by: build bot (Jenkins) Reviewed-by: Jérémy Compostella Reviewed-by: Julius Werner --- src/lib/ux_locales.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lib/ux_locales.c b/src/lib/ux_locales.c index a2e38fc1dc..0a285d9b67 100644 --- a/src/lib/ux_locales.c +++ b/src/lib/ux_locales.c @@ -116,7 +116,7 @@ const char *ux_locales_get_text(const char *name) { const char *data; size_t size, offset, name_offset, next_name_offset, next; - uint32_t lang_id; + uint32_t lang_id = 0; /* default language English (0) */ unsigned char version; data = locales_get_map(&size, false); @@ -126,13 +126,15 @@ const char *ux_locales_get_text(const char *name) return NULL; } - /* Get the language ID from vboot API. */ - lang_id = vb2api_get_locale_id(vboot_get_context()); - /* Validity check: Language ID should smaller than LANG_ID_MAX. */ - if (lang_id >= LANG_ID_MAX) { - printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n", - __func__, lang_id); - lang_id = 0; + if (CONFIG(VBOOT)) { + /* Get the language ID from vboot API. */ + lang_id = vb2api_get_locale_id(vboot_get_context()); + /* Validity check: Language ID should smaller than LANG_ID_MAX. */ + if (lang_id >= LANG_ID_MAX) { + printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n", + __func__, lang_id); + lang_id = 0; + } } printk(BIOS_INFO, "%s: Search for %s with language ID: %u\n",