From patchwork Sun May 29 01:52:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 577061 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8607:0:0:0:0 with SMTP id bb7csp1888154mab; Sat, 28 May 2022 18:52:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk7WVXAr06MnzGGw+jKT/xHBOAEREm6rVYhY1uKze3MPpnhULZf63iCA3Yp1i28jsd6Al0 X-Received: by 2002:a02:6a6b:0:b0:323:fcf9:2227 with SMTP id m43-20020a026a6b000000b00323fcf92227mr24662727jaf.137.1653789143283; Sat, 28 May 2022 18:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653789143; cv=none; d=google.com; s=arc-20160816; b=Q7g+UA+aqUyAQ87JVKsB4tQ8JSSb0Bf0l3tcpU47FzhC6I4oVOHKkMT1eQqQ4W/A9C rTiJ/+BGBtSPUz+2XTTkD/txRUZ1KqNk/JzK+zLZeHO4brgkKJBleycaHUm/ihnXJwWT 8pHcEm919ir9j6SrSi4/S6BYgRX+55F3Ex44ciSAgJRNxwEHT0G19+6G9F3eZd4eLnal pB+H78w3uQNvxzcq7IL01/9vglKJ/ZXA/MAM/SO+50FRbfru7o0XR/qbL8OKeWlM23I/ BYZjXvH7viXqkTnWqO2a96ZmzsmtFgZN18MEr1SZhfyan/Vv9VquBZdfX1W7r1o+J7X3 u4+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ZFda4hgYiNQjmTkpnBZgOVOxeC5DaQGMlII8ikmSnJk=; b=QRLzMgfFzpKnPBOe+cnYpqqfwVlXCCKsIFYW6RLA4zUTFxu1MhtcMnEj6F+tCUi/hs 04IxlQVg2jKpIlOhGJl4DmyUf1Ki1ySZi3qR4LChPdKiB5FbrPcep/EjX0B4v7Ikcm0G bu/Js0r0Vcb2f6GWcOEWpIc9sX86qQ5heeUX5gN0/AiqJ1wpr5MfBvPAXB0FHX9ZiUwZ w2y+r8DKM+Hab4ufiZtQDsyA/f8AHr0LYNN5zP0AgJGJVFgfckgZcC6VcmOEUL5h2cMT OsiC/bLr//htSWPt8HN9mYv6yxa+jb91shUoJ753Cu6B30pz0/FRBAgNrfStpi1Yctk/ fK7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W1OR7MPR; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a15-20020a6b660f000000b00657cb900c35si8370352ioc.31.2022.05.28.18.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 18:52:23 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W1OR7MPR; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39E79843AF; Sun, 29 May 2022 03:52:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="W1OR7MPR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5C401843A0; Sun, 29 May 2022 03:52:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A11CC84390 for ; Sun, 29 May 2022 03:51:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pj1-x102a.google.com with SMTP id gk22so7892782pjb.1 for ; Sat, 28 May 2022 18:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZFda4hgYiNQjmTkpnBZgOVOxeC5DaQGMlII8ikmSnJk=; b=W1OR7MPRhBJQi9kkSMVzxUoM7Gd+U0h8VXncUxk52Z4JTZmIecu/1uCfSKKT0MsKz7 4/JvdWZkUYInzCfj2OWXr84wTaAlrsD2LIIp3wwW2CBCwsvcQ4Ly6zfJ4JPrknC6uaDx ZPLp7DSCWpqGvZIBJ3TTvmrFrVly+CLQ3b2BzzvNX1FszkZ+5CYQxVDfkGHqpK4JQGB2 CT9kru1k2GYKeQ7ZzpUdj4PqjsBZELnyZdPe0kXj9DBgINW1FfXSJwjQOBd7EXHGbfzs 2cDK5kXXRavwLjDjCLP65OfLH9p/vbHvV5qktFKH/XgF/geYUr64xVBfjCUfB1Zo7Q9+ VOsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZFda4hgYiNQjmTkpnBZgOVOxeC5DaQGMlII8ikmSnJk=; b=g8oWiSgVryYGmsajaslkUtI3/tyygSwdr8mB/DIdoWbUfGUBebAuuwYZ/fAgwIhUoO O2shKYXSRtWF2utuAQPAq/AqrqxwDTmHaO2kGGl3vA1MmfsaxXXb/d1SU/NdB98X6F9r 0prsy9xf6WQN9QR6PCTm+O+/djsnNYNB8rvoObxMZEYGkArkA6ByRSYy++CJAJYvlnk2 0EbQhBI7RIfED0Ob3NjDMY+Y0wBglzHvihLOGvyv2Xt/qpW514t5r2I/jm8vq4KquQGU 4IB6GFdEEpTbclyiGXzrkx1QLVBF11GOhQZ+PKA+V93eHr1WOTT+XWpVqIw/m5KaW5Rb HyJg== X-Gm-Message-State: AOAM5331Rqs+qob6kzug8KPub9zXNNIv0UvKHVBwYCq+2sr3ilrJlGnH WyXBZ0WTvlufrTFckJdTfriVycdsL7PvUQ== X-Received: by 2002:a17:902:ea57:b0:15a:6173:87dd with SMTP id r23-20020a170902ea5700b0015a617387ddmr50602253plg.147.1653789115927; Sat, 28 May 2022 18:51:55 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id l7-20020a17090270c700b001639f038250sm3791796plt.220.2022.05.28.18.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 18:51:55 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Pali Rohar , Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Mark Kettenis , Masahisa Kojima Subject: [PATCH v3 1/2] bootmenu: use utf-8 for menu title Date: Sun, 29 May 2022 10:52:43 +0900 Message-Id: <20220529015244.3910-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220529015244.3910-1-masahisa.kojima@linaro.org> References: <20220529015244.3910-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The commit a3d0aa87acbe ("bootmenu: update bootmenu_entry structure") changes the bootmenu title type from char to u16(UTF16 string) to support EFI based system. If EFI_LOADER is not enabled, printf("%ls") is not supported, so bootmenu does not appear correctly. This commit changes the type of menu title from u16(UTF16) to utf-8 string and EFI strings is conveted into utf-8. Fixes: a3d0aa87acbe ("bootmenu: update bootmenu_entry structure") Signed-off-by: Masahisa Kojima Tested-by: Pali Rohar --- Changes in v3: - use strdup for bootmenu_x command parameter - add comment for readbility - use proper space no change in v2 cmd/bootmenu.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c index 8859eebea5..7f776fde59 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c @@ -43,7 +43,7 @@ enum boot_type { struct bootmenu_entry { unsigned short int num; /* unique number 0 .. MAX_COUNT */ char key[3]; /* key identifier of number */ - u16 *title; /* title of entry */ + char *title; /* title of entry */ char *command; /* hush command of entry */ enum boot_type type; /* boot type of entry */ u16 bootorder; /* order for each boot type */ @@ -76,7 +76,7 @@ static void bootmenu_print_entry(void *data) if (reverse) puts(ANSI_COLOR_REVERSE); - printf("%ls", entry->title); + printf("%s", entry->title); if (reverse) puts(ANSI_COLOR_RESET); @@ -170,8 +170,9 @@ static int prepare_bootmenu_entry(struct bootmenu_data *menu, struct bootmenu_entry *iter = *current; while ((option = bootmenu_getoption(i))) { - u16 *buf; + char *buf; + /* bootmenu_[num] format is "[title]=[commands]" */ sep = strchr(option, '='); if (!sep) { printf("Invalid bootmenu entry: %s\n", option); @@ -182,24 +183,21 @@ static int prepare_bootmenu_entry(struct bootmenu_data *menu, if (!entry) return -ENOMEM; - len = sep-option; - buf = calloc(1, (len + 1) * sizeof(u16)); + len = sep - option; + buf = calloc(1, (len + 1)); entry->title = buf; if (!entry->title) { free(entry); return -ENOMEM; } - utf8_utf16_strncpy(&buf, option, len); + strncpy(buf, option, len); - len = strlen(sep + 1); - entry->command = malloc(len + 1); + entry->command = strdup(sep + 1); if (!entry->command) { free(entry->title); free(entry); return -ENOMEM; } - memcpy(entry->command, sep + 1, len); - entry->command[len] = 0; sprintf(entry->key, "%d", i); @@ -227,6 +225,7 @@ static int prepare_bootmenu_entry(struct bootmenu_data *menu, return 1; } +#if (CONFIG_IS_ENABLED(CMD_BOOTEFI_BOOTMGR)) /** * prepare_uefi_bootorder_entry() - generate the uefi bootmenu entries * @@ -279,13 +278,17 @@ static int prepare_uefi_bootorder_entry(struct bootmenu_data *menu, } if (lo.attributes & LOAD_OPTION_ACTIVE) { - entry->title = u16_strdup(lo.label); - if (!entry->title) { + char *buf; + + buf = calloc(1, utf16_utf8_strlen(lo.label) + 1); + if (!buf) { free(load_option); free(entry); free(bootorder); return -ENOMEM; } + entry->title = buf; + utf16_utf8_strncpy(&buf, lo.label, u16_strlen(lo.label)); entry->command = strdup("bootefi bootmgr"); sprintf(entry->key, "%d", i); entry->num = i; @@ -315,6 +318,7 @@ static int prepare_uefi_bootorder_entry(struct bootmenu_data *menu, return 1; } +#endif static struct bootmenu_data *bootmenu_create(int delay) { @@ -341,13 +345,13 @@ static struct bootmenu_data *bootmenu_create(int delay) if (ret < 0) goto cleanup; - if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { - if (i < MAX_COUNT - 1) { +#if (CONFIG_IS_ENABLED(CMD_BOOTEFI_BOOTMGR)) + if (i < MAX_COUNT - 1) { ret = prepare_uefi_bootorder_entry(menu, &iter, &i); if (ret < 0 && ret != -ENOENT) goto cleanup; - } } +#endif /* Add U-Boot console entry at the end */ if (i <= MAX_COUNT - 1) { @@ -357,9 +361,9 @@ static struct bootmenu_data *bootmenu_create(int delay) /* Add Quit entry if entering U-Boot console is disabled */ if (IS_ENABLED(CONFIG_CMD_BOOTMENU_ENTER_UBOOT_CONSOLE)) - entry->title = u16_strdup(u"U-Boot console"); + entry->title = strdup("U-Boot console"); else - entry->title = u16_strdup(u"Quit"); + entry->title = strdup("Quit"); if (!entry->title) { free(entry); @@ -461,7 +465,7 @@ static enum bootmenu_ret bootmenu_show(int delay) int cmd_ret; int init = 0; void *choice = NULL; - u16 *title = NULL; + char *title = NULL; char *command = NULL; struct menu *menu; struct bootmenu_entry *iter; @@ -517,7 +521,7 @@ static enum bootmenu_ret bootmenu_show(int delay) if (menu_get_choice(menu, &choice) == 1) { iter = choice; - title = u16_strdup(iter->title); + title = strdup(iter->title); command = strdup(iter->command); /* last entry is U-Boot console or Quit */ @@ -561,7 +565,7 @@ cleanup: } if (title && command) { - debug("Starting entry '%ls'\n", title); + debug("Starting entry '%s'\n", title); free(title); if (efi_ret == EFI_SUCCESS) cmd_ret = run_command(command, 0); From patchwork Sun May 29 01:52:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 577062 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:8607:0:0:0:0 with SMTP id bb7csp1888209mab; Sat, 28 May 2022 18:52:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcrHF0XFtYhpMbTc8ePw0FmLKS3+zSy9v+lE6DtIpspxfa9XQca9O3Vvlz5RS4fUrB9UJN X-Received: by 2002:a05:6e02:1a03:b0:2d2:c409:b12e with SMTP id s3-20020a056e021a0300b002d2c409b12emr6543257ild.125.1653789155915; Sat, 28 May 2022 18:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653789155; cv=none; d=google.com; s=arc-20160816; b=iYWr0hCzt+WHK9xJTZSs4vaNpiCZASCNhTl9H+8sqkzwiOOpMl+iOkdu4A5BA48HRW s7dLGIO9uQUT1gYVYD1Vt2esMD/773QRGVV0v5JOqXBetFbyE7Nlu5uUe3tdbQykMnkG orStyvZTYuVRsSDoK++Ik+QKOViECDzOUs/Xvqc6nLJxOeTJFK8atvU8sM7AIHQcj/Ri Ek0gfhzfrRcxJa/qvoX4xCuff5ObHcDrvjvof8NXCDN1S+BjTLMJkUrrP3onrZjKq8fB wK4fkhWjI6ues3BjqSTSs4UeCLRb14XU2JHLw6oCrZPuEB4zWXR2GcDz5prL4Kagq4fP fvUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=9xe2ADiQ/Wufm2kVb8lqz4UwCBwHz6pBJRiJJiowrjE=; b=VvD7dqxUX/mYe7FGlNaD90VkgUtxH4q7B6ysjIyOy1oywGDEb8BjKg91vYW+zW8FLI BeOQeSxtYRc/3pEmjV/q47+uBG/ygFzEUFHvSv/UIXiZKglvxtM1SKmLBeRX6HGHh4s0 0JtHcV4Cr8kC32+hZQfrrJgX5ogq155HCmzinLi8dez1OCtZ/QJ9/gysmHZPok/WAcqT 27PJu6bxXYyRV5daTMgyhv0e9F3ZEUepE3bhC2/Rlar27Pqt+vZCAIVm9Q2fHkVJqHAs r/XfPJXMcpjLQ4mx8pi53vsvernLQu/FBZ/2WirRR8o62Ik5GXf/TJYDE93TMs5IR2sA lonA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lMaso4jA; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id x22-20020a056638249600b0032af6245acesi7261472jat.53.2022.05.28.18.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 18:52:35 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lMaso4jA; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B98AE843BC; Sun, 29 May 2022 03:52:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="lMaso4jA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B718843A0; Sun, 29 May 2022 03:52:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A69EB843A1 for ; Sun, 29 May 2022 03:52:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pf1-x42b.google.com with SMTP id h13so7602848pfq.5 for ; Sat, 28 May 2022 18:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9xe2ADiQ/Wufm2kVb8lqz4UwCBwHz6pBJRiJJiowrjE=; b=lMaso4jAKBqOMswMVhVE9vjWmlvIvp5HpY7pVzmsOYKfr1ce9U7vpP3PnBNlEnD5jS uO/QZFx33nX7V+qaqCf0jTnFEAFIzJKnEC1twrZ7w2M/6u7yLsG0PyemsVsXtXNQWF71 7S3M6e0I6UOkkntEFsJLyqtRtpQisf9rWSN4ZsJ7X9bzBEqWEQZ7UFthOwXyh6MUaIUM MLy/MmERevaKhRL7Z9/HjkgIQNeymgkU3Pmq005IbbKHNze3aWn13GMYB6DaVmurhis4 NJqa+/qM37PwHlMHO5IKOdq+RTvNYJrk4axYAfcpJLAC5YiiQZU0PFxdLdCYYj/EKhPX 1zbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9xe2ADiQ/Wufm2kVb8lqz4UwCBwHz6pBJRiJJiowrjE=; b=ldIRBJg1RXH2uELoncjMVKwUa0BxHaXdZ6lO1mrhtDsS7/FbnBhehvKQHhmDbHK58x 3sFnb5FDNI0B028klftSYOL9fXkRC4Fpl5Wp25PPebwyZf3APxjjT6Yr/et3kmLQ4ejW +VrwKMJxQAAZWZ+jt87KJ/5vgyFTzYiM7tZx5ElPQHuRhJn1TLYpi2mYRI7PG7wQo5ST WY7ER6tey3SuGrbr+W1wGVqRv9uM/CTArETYDzdgQ11qNf/EzXMoAuTzaxLseao4tY7m yGuMn1VpnkBQHRK7mKH7m1VnLHsKPp/Ek3ApjuUznFVj9YB5RS5xYtuipy85F0MBsCEU O/ig== X-Gm-Message-State: AOAM5306b6vxMKFi1ANr+7Irrim4o32sTycysNAK7VrvT6ssJE8skNCt oV9kQzzhJeKzOsNpGT4o65wMBFNNYQrwIw== X-Received: by 2002:a63:181f:0:b0:3c6:b0d:2214 with SMTP id y31-20020a63181f000000b003c60b0d2214mr42808888pgl.60.1653789119943; Sat, 28 May 2022 18:51:59 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id l7-20020a17090270c700b001639f038250sm3791796plt.220.2022.05.28.18.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 18:51:59 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Pali Rohar , Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Mark Kettenis , Masahisa Kojima , Simon Glass , Alexandru Gagniuc , Steffen Jaeckel , Michal Simek , Ovidiu Panait , Ashok Reddy Soma Subject: [PATCH v3 2/2] bootmenu: U-Boot console is enabled as default Date: Sun, 29 May 2022 10:52:44 +0900 Message-Id: <20220529015244.3910-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220529015244.3910-1-masahisa.kojima@linaro.org> References: <20220529015244.3910-1-masahisa.kojima@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The commit 2158b0da220c ("bootmenu: add Kconfig option not to enter U-Boot console") disables to enter U-Boot console from bootmenu as default, this change affects the existing bootmenu users. This commit reverts the default behavior, the bootmenu can enter U-Boot console same as before. CMD_BOOTMENU_ENTER_UBOOT_CONSOLE is renamed BOOTMENU_DISABLE_UBOOT_CONSOLE and depends on AUTOBOOT_MENU_SHOW. Fixes: 2158b0da220c ("bootmenu: add Kconfig option not to enter U-Boot console") Signed-off-by: Masahisa Kojima Tested-by: Pali Rohar Reviewed-by: Ilias Apalodimas --- No change in v3 Changes in v2: - remove "default n" since it is default option - use 80 characters in one line boot/Kconfig | 7 +++++++ cmd/Kconfig | 10 ---------- cmd/bootmenu.c | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/boot/Kconfig b/boot/Kconfig index dff4d23b88..08451c65a5 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -1143,6 +1143,13 @@ config AUTOBOOT_MENU_SHOW environmnent variable (if enabled) and before handling the boot delay. See README.bootmenu for more details. +config BOOTMENU_DISABLE_UBOOT_CONSOLE + bool "Disallow bootmenu to enter the U-Boot console" + depends on AUTOBOOT_MENU_SHOW + help + If this option is enabled, user can not enter the U-Boot console from + bootmenu. It increases the system security. + config BOOT_RETRY bool "Boot retry feature" help diff --git a/cmd/Kconfig b/cmd/Kconfig index 69c1814d24..09193b61b9 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -357,16 +357,6 @@ config CMD_BOOTMENU help Add an ANSI terminal boot menu command. -config CMD_BOOTMENU_ENTER_UBOOT_CONSOLE - bool "Allow Bootmenu to enter the U-Boot console" - depends on CMD_BOOTMENU - default n - help - Add an entry to enter U-Boot console in bootmenu. - If this option is disabled, user can not enter - the U-Boot console from bootmenu. It increases - the system security. - config CMD_ADTIMG bool "adtimg" help diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c index 7f776fde59..d9a1c1373c 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c @@ -360,7 +360,7 @@ static struct bootmenu_data *bootmenu_create(int delay) goto cleanup; /* Add Quit entry if entering U-Boot console is disabled */ - if (IS_ENABLED(CONFIG_CMD_BOOTMENU_ENTER_UBOOT_CONSOLE)) + if (!IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE)) entry->title = strdup("U-Boot console"); else entry->title = strdup("Quit"); @@ -593,7 +593,7 @@ int menu_show(int bootdelay) if (ret == BOOTMENU_RET_UPDATED) continue; - if (!IS_ENABLED(CONFIG_CMD_BOOTMENU_ENTER_UBOOT_CONSOLE)) { + if (IS_ENABLED(CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE)) { if (ret == BOOTMENU_RET_QUIT) { /* default boot process */ if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR))