]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: variables PlatformLang and PlatformLangCodes
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 5 Apr 2019 00:45:21 +0000 (02:45 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 7 Apr 2019 12:17:06 +0000 (14:17 +0200)
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

index 8266d06c2efc8ff1607b725e0497b618968d568b..a908843d87ab50d0fd989c160890fc7354905321 100644 (file)
@@ -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;
+
        /* Initialize once only */
        if (efi_obj_list_initialized != OBJ_LIST_NOT_INITIALIZED)
                return efi_obj_list_initialized;