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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E4C93C433F5 for ; Thu, 10 Mar 2022 06:37:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D4531839CA; Thu, 10 Mar 2022 07:36:57 +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="rjv01ucj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 782B6839CA; Thu, 10 Mar 2022 07:36:54 +0100 (CET) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 AB26F839CE for ; Thu, 10 Mar 2022 07:36:49 +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=ilias.apalodimas@linaro.org Received: by mail-wr1-x429.google.com with SMTP id r10so6378744wrp.3 for ; Wed, 09 Mar 2022 22:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=1/dx6Az2Z11YCiORAUXwZhb6zRBlNuRax41QOHwVZas=; b=rjv01ucjeDn+9gFsRcXJ6M7kuQj9CftMHWoaa8oq3JgorMnWi2ViNwEVkLB2lKrYI9 4a73+D65Kz1uYMjuXX3AOtxeeY2x+7zGtOSKTE8WQT69InEeKVmVJ0rTEClxQHm7l1D/ rbXAh7FwDtise3F7u8FlzylkhjNnlrDEyBqPbnXVpbxImrZKrpCz4lFNLf62k22kFNgw iaxyg+mRRLwfGQqp9Y3TflWwBa2EGkucWbBdauTKDZ7KgGYy/BS5XOLVsb2QMYSi/5C+ AakILAZI+vhtWGaFFp/i8HE9C6N7oYLUY5sQivUJtyRFMvfZAdUExzGAfuARliysNc+W 3C8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1/dx6Az2Z11YCiORAUXwZhb6zRBlNuRax41QOHwVZas=; b=o7fsNrwdDjOHVAm1O5tkSNquFciyzRlqkUPlG6uvE/9kTXp907bvC6DKS6t5wHcTrM nGwMuytztC+F49lxZ/oPNVauYXh42wHdMJjpR/gdocVNYVoFOkuWeqWmcjTXHqj2Y0Pv Nsl7uuJNEvBUJXNY1JMO3fdGKl9CbL4sxh+0WlXafDI8kdFDFtznL9A0ZQpuIZnto2h3 p/vNR0dK1u8GNWCd1iz4R3tOTUMUjsD2ZAJT/ooIytP+VvIthI8rX2V9uVJe2sZ/pjNo cocERZ/JvpXngbG1PJ0OdhqrU2GByUo1HkDonTN26YKRGWc1+UfOwLAv61pGSTJCfjju pBuA== X-Gm-Message-State: AOAM533cwFoTjrJu10yxuq8Wj6lZBrWYJpdur/0rUymB3XR0rF6xQph6 jXLxChHCQJqFeuhHle5oDVDLkw== X-Google-Smtp-Source: ABdhPJz6jEgwwKhfNSU/NlIdZShhnV8YH6Rg5Kloc7h8oZ1ovx9j8NWDUhU5guSXru75BwrBRThnnA== X-Received: by 2002:a5d:47a3:0:b0:203:8cc3:3647 with SMTP id 3-20020a5d47a3000000b002038cc33647mr338171wrb.321.1646894209194; Wed, 09 Mar 2022 22:36:49 -0800 (PST) Received: from hades (athedsl-4461682.home.otenet.gr. [94.71.4.98]) by smtp.gmail.com with ESMTPSA id p18-20020adfba92000000b001e4ae791663sm3457933wrg.62.2022.03.09.22.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 22:36:48 -0800 (PST) Date: Thu, 10 Mar 2022 08:36:46 +0200 From: Ilias Apalodimas To: Masahisa Kojima Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Takahiro Akashi , Francois Ozog , Mark Kettenis Subject: Re: [RFC PATCH v3 2/2] bootmenu: add UEFI and disto_boot entries Message-ID: References: <20220308140745.26180-1-masahisa.kojima@linaro.org> <20220308140745.26180-3-masahisa.kojima@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 [...] > > > + command = calloc(1, command_size); > > > + if (!command) { > > > + free(entry->title); > > > + free(load_option); > > > + free(entry); > > > + goto cleanup; > > > + } > > > + snprintf(command, command_size, "bootefi bootindex %X", bootorder[j]); > > > + entry->command = command; > > > + sprintf(entry->key, "%d", i); > > > + entry->num = i; > > > + entry->menu = menu; > > > + entry->type = BOOT_TYPE_UEFI; > > > + entry->bootorder = bootorder[j]; > > > + entry->next = NULL; > > > + > > > + if (!iter) > > > + menu->first = entry; > > > + else > > > + iter->next = entry; > > > + > > > + iter = entry; > > > + ++i; > > > + } > > > + > > > + if (i == MAX_COUNT - 1) > > > + break; > > > + } > > > + free(bootorder); > > > +} > > > + > > > +bootmgr: > > > > Why do we need an entire menu entry if the bootorder is not defined? > > Currently there's no logic in the efibootmgr to look for the standard > > filenames in the ESP (eg bootarm.efi, bootaa64.efi etc) if no boot option > > is defined. Instead this is implement in distro_bootcmd. > > In this version, newly added command "bootefi bootindex XXXX" is called > if the user selects one of the "Boot####" option, and "bootefi bootindex" > does not handle "BootNext". That's why I think the menu entry simply > call "bootefi bootmgr" is required. > Anyway, I will modify to set "BootNext" and call "bootefi bootmgr" if > the user selects a "Boot####" option. > > I think we need to consider the case that "BootNext" is already set > when bootmenu comes up. > In this case, bootmenu must automatically try to boot the load option > of "BootNext" without any user interaction. Good point. Especially if we fix setvariable at runtime for specific boards, capsuleupdates will need this > > > > > I was thinking of something along the lines of: > > 1. bootmenu comes up > > 2. We read all the Boot#### variables that are defined and add them on the > > menu > > 2a. If the user doesn't explicitly choose a boot option we run 'bootefi bootmgr' > > 2b. If the user does select a different option we set BootNext and still > > run 'bootefi bootmgr' > > 3. If there's not Boot#### option defined, we should in the future add the > > functionality of searching for bootaa64.efi etc in ESP and still just > > launch the efi bootmgr > > Thank you very much for summarizing. > I would like to update as follows. > > 1. bootmenu comes up > 2. If the BootNext is already defined, try to boot with BootNext > without showing bootmenu > 3. We read the BootOrder, then read Boot#### with the order specified > by BootOrder and add it on the menu (UEFI spec requires to honor the > priorities set in BootOrder variable) > 3a. If the user doesn't explicitly choose a boot option we run 'bootefi bootmgr' > 3b. If the user does select a different option we set BootNext and still > run 'bootefi bootmgr' > 4. If there's not Boot#### option defined, we should in the future add the > functionality of searching for bootaa64.efi etc in ESP and still just > launch the efi bootmgr > 4a. If "bootefi bootmgr" returns, run U-Boot "bootcmd" environment variable. > Yep, that looks correct > > > > > + /* Add UEFI Boot Manager entry if available */ > > > + if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { [...] > > > + free(entry); > > > + goto cleanup; > > > + } > > > > Any idea of how we'll tackle that? We could export the efibootmgr > > functions that deal with this and use them on the edit menu ? > > I guess you are referring the RFC patch[*1] I sent before? > If yes, yes I will reuse them. Yes > Or do you mean the "efidebug" command? > > [*1] https://lore.kernel.org/u-boot/20220225013257.15674-5-masahisa.kojima@linaro.org/ > > > > > > + > > > + sprintf(entry->key, "%d", i); > > > + > > > + entry->num = i; > > > + entry->menu = menu; > > > + entry->type = BOOT_TYPE_NONE; > > > + entry->next = NULL; > > > + > > > + if (!iter) > > > + menu->first = entry; > > > + else > > > + iter->next = entry; > > > + > > > + iter = entry; > > > + ++i; > > > } > > > > > > /* Add U-Boot console entry at the end */ > > > @@ -353,7 +602,7 @@ static struct bootmenu_data *bootmenu_create(int delay) > > > if (!entry) > > > goto cleanup; > > > > > > - entry->title = strdup("U-Boot console"); > > > + entry->title = u16_strdup(u"U-Boot console"); > > > > Can we add an option to prohibit the user from going back to the console? > > Yes, I will add this option. > [...] Thanks /Ilias