From patchwork Thu Mar 24 13:54:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 553911 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp4437729mag; Thu, 24 Mar 2022 06:54:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyg8Y1+0bh85SHpHaitcOTSnsiWfhbad+IHuAA/t0oV5yrEm8xOLBb0bEqJQwRLO/w6RQ75 X-Received: by 2002:a05:6402:27d0:b0:419:5184:58ae with SMTP id c16-20020a05640227d000b00419518458aemr7050707ede.314.1648130088231; Thu, 24 Mar 2022 06:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648130088; cv=none; d=google.com; s=arc-20160816; b=IHY/L8JoxPOuowj9NMaPTuvsUVI/nnHV0wbW5cwpkmEDoi2Co8N30s8HwuklNCNEsV uAnIXrzPMbFPjq5rITwpEar6fYiauxlXS8O7qmaKX5l5xdmnxuoln+VyxKiINAkhROof CaZebk2M9OiFlAqkswA/Zn6UyRgu1hWaxLiw1IHv4+Sw0lF32vFiOhNU4gscSxlhwHXZ M0Aqc45Gh0HqTXzXDw8EeDOwPjZQDigumENMI/xF139/14dOvFFwDpmoJDbVqd4loAJa TGB9wqrwjHNOMG8HxHEHA1pQNQX97I4kfBOsmDmZ7YtuMK5ZVXLiFvEAdPVqJGfFWRAD Ntqg== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=geKcZ+1l9R6HlapMNZf4x0spFLyCKMY+fQz11/4cI0o=; b=uE/FLJHfSyZLhuxkKt5AdZzpIDpHi03Si32OFSJHM8Uf8PniZYY/mpAaW9u72ZtsYC jKxNYSMEHPxvW5FXm9W3l0tmBxp0c/61tFnLXEKEUq/3RP6Gi3rCSFCOhV3e2VQnz2Dm Tk6H8zU5VWFLTa9eYCBBJMzl74Qmb5VOodaTemJ1a+njslF3xuMQKGVRl9ozwSwN8GLr /iO6sJQExyjYa3kYZaNlYHe5hBYtohMb6KOls5zv9NiW/PjT7+sPyDl1WNmTRKV6NvS8 GVezs/4Dn4b8bB4WGrV5vycGWtXSYtciMNk9BdqhNfdt/sQd0fKs6GUKHF99NZqVTKXH oVEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AMVOqfJ3; 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-20020a50f0cf000000b00418fd7af8fasi18830549edm.416.2022.03.24.06.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 06:54:48 -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=AMVOqfJ3; 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 428FC840AA; Thu, 24 Mar 2022 14:54:45 +0100 (CET) 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="AMVOqfJ3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 53853840AB; Thu, 24 Mar 2022 14:54:43 +0100 (CET) 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-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 9AF7E84091 for ; Thu, 24 Mar 2022 14:54:39 +0100 (CET) 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-x1036.google.com with SMTP id g9-20020a17090ace8900b001c7cce3c0aeso727088pju.2 for ; Thu, 24 Mar 2022 06:54:39 -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; bh=geKcZ+1l9R6HlapMNZf4x0spFLyCKMY+fQz11/4cI0o=; b=AMVOqfJ3VHJS3rgy8q4fIWsml6Hd13Wu0LQlnl80L+BVNOAFyGwNgX6Xd2NCSLccEA EH83DTgBFwaPWyE/6kKTxHeJ//SKIATg3H9rKn4CFiBujvldZ3pCGUdSXjVEMChrSp+Q cshsnlqcGO8aKQHEb0J45MFr9akYw4WvpLBzsDR+MxTjV1hfK/pdPG55hNgp+oL2GQ+c MO7x0Aj7v4wG8OhzfMEUhVBVIJmkXb8jIxVNWewNd1bCb91d/h9En1+1J5rRzIoCkrkD mk8UrpLLNhmqQb0OIStDCn9N3T9VUgdvBrnKUmGeIKAgGkIgkfxsIxysCqqwRPSQwY7N z3vg== 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; bh=geKcZ+1l9R6HlapMNZf4x0spFLyCKMY+fQz11/4cI0o=; b=oqqdTwvmLcp4LVL+IM4rIHGdqZdh66c0Mo7HbfAhgJ5dXw0cqF9PgoeFjHNG6J9MNK OtgnfbU0wWVfjk3P0pegf7k5voZO+TS0GBNQUUCFafpT6UUB+c2Ba7mTR0SLnp7VBlZZ AZI2zDQvmys0r6FCxPrBI30Pt85b2x81mtbITRV6Tn7MsUpetRBSTIrZ4eZkfMChSTUP txHS4IEDblW6fcFcBxjSCFLKPNNyCXbGEtU3FfuUGvt0jZupEr+BQ+UW2zH8WzDGsONQ QHrDhHhSX2n01E51/m1p1E5Q5i9o4zgz3xzefu7/rAN07Fe5zQ/+ZRkXSU0/BWCb3nQ3 DvRA== X-Gm-Message-State: AOAM531qfzwO1xNSqKeyqQPwU4LUPQyzuc2J9GnJIhKEsaFCrXu3nlIV jIKZp7MIvrdJ04cwH7Sjfk3YY9E587uwgA== X-Received: by 2002:a17:902:7207:b0:153:d860:5c8d with SMTP id ba7-20020a170902720700b00153d8605c8dmr5830881plb.40.1648130077839; Thu, 24 Mar 2022 06:54:37 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id p15-20020a056a000a0f00b004f7c63cba5asm3974609pfh.21.2022.03.24.06.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 06:54:37 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Francois Ozog , Mark Kettenis , Masahisa Kojima Subject: [PATCH v4 00/11] enable menu-driven boot device selection Date: Thu, 24 Mar 2022 22:54:32 +0900 Message-Id: <20220324135443.1571-1-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 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 This patch series adds the menu-driven boot device selection, by extending the existing "bootmenu" to include UEFI and distro_boot related entries, and supports menu-driven UEFI boot variable maintenance. This patch series also includes the removable media support that UEFI specification requires to support. The menu example is as follows. *** U-Boot Boot Menu *** bootmenu_00 : Boot 1. kernel bootmenu_01 : Boot 2. kernel bootmenu_02 : Reset board UEFI BOOT0000 : debian UEFI BOOT0001 : ubuntu UEFI BOOT0002 : mmc0:1 UEFI BOOT0003 : mmc0:2 UEFI BOOT0004 : nvme0:1 UEFI BOOT0005 : nvme0:2 UEFI BOOT0006 : usb0:2 UEFI BOOT0007 : usb1:1 UEFI BOOT0008 : usb1:2 distro_boot : usb0 distro_boot : scsi0 distro_boot : virtio0 distro_boot : dhcp Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit [Major changes from RFC v3] - add Kconfig option to disable U-Boot console - add UEFI boot variable maintenance feature - support removable media support and user selection - app bootmenu enhancement documentation [How to run on QEMU(arm64)] 1) clone source code $ git clone https://git.linaro.org/people/masahisa.kojima/u-boot.git \ -b kojima/bootmenu_v4_upstream_0324 --depth 1 2) prepare U-Boot .config $ make qemu_arm64_menuconfig then, enable CONFIG_CMD_BOOTMENU and CONFIG_AUTOBOOT_MENU_SHOW 3) run on QEMU(arm64) example $ qemu-system-aarch64 -machine virt,gic-version=3 -cpu cortex-a57 -m 4G -nographic \ -no-acpi -bios ./u-boot.bin -hda xxx.img AKASHI Takahiro (2): efi_loader: export efi_locate_device_handle() efi_loader: bootmgr: add booting from removable media Masahisa Kojima (9): bootmenu: fix menu API error handling lib/charset: add u16_strlcat() function test: unit test for u16_strlcat() menu: always show the menu regardless of the number or entry bootmenu: add UEFI and disto_boot entries bootmenu: factor out the user input handling efi_loader: add menu-driven UEFI Boot Variable maintenance bootmenu: add removable media entries doc:bootmenu: add UEFI boot variable and distro boot support cmd/Kconfig | 10 + cmd/bootmenu.c | 678 +++++++---- common/menu.c | 139 ++- doc/usage/bootmenu.rst | 65 ++ include/charset.h | 15 + include/config_distro_bootcmd.h | 14 +- include/efi_default_filename.h | 26 + include/efi_loader.h | 63 ++ include/menu.h | 20 + lib/charset.c | 21 + lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_bootmenu_maintenance.c | 1244 +++++++++++++++++++++ lib/efi_loader/efi_bootmgr.c | 50 +- lib/efi_loader/efi_boottime.c | 59 +- lib/efi_loader/efi_console.c | 81 ++ lib/efi_loader/efi_disk.c | 11 + lib/efi_loader/efi_file.c | 75 +- test/unicode_ut.c | 45 + 18 files changed, 2357 insertions(+), 260 deletions(-) create mode 100644 include/efi_default_filename.h create mode 100644 lib/efi_loader/efi_bootmenu_maintenance.c