From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6272FC433EF for ; Tue, 9 Nov 2021 09:50:50 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9515F6128B for ; Tue, 9 Nov 2021 09:50:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9515F6128B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 882808355A; Tue, 9 Nov 2021 10:50:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com 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=canonical.com header.i=@canonical.com header.b="YQxmSLcN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0CE4283670; Tue, 9 Nov 2021 10:50:46 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1CE47834F2 for ; Tue, 9 Nov 2021 10:50:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id EC8FA3F1B2 for ; Tue, 9 Nov 2021 09:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1636451439; bh=OAnka/zes75RpMtb3BUPuDGOm1C5sIMZ2wNR8ks2lyE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YQxmSLcNC1km6irPkI8csHufoyf14nwW07bSn75lJ2l2HgCytRDitlz9gDXehbL6y MJEhKeLQh3JVqdSZeRvZzbgLKwDySSIqQf5CFOQHf6EtnAcD1+iSFdtke0Eq5Fu6WD duvd0JkLK9dot/Qo6f1Dwv6wxlNYG5vCnSQfC8g+6mBUjFnLYHu5rvVXhZWKVx2UaK Y2upovqK/reX0FJT20QpfScVOWn9x1fbOJyK/VHdqGgDXBDYi3grdX1eiAQsK2Mezo SWYVBAXP/LFtAVgHikczNIhB106c0WaQ/7lRQRMz/KaLfUtnfFrp2J/qLKOSrHnXm7 h6HWmtkc4Z88g== Received: by mail-wr1-f72.google.com with SMTP id p17-20020adff211000000b0017b902a7701so4673543wro.19 for ; Tue, 09 Nov 2021 01:50:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=OAnka/zes75RpMtb3BUPuDGOm1C5sIMZ2wNR8ks2lyE=; b=yVYMiaSOoYZPVGwGKk2nAUipusRoy05NCVEfG4QcnqI2XcRJdiEtrU0x8c7AiYVb51 5pV8MQ9RjwxRKXjXi9Cpd2C9bcNgaZhNWvaEiBcto9FILclJrRShwZNwEbLV7fwiiTZR qAyqbkYsuZ2wmQ7p6Z02Ke8HFISyw6k7VHybcAHwgE4BUSmbOfNUCpZhHOA4MBczm9kz peYtTU9uXXeeWh0NeZvJ7FsVdLH6QUWG0PhYxep0UX2Xv1F5hyAofa4ukTT4PLp/eeLt lh/oJmcmj1OaY430+up9MIhVdsmBSZpp7XMAbCPMfYd7/j6vntmuIbnCRqKYkwkli18B BNwQ== X-Gm-Message-State: AOAM533D5TeDld3Ei4S9U3lJrWQUowO8ZcrJ7bxynShKGnaqf5CtXI2V ebYTTUK2wQZvog68kqN0tI7Ljw2ee8FzaBuRJPFC6GiOEO647S+p3kwcDTPjf9r3zFCX/mIec9c +4iej6xXxlhzk1fxJr+2aQ9QLVI/PMTU= X-Received: by 2002:a1c:7201:: with SMTP id n1mr5678681wmc.176.1636451438703; Tue, 09 Nov 2021 01:50:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8wSDlUtiwKmOari4Vi96P/80RpgbVnI8/j2mgnlHABf84XhySVCqI8rg+Rbx2Dq0IPWfnBw== X-Received: by 2002:a1c:7201:: with SMTP id n1mr5678655wmc.176.1636451438451; Tue, 09 Nov 2021 01:50:38 -0800 (PST) Received: from [192.168.123.55] (ip-88-152-144-157.hsi03.unitymediagroup.de. [88.152.144.157]) by smtp.gmail.com with ESMTPSA id m2sm1990122wml.15.2021.11.09.01.50.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Nov 2021 01:50:38 -0800 (PST) Message-ID: Date: Tue, 9 Nov 2021 10:50:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Subject: Re: [RFC 3/3] cmd: efidebug: handle booting from removable media Content-Language: en-US To: AKASHI Takahiro , agraf@csgraf.de Cc: sjg@chromium.org, ilias.apalodimas@linaro.org, u-boot@lists.denx.de References: <20211109013233.72902-1-takahiro.akashi@linaro.org> <20211109013233.72902-4-takahiro.akashi@linaro.org> From: Heinrich Schuchardt In-Reply-To: <20211109013233.72902-4-takahiro.akashi@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On 11/9/21 02:32, AKASHI Takahiro wrote: > Support for booting from removable media is now added to UEFI boot > manager. Here we should modify efidebug command in order to define > a proper "BootXXXX" variable. > > With this patch applied, you will be able to specify the boot order, > usb and scsi: I guess for a removable device this should work even if the device is not present. But currently: => efidebug boot add -b 1000 USB_present usb 0:1 EFI/BOOT/BOOTARM.EFI => efidebug boot add -b 1000 USB_not_present usb 1:1 EFI/BOOT/BOOTARM.EFI Cannot create device path for "usb 1:1" A media device path like: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x1)/UsbClass(0x781,0x5571,0x0,0x0,0x0)/HD(1,MBR,0x0c449046,0x800,0x800) is not very helpful because the next device that you insert may have a different location of the ESP partition. I think you should store /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x1)/UsbClass(0x781,0x5571,0x0,0x0,0x0) and find the ESP on it at runtime. > => efidebug -b 1 SCSI scsi 0:1 > => efidebug boot dump > Boot0001: > attributes: A-- (0x00000001) > label: SCSI > file_path: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(0,0)/ > HD(1,GPT,0ed48d12-1b4c-4e08-b3ee-decf20428036,0x800,0xa000) > data: > 00000000: 00 00 > => efideubg -b 2 USB usb 0:1 efidebug Best regards Heinrich > => efidebug boot order 2 1 > => bootefi bootmgr > > Signed-off-by: AKASHI Takahiro > --- > cmd/efidebug.c | 46 ++++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 40 insertions(+), 6 deletions(-) > > diff --git a/cmd/efidebug.c b/cmd/efidebug.c > index a977ca9c72f5..aaf269cdf47d 100644 > --- a/cmd/efidebug.c > +++ b/cmd/efidebug.c > @@ -933,6 +933,29 @@ out: > return initrd_dp; > } > > +/** > + * count_arguments - count the number of arguments > + * @argc: Total number of arguments > + * @argv: Argument array > + * Return: Number of arguments > + * > + * Count the number of arguments for a given option, "-?" > + * Specifically if the first argument is not "-?", return 0; > + */ > +static int count_arguments(int argc, char *const argv[]) > +{ > + int i; > + > + if (argv[0][0] != '-') > + return 0; > + > + for (i = 1; i < argc; i++) > + if (argv[i][0] == '-') > + break; > + > + return i; > +} > + > /** > * do_efi_boot_add() - set UEFI load option > * > @@ -945,7 +968,7 @@ out: > * > * Implement efidebug "boot add" sub-command. Create or change UEFI load option. > * > - * efidebug boot add -b