diff options
author | Subrata Banik <subratabanik@google.com> | 2023-11-14 13:09:52 +0530 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2023-11-16 05:19:20 +0000 |
commit | 7f7ebb7b3d11690bf1e77d178a43816e56122d39 (patch) | |
tree | b4f194062595f10a6a39faa19c8df3b666995a96 | |
parent | 2495f24bd755e541434cbc6ec7d9b4f4b281d49e (diff) |
lib: Update locales for non-VBOOT platforms
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 <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79054
Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
-rw-r--r-- | src/lib/ux_locales.c | 18 |
1 files 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", |