From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1] efi_loader: variables PlatformLang and PlatformLangCodes
Date: Tue, 9 Apr 2019 10:18:34 +0900 [thread overview]
Message-ID: <20190409011833.GA21650@linaro.org> (raw)
In-Reply-To: <20190405013354.21169-1-xypron.glpk@gmx.de>
On Fri, Apr 05, 2019 at 03:33:54AM +0200, Heinrich Schuchardt wrote:
> Since TianoCore EDK2 commit d65f2cea36d1 ("ShellPkg/CommandLib: Locate
> proper UnicodeCollation instance") in edk2 the UEFI Shell crashes if EFI
> variable PlatformLang is not defined.
>
> As this variable is anyway prescribed in the UEFI 2.7 spec let's define it
> to L"en-US". Use the same value for PlatformLangCodes that defines the list
> of all supported languages.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> lib/efi_loader/efi_setup.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> index 8266d06c2e..e431c1c053 100644
> --- a/lib/efi_loader/efi_setup.c
> +++ b/lib/efi_loader/efi_setup.c
> @@ -10,6 +10,9 @@
>
> #define OBJ_LIST_NOT_INITIALIZED 1
>
> +/* Language code for American English according to RFC 4646 */
> +#define EN_US L"en-US"
> +
> static efi_status_t efi_obj_list_initialized = OBJ_LIST_NOT_INITIALIZED;
>
> /* Initialize and populate EFI object list */
> @@ -24,6 +27,30 @@ efi_status_t efi_init_obj_list(void)
> */
> efi_save_gd();
>
> + /*
> + * Variable PlatformLang defines the language that the machine has been
> + * configured for.
> + */
> + ret = EFI_CALL(efi_set_variable(L"PlatformLang",
> + &efi_global_variable_guid,
> + EFI_VARIABLE_BOOTSERVICE_ACCESS |
> + EFI_VARIABLE_RUNTIME_ACCESS,
> + sizeof(EN_US), EN_US));
> + if (ret != EFI_SUCCESS)
> + goto out;
> +
> + /*
> + * Variable PlatformLangCodes defines the language codes that the
> + * machine can support.
> + */
> + ret = EFI_CALL(efi_set_variable(L"PlatformLangCodes",
> + &efi_global_variable_guid,
> + EFI_VARIABLE_BOOTSERVICE_ACCESS |
> + EFI_VARIABLE_RUNTIME_ACCESS,
> + sizeof(EN_US), EN_US));
> + if (ret != EFI_SUCCESS)
> + goto out;
I don't think that it is a good idea to make a hard-coding like this
in init code. Instead, we should add some kind of framework so that
initial (default) variables can be configured.
-Takahiro Akashi
> /* Initialize once only */
> if (efi_obj_list_initialized != OBJ_LIST_NOT_INITIALIZED)
> return efi_obj_list_initialized;
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-04-09 1:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-05 1:33 [U-Boot] [PATCH 1/1] efi_loader: variables PlatformLang and PlatformLangCodes Heinrich Schuchardt
2019-04-09 1:18 ` AKASHI Takahiro [this message]
2019-04-09 5:10 ` Heinrich Schuchardt
2019-04-11 4:49 ` AKASHI Takahiro
2019-04-11 5:12 ` Heinrich Schuchardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190409011833.GA21650@linaro.org \
--to=takahiro.akashi@linaro.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.