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>
This commit is contained in:
Subrata Banik 2023-11-14 13:09:52 +05:30
parent 2495f24bd7
commit 7f7ebb7b3d
1 changed files with 10 additions and 8 deletions

View File

@ -116,7 +116,7 @@ const char *ux_locales_get_text(const char *name)
{ {
const char *data; const char *data;
size_t size, offset, name_offset, next_name_offset, next; 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; unsigned char version;
data = locales_get_map(&size, false); data = locales_get_map(&size, false);
@ -126,13 +126,15 @@ const char *ux_locales_get_text(const char *name)
return NULL; return NULL;
} }
/* Get the language ID from vboot API. */ if (CONFIG(VBOOT)) {
lang_id = vb2api_get_locale_id(vboot_get_context()); /* Get the language ID from vboot API. */
/* Validity check: Language ID should smaller than LANG_ID_MAX. */ lang_id = vb2api_get_locale_id(vboot_get_context());
if (lang_id >= LANG_ID_MAX) { /* Validity check: Language ID should smaller than LANG_ID_MAX. */
printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n", if (lang_id >= LANG_ID_MAX) {
__func__, lang_id); printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n",
lang_id = 0; __func__, lang_id);
lang_id = 0;
}
} }
printk(BIOS_INFO, "%s: Search for %s with language ID: %u\n", printk(BIOS_INFO, "%s: Search for %s with language ID: %u\n",