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 36ECBC7EE23 for ; Fri, 26 May 2023 06:25:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9CBA782027; Fri, 26 May 2023 08:25:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de 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; secure) header.d=gmx.de header.i=xypron.glpk@gmx.de header.b="fq0tFa/B"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 05D55846F5; Fri, 26 May 2023 08:25:32 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (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 DBB85815D4 for ; Fri, 26 May 2023 08:25:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1685082326; i=xypron.glpk@gmx.de; bh=96J0uVsVrRGR61P6yKiZci7Etss07vwSOXi4R4i2LUM=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=fq0tFa/BAwPBqaqn0rl/GZQRBJlx6zFqIXSfuJgnYKDtCyNWSLNx+luTBAjvb1UFq vdjSn4TCu07rot2UiTsW/PSqJr5IJG8ataY26eNDKPMCZJIZIimc/Rkq6bwi4SC1bQ /8OmZzCaQ60BLFzGslwQb/iYpOAJV8UcVWW+O8pVjZYnag5VdBPSxos5ykfXKlf4uL hBUnooCQHLfsRnAj+Wv/7ZoMqy6fip7fA60KN9K9aYDbzSf8CcJfk4yzeNRv+PRW7u bGhhLSjR3c2gMHN3HTMfsM5QEEaSRw/Kquyr2yppFDgFyKP60gyA9LxFWqk5jGjkSV e0Po7o4aYKxRA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.123.94] ([88.152.145.137]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MK3Rs-1pod6B3MXG-00LRqd; Fri, 26 May 2023 08:25:25 +0200 Message-ID: <7a7d90d5-c417-ac60-cdb3-3bb0b378423b@gmx.de> Date: Fri, 26 May 2023 08:25:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH v4 3/3] Load option with short device path for boot vars To: Raymond Mao Cc: u-boot@lists.denx.de, Simon Glass , Masahisa Kojima , Ilias Apalodimas References: <20230523191819.80258-1-raymond.mao@linaro.org> <20230523191819.80258-3-raymond.mao@linaro.org> Content-Language: en-US From: Heinrich Schuchardt In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:OXt1SDK8wMUqzXFvtwmhIlT3F5qE6lwlb0McVksag2fs8dWyLKx mJq8RufHPRJAO6unRpDWER66iiXk3pd7x5KvJNz/f9erO6ryynfEvIH62k4abnTwMT+EbzB u9sVGv3kI0UKUPTEPNBvAqyCiYRI96AcR8JymQGLKXDBNxT08FK/xjWIrdlEe/EC18nDGZ0 Ugm06XaBh7136Eos9d7mw== UI-OutboundReport: notjunk:1;M01:P0:tZV/b/aFajQ=;YqN3I4BBFBROEk9VPXi3+LRyrIO LOe+W1SEKeMDQzd2bi/NNd/cK7wnr0w/czQNuQX0E7WaaxskGZwf1CeyTcR7D1Br4VvgiyRXk c8Yjj435BOmMMD6EnlMYEkPSrbNkhMZapcYIUfiDd/50XkEXPrPyQUWX7xK1ULwUMYVyzOIlA u612+0tRp/JeBnvAGVwjIG+iyHWLg39EZXMYzK86yXWH2cCKFs5dRPZF8OkkTT1O4A4mY8ErD sW0QCkytL/yClGvWPUFuP7lLlX7vt2XRgrozKSBGlKzf2X/4TdjrbdSwa9VsQYebGqYLI+OG5 OANjbu+eGgPMWCh7XVU3uk/a+5tdVH+n0DVVq8sWWCDUUfTSKAjpG5VGYcua1xPytLQON5yO4 F85uTubNfbvxUI0WDsHE3p6cL4EWNiIIkNvE816nx9042B5KkawJU8gAiLVURPLt92yOMpEn2 QQHClgP4W9l3qvUtPh0ZKQcQklCPWSiNLANOpczjx8q5fbIs9T8fn/vIt+j8raxcVvD6DHr4C 20SGtjYPRJ8o5WaFbcN0WCkh2kvTc3EOKN7oQ/PB5qXvMYLjOhIi3Mdsjx/ea93afnWdu+4t7 p4W9M6UHVVxkRM5TEOin8dL2umD4GkFQg0wtxBvy6uNqv/EHftc4hjI6/42HzcxAJK4Wn2dKr IzP3beHtpZHA9fqp8vt2MEhMNWvbmsT0b0VIlyHUF0GVcfuE6YUeoUYOsRvwSthOgeTFriywK vmCj97xhNvjlqwa4qJCc28zozyK3rLqB8zjvmhMNuB3qlZGwoRpZFuB+PFEHw1lz4/I8TesGJ EQ6VWfb0FOxJmbxOFyorgtJsv9NyiBd/lpN1dpztAooV+3BBWwc1f42JkqfFp7hBe7nISE6d5 y6Q59Q3eYAxeNCQZXso3xa34NpuQ7bQUp2m52h7uXUAosF/M1/YK3WE7W1bDO65A+elFgDN9c WCmbvhTEP7u+QP+0BCbcZZkW+1c= 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.8 at phobos.denx.de X-Virus-Status: Clean On 5/25/23 09:12, Ilias Apalodimas wrote: > Hi Raymond, > > On Tue, May 23, 2023 at 12:18:22PM -0700, Raymond Mao wrote: >> The boot variables automatically generated for removable medias >> should be with short form of device path without device nodes. >> This is a requirement for the case that a removable media is >> plugged into a different port but is still able to work with the >> existing boot variables. >> >> Signed-off-by: Raymond Mao >> --- >> Changes in v2 >> - Ignore EFI_NOT_FOUND returned from >> efi_bootmgr_update_media_device_boot_option which means no boot >> options scanned. >> Changes in v3 >> - Split the patch into moving and renaming functions and >> individual patches for each changed functionality >> Changes in v4 >> - Revert the change of introducing a bool parameter when updating >> the boot option. Use short-form of device path by default >> >> lib/efi_loader/efi_bootmgr.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.= c >> index c329428973..336b9d2d8f 100644 >> --- a/lib/efi_loader/efi_bootmgr.c >> +++ b/lib/efi_loader/efi_bootmgr.c >> @@ -387,6 +387,11 @@ static efi_status_t efi_bootmgr_enumerate_boot_opt= ion(struct eficonfig_media_boo >> p =3D dev_name; >> utf8_utf16_strncpy(&p, buf, strlen(buf)); At this point of the code device_path contains the device-path of a device with a simple file protocol. >> >> + /* use short form device path */ >> + device_path =3D efi_dp_shorten(device_path); >> + if (!device_path) > > One nit here. I think we should print a warning if shortening the path > fails. Heinrich are you ok with this? I think not falling back and add= ing > the long form DP is fine. efi_dp_shorten() returns NULL if the device-path contains neither of - a USB WWI node - a hard drive node, HD() - a file path node Why should we skip a device with a simple file protocol here if it does not contain one of the above nodes? Best regards Heinrich > > Thanks > /Ilias >> + continue; >> + >> lo.label =3D dev_name; >> lo.attributes =3D LOAD_OPTION_ACTIVE; >> lo.file_path =3D device_path; >> -- >> 2.25.1 >>