efi: Make unicode printf available to the app
authorSimon Glass <sjg@chromium.org>
Wed, 29 Dec 2021 18:57:35 +0000 (11:57 -0700)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 31 Dec 2021 05:45:01 +0000 (06:45 +0100)
This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/Kconfig
lib/vsprintf.c

index 10ba086..1883ac7 100644 (file)
@@ -52,7 +52,7 @@ config CC_OPTIMIZE_LIBS_FOR_SPEED
 
 config CHARSET
        bool
-       default y if UT_UNICODE || EFI_LOADER || UFS
+       default y if UT_UNICODE || EFI_LOADER || UFS || EFI_APP
        help
          Enables support for various conversions between different
          character sets, such as between unicode representations and
index e634bd7..de9f236 100644 (file)
@@ -276,9 +276,8 @@ static char *string(char *buf, char *end, char *s, int field_width,
 }
 
 /* U-Boot uses UTF-16 strings in the EFI context only. */
-#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
-static char *string16(char *buf, char *end, u16 *s, int field_width,
-               int precision, int flags)
+static __maybe_unused char *string16(char *buf, char *end, u16 *s,
+                                    int field_width, int precision, int flags)
 {
        const u16 *str = s ? s : L"<NULL>";
        ssize_t i, len = utf16_strnlen(str, precision);
@@ -317,7 +316,6 @@ static char *device_path_string(char *buf, char *end, void *dp, int field_width,
        return buf;
 }
 #endif
-#endif
 
 static char *mac_address_string(char *buf, char *end, u8 *addr, int field_width,
                                int precision, int flags)
@@ -616,7 +614,8 @@ repeat:
 
                case 's':
 /* U-Boot uses UTF-16 strings in the EFI context only. */
-#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
+#if (CONFIG_IS_ENABLED(EFI_LOADER) || CONFIG_IS_ENABLED(EFI_APP)) && \
+       !defined(API_BUILD)
                        if (qualifier == 'l') {
                                str = string16(str, end, va_arg(args, u16 *),
                                               field_width, precision, flags);