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 A15F4C004D4 for ; Thu, 19 Jan 2023 12:53:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B64E85601; Thu, 19 Jan 2023 13:53:08 +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="V66Am28A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7087F85660; Thu, 19 Jan 2023 13:53:05 +0100 (CET) Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (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 93C2B8564A for ; Thu, 19 Jan 2023 13:53:02 +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-ej1-x635.google.com with SMTP id vw16so5339039ejc.12 for ; Thu, 19 Jan 2023 04:53:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wB4srKnaejkmh8xxJaUg6ZArPEn1c203+IxBjIwBShU=; b=V66Am28AF5iveQMKUokWVxV1N09FUjmqcUjrUfzlQ2FydSd5xKw2+DmPTiXjdK7yIH Z/Bt589/Go64O9yhUO2AOfoDAyy+JAma1G+jMFc9TqFyUBsYwohCk825GKnvv/lYhzpO a2GG2DWsmK/QwWQqcKevFNTzg7p9M0nUWV34Tvz4dWrdHbVWJt+Q715ZX/tS/WUNif9I 2wGXOmGDzGGift2kf8pQEUJDfhF/BxWgjVR7ig5JTs7hWvazNjep5N68HxDkVxCGJjS/ K0lg3mkVm7WHl7S9urH4ZF4KkE5aP57qpEI0N7T/PiiDCAjyLUehy9gvXC1/SGwx3pKA QDGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wB4srKnaejkmh8xxJaUg6ZArPEn1c203+IxBjIwBShU=; b=C4DjhdELgpqKQjhU0ijW9XRyCerhxo4aidWt0vLgF7sqEoPuIE3Sph94qSd1F7wacx dMA7hvGuB+bjH7jnb5RnTtMWMko/d+trK7GZC6a6hKT6NyCsNbvoB6AR5rZwoPS0PT5W MTlg2uWM8hJ3TmA1deOUsdALNlVQtMVhYdmlRHqCk6dT0Dha/567xOxpfLWeV67vh/cG 25u7Puv1eXeXgKKDodf5SwqkmGj3vLdiYpCO26qYxuJLe1rDghTD0hHqGzSMhSYEJRcQ c7TnN5yW5/AJuCZg9/5mvgNj4YjQ8ID0FwFmc8oGLn2SVJ730TE0STQV2SpFNm/zbELw ahOw== X-Gm-Message-State: AFqh2krU5C2vePznnwuaWZFRsYQ1rbNeId1S/9BgWUDrtEARupJzVRGQ vd3wNyKbS3MmsgVXaK88F8qtkQ== X-Google-Smtp-Source: AMrXdXt1FeDN3w6JK3Bq7XkU3ZNyXl9Pl2ylX14Q88QRL4mOqPKLGBmopTyM7o+GggR38cl11qv2zg== X-Received: by 2002:a17:906:aec2:b0:7b2:7a42:3e43 with SMTP id me2-20020a170906aec200b007b27a423e43mr10909347ejb.23.1674132782216; Thu, 19 Jan 2023 04:53:02 -0800 (PST) Received: from hera (ppp079167090036.access.hol.gr. [79.167.90.36]) by smtp.gmail.com with ESMTPSA id g22-20020a170906595600b0087221268e49sm4426540ejr.186.2023.01.19.04.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 04:53:01 -0800 (PST) Date: Thu, 19 Jan 2023 14:52:59 +0200 From: Ilias Apalodimas To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Etienne Carriere Subject: Re: [PATCH] efi_loader: silence 'Failed to load EFI variables' if the file is missing Message-ID: References: <20230118161208.3919684-1-ilias.apalodimas@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.6 at phobos.denx.de X-Virus-Status: Clean Hi Heinrich, On Thu, Jan 19, 2023 at 01:42:20PM +0100, Heinrich Schuchardt wrote: > On 1/19/23 12:45, Ilias Apalodimas wrote: > > Hi Etienne, > > > > On Thu, 19 Jan 2023 at 13:17, Etienne Carriere > > wrote: > > > > > > On Wed, 18 Jan 2023 at 17:12, Ilias Apalodimas > > > wrote: > > > > > > > > When we try to load EFI variables from a file in the ESP partition and the > > > > file is missing We print a scary error looking like > > > > => printenv -e > > > > ** Unable to read file ubootefi.var ** > > This message is in line fs/fat/fat.c:1297: > printf("** Unable to read file %s **\n", filename); > > The message is misplaced. If any message is written, it should be in > fat_read_at(). > > But I think fat_read_at() should also be quiet. It is the task of the > calling application to shout out if a file cannot be read. > > I have not checked if a test in test/py/tests/test_fs/ relies on the > error message. > > > > > Failed to load EFI variables > > If there is a writable ESP, file ubootefi.var is created on first boot. Are you sure? I think it's created the moment you create an EFI variable. So on a board that uses preseeded files you'll always see the message. Thanks /Ilias > So this message should only once in the lifecycle of the board. > > Afterwards this message indicates that something is really wrong. > > If board vendors doesn't like it, they can create a dummy file. > > Best regards > > Heinrich > > > > > > > > > This is not an error though since the file wasn't there to begin with. > > > > So silence the warning by aborting the load if the file is not there, > > > > instead of failing the load. > > > > > > > > Signed-off-by: Ilias Apalodimas > > > > --- > > > > lib/efi_loader/efi_var_file.c | 6 ++++++ > > > > 1 file changed, 6 insertions(+) > > > > > > > > diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c > > > > index 62e071bd8341..7d7141473634 100644 > > > > --- a/lib/efi_loader/efi_var_file.c > > > > +++ b/lib/efi_loader/efi_var_file.c > > > > @@ -223,6 +223,12 @@ efi_status_t efi_var_from_file(void) > > > > return EFI_OUT_OF_RESOURCES; > > > > } > > > > > > > > + ret = efi_set_blk_dev_to_system_partition(); > > > > + if (ret != EFI_SUCCESS) > > > > + goto error; > > > > + if (!fs_exists(EFI_VAR_FILE_NAME)) > > > > + goto error; > > > > + > > > > ret = efi_set_blk_dev_to_system_partition(); > > > > if (ret != EFI_SUCCESS) > > > > goto error; > > > > > > This later call to efi_set_blk_dev_to_system_partition() can be > > > removed since already done above. > > > > > > > iirc fs_exists() unconditionally calls fs_close() so we need that double call > > > > Cheers > > /Ilias > > > Etienne > > > > > > > -- > > > > 2.38.1 > > > > >