From patchwork Thu May 26 10:09:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 576239 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:c603:0:0:0:0 with SMTP id jv3csp426790mab; Thu, 26 May 2022 03:09:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4wovBwMBfns1FjVCPuBkdByykdn5dI1jp+1wwqLIGmjx1cjZQzyPZoI1v4uK12OH2Rkxk X-Received: by 2002:a05:6e02:12c7:b0:2d1:b346:c5aa with SMTP id i7-20020a056e0212c700b002d1b346c5aamr8978329ilm.57.1653559753068; Thu, 26 May 2022 03:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653559753; cv=none; d=google.com; s=arc-20160816; b=0kSNQGIKPLYxuYkJrUeugfxZPiUfBW91icIWNfoPWOe1pGNg18XenDD+UHnbRRnBFh VTkZCRqo6mZqfH7aF8TxfztfL1mED1yb+aLAW9ceuDf2AwNmx4AQFeEhUazSXq60otDs jejr/N9Nyz80rKj4L26IEqTTPBYj9/FyDQxSNfqWZZZA/jMNd390Ub2RbxqkhHEMg7m1 HlFrEu0t6ZvpIkWtwv2GTS1cMbO+0t1DBYuAnQIMCXILeX87bYPgN19y0Vx7dKA3pgZh OkhcJ9DGP3uWYwnQzCSm6+8ouv4RhmcHwUCt5dqiGBnz1XRNhxHYgnRdEtcpo6QHuffQ 7oog== 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=q/aMoAwe7SA6xsIkX4v+i1irvmyeYHcCvItJ2S1L+j0=; b=naBwXVm45V8pvQDfqXToKkNV0Q7dvf9o8e570njJYaDz2ycCxWEccFJwgu27ANIzxJ RZnWGrbanJtZLtFIokbc1WGqN28qMujtk9rckbL/5l7ndW1UmBRzWWLEmKnODxE1MBT5 ovwcV+3/lfyzVfcW8x3noGTk4fLIg98IRJDHh/tgZJj2Lq+ZCy0P3Xhgl9jEcGgkg7Dh PINXIjmENH46pQmCRuQyzwTFblZ4ao6XtcSV0QRHHIJzsJrwWd/V9Knp30wxB/x227OB RraXga0jvZ7eF4qQv1l8Nl0twqu3tqOOZkkML2sLqibheIOPDXqooxBRjfSqXyDTEwVJ vi/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V8x8DApu; 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 p17-20020a056e0206d100b002d1b63b4b49si942419ils.136.2022.05.26.03.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 03:09:13 -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=V8x8DApu; 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 E0ABA84347; Thu, 26 May 2022 12:09:10 +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="V8x8DApu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C39084322; Thu, 26 May 2022 12:08:56 +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-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (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 AFF0283DFE for ; Thu, 26 May 2022 12:08:52 +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-pl1-x62b.google.com with SMTP id a13so1058112plh.6 for ; Thu, 26 May 2022 03:08:52 -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=q/aMoAwe7SA6xsIkX4v+i1irvmyeYHcCvItJ2S1L+j0=; b=V8x8DApu9Qfqy2hLDU/WXB9TW5zzZBUyfzqvw0iKYhi4pGAGwgMN3VlQUsacELq+qz sv1n/1lmJWMn/7JHzWNEIr8CSKmea6P+zYKbBFRquAAeepAdvdAB0b67agG6jEu5Ijvk EPpLhO9tH9EiB1sPqHYmhK3MIjLMII8I6LGE5eGB4fuXhfbUHZdj99AtPk0Y5bOYsudw kx0VKKN89M9/kr+v/w0Yg5ZTvUGGwId5JZCHA8jFs62x7E1LHQXJPmwEaLNMFC0G1qQW XxnpWkH/0yGvwZJXrDFK0K0RET5pfcJoY9K+Mwm4nYJmnTizKDoETCN/IPxrfJNEag/S Lo3Q== 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=q/aMoAwe7SA6xsIkX4v+i1irvmyeYHcCvItJ2S1L+j0=; b=1KiIbvYQywHWN5+TG2oHiDi/vjlmQ/qVBvAa840JVfqIsZ1FrIS+G0LN5N3ttYIDLt hD8pO2ZRqVJOBTujh02zNAECaTHrVAcauxejiWHkm11vvb/rTNwbrKV8xS/TmLNPhlYR FxdUjoM3JfbZIdfLalIB6eEedbNBCC7LNcd4g9KH4h/+vJW+HGOpp8Hi7vSi+5YKSb01 5Dd8Pp2kl1cDnmjvZQLLw7z1s3oHsFyuaF6+GA4hswKcPtatfBh1b6DhnNrOvVqR7SH2 PK+MXJZNSVDrg/AetW7snBbxKnpbhacp6QMTCwWU2MoDmchpuWURY4hBPwTMz25GYk6S b50g== X-Gm-Message-State: AOAM5318HkKOuP8GI4CCeuvBO0zOcogshN61OlspzOoo8o0sn6T1z04b 2S4M2VjbWBq6Y1thQCaJQEhOo8QkPxbgog== X-Received: by 2002:a17:90a:778c:b0:1df:56a5:8474 with SMTP id v12-20020a17090a778c00b001df56a58474mr1819327pjk.63.1653559730900; Thu, 26 May 2022 03:08:50 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id x1-20020a633101000000b003f60a8d7dadsm1141288pgx.15.2022.05.26.03.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 03:08:50 -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 v2 1/2] bootmenu: use utf-8 for menu title Date: Thu, 26 May 2022 19:09:37 +0900 Message-Id: <20220526100938.9558-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220526100938.9558-1-masahisa.kojima@linaro.org> References: <20220526100938.9558-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 --- (no change since v1) cmd/bootmenu.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c index 8859eebea5..bf88c2127b 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,7 +170,7 @@ static int prepare_bootmenu_entry(struct bootmenu_data *menu, struct bootmenu_entry *iter = *current; while ((option = bootmenu_getoption(i))) { - u16 *buf; + char *buf; sep = strchr(option, '='); if (!sep) { @@ -183,13 +183,13 @@ static int prepare_bootmenu_entry(struct bootmenu_data *menu, return -ENOMEM; len = sep-option; - buf = calloc(1, (len + 1) * sizeof(u16)); + 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); @@ -227,6 +227,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 +280,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 +320,7 @@ static int prepare_uefi_bootorder_entry(struct bootmenu_data *menu, return 1; } +#endif static struct bootmenu_data *bootmenu_create(int delay) { @@ -341,13 +347,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 +363,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 +467,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 +523,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 +567,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 Thu May 26 10:09:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 576240 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:c603:0:0:0:0 with SMTP id jv3csp426938mab; Thu, 26 May 2022 03:09:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKpqR8ph/lW51ZZJ1JZgIvMZ7BG7iB+9x0DHUAIKoaPAeubu0oAYJjwg3UKEACmu2HnAhJ X-Received: by 2002:a6b:f411:0:b0:657:b73f:8e97 with SMTP id i17-20020a6bf411000000b00657b73f8e97mr16669422iog.68.1653559764399; Thu, 26 May 2022 03:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653559764; cv=none; d=google.com; s=arc-20160816; b=r1ZlNzb+Tek/Oy13HfO5mDt2vkd01rNNwNLeNuLBTwtnsjUJMkG1O+G+gJDL/vvN1x +JEdEygGnSW1x/rWOe0ZqsiJh1ZkqfeDmiwbMyD1Fwco7hLNp+3zpAE5wQUA4Zg3DxLx NRczou5UnLARvzLLjrP/RtSilOke59JjlCyKM2hQIwtQ2FU4wFmULqxH4VZr5H+SfZ2W 6OZE2JTxn0HdZKd5y10yvHjIzVi32E4WCFlzFnWMgmXqCKUoOAqcV/K8yRPwdP+jYRTp PTCNCH5JVCHsIh7PDtfXPcRfhJFZMXhpbQqx4QTxfi7mt3OcOlPBbwdXDYzFvwMOJmYG y4iQ== 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=ZLEzKhsBGb5Podq64qeZzhC1g7TzIsyOW/0ERkfIogc=; b=fGT836VGMHq1lnE8LsJOWR6LZKR7gz3E282901f8ndvX/hx6mIeEp4CRVpRKLqdLef 5ANqIozFd270IIH2QzcCOhYgFdXytcdeJxxK1A1VA11VLC4f1gVUN0Ox72roL2S8hUNz +40XULr2zrsPq3wemLPy4YaAnW8isN58knF1OLLWgdAfLEvJZ6oQwsXWghjO9IjoNoEu dtqwdyixuEvwpGDXDf+8QHiaCavMbMbvhW7IdxmOFnnJdjJQ6vORpFkS8Wu3dMWEFq+d 3aTi7l538lgtj28znu+huKaJdTnpe8lG/LoY+2EeqZYCdOXmLcaRahF6aZe54LoMPcQX I0zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v2AOyluC; 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 g7-20020a056e02198700b002ca4e59f9eesi1113249ilf.161.2022.05.26.03.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 03:09:24 -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=v2AOyluC; 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 194CF8432D; Thu, 26 May 2022 12:09:15 +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="v2AOyluC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B8C384340; Thu, 26 May 2022 12:09:00 +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-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) (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 83FCF842FC for ; Thu, 26 May 2022 12:08:56 +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-pg1-x530.google.com with SMTP id r71so1028192pgr.0 for ; Thu, 26 May 2022 03:08:56 -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=ZLEzKhsBGb5Podq64qeZzhC1g7TzIsyOW/0ERkfIogc=; b=v2AOyluC7Kmtv1fwfMvBQBXExiPQm9Qgo2dA8MyidlrtVAhKqUxY7HrNaTJLQKV3Nt npbVQHgzAH5lTtVVIMel/sWv3l1vxz8gaP1AxFn/6FDeMLBKimyKDI+TXeCDgwziyFs+ vVZGqkj/ihGUCxoKbW7xp7gfiSmlhAF3vPFJrz1nfYLDHuMVALo0Hiqky9BhiLv8GuAr t3c0b7tVp49kBboxLODJ+rvlv8x//DIIWrsQ5+AQtXWP3LZ8g+dNEtx9q5zL1omtPznv R/0UvvPnyk4IW8YIPPvN94W0XYFpd2xOL45+o8t3D6ichJHW5ZBqlUWVqoAiGHoZ3c/K 9/qA== 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=ZLEzKhsBGb5Podq64qeZzhC1g7TzIsyOW/0ERkfIogc=; b=22K4FDkToDBdrRmZVDplhkqTiBYNkI1e1EgA21PE1iqgqcve55g1MXfZd+dBCiMIDA 7qYjNvvg4UZo7HpubUmttfp5K4Ila2poVq/X02NDKwxidmPFy0b8oT4UuNMpZgTvr0KA V+uluIvzxSGe4IISklnaITCdvrJ9sn6GSnbp8H0zY76iytiuhHtiBm/cXSHKWniVyT38 fMPybPbyDPyrCGcn5CuYb3XwImoACJkxMDGIu45YuP9KR8gutqin+AN5Yerspcdutj9a 0CRj5coZfdc8B/LL2iBh+vbk+e/Fi93ndzxqPDllXjZgLNbvHBFh2l2QDI+o/eIylMBR ZJBQ== X-Gm-Message-State: AOAM533twMBLeHLgdRmDgDeCZFTOB3EVn7QZ1sDtQcYPdhTYc8iuiY8L P90XshRHFXPTwGIGSxWntqXDz4Wt3ljWdQ== X-Received: by 2002:a63:8148:0:b0:3fa:cefb:70c2 with SMTP id t69-20020a638148000000b003facefb70c2mr8081197pgd.123.1653559734692; Thu, 26 May 2022 03:08:54 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id x1-20020a633101000000b003f60a8d7dadsm1141288pgx.15.2022.05.26.03.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 03:08:54 -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 v2 2/2] bootmenu: U-Boot console is enabled as default Date: Thu, 26 May 2022 19:09:38 +0900 Message-Id: <20220526100938.9558-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220526100938.9558-1-masahisa.kojima@linaro.org> References: <20220526100938.9558-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 --- 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 bf88c2127b..1002c6b20a 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c @@ -362,7 +362,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"); @@ -595,7 +595,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))