From patchwork Fri Apr 19 09:45:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 790191 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp976189wrm; Fri, 19 Apr 2024 02:45:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXnG6X6F8qVNpyF9uwbSQ+c0GQ/k5kbymmy6Dol/QERl5jY/mYLotBhqEUXHezmjELOVEn+z7FWC8cq6++3gIdP X-Google-Smtp-Source: AGHT+IHyMtwHORDgnPdhOQ6cKm777FNWZL3hwUWYTV6RzkonkOpn9JhefzhVO6wGN0RXojTlmoj5 X-Received: by 2002:a50:871d:0:b0:56c:5a12:ac53 with SMTP id i29-20020a50871d000000b0056c5a12ac53mr1154190edb.24.1713519955243; Fri, 19 Apr 2024 02:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713519955; cv=none; d=google.com; s=arc-20160816; b=XcpGskGulEBdB03vfSfH4ncMlctRUXyeHOZDRs0uC2o5e2xB7dxhFApkdW2F+4bsjZ zmXIWZJMA+cYznUH2KYL5o4LlOwkT5/kgvyLxoTUeHWJLlklkacqrebthyuCjKli/J+/ 4A/QI8GbkGldieu7fQNaQqZdhMPZf7hb2Z8FQ93ZkU1g/GG+W5TMuaCkFudC8ZmvgRcp gOFXqpqJGSVvzr1Thgnq5alflb/1kLQGosWPQVkgi4xmY9Ml/XHsmZ/1OZlJDM9cEXKB D+RUzZvMjG8+tJpnMMbEHb0wZV1mCXc+uZzpxzMnphT8a1ESB4FtgzzdtPBa//n0sQYn RRKg== 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:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=HVklAy+qSzBO559pr/KsbRMAwulsSpReQFNUPaUCM0g=; fh=wmZ2kyy1+peOOdVy0ts5Y4yinxAjJDEI3zkLWh06zKM=; b=nMBNLQdC4wwHHsKhmZ3XIh+7DHo/sQ8BeEcOTN6L6N9Qz0/B5lyAxKYKOo2PzIgYIo t8NayUqY/b28GYhndMuiUG3eOLkQk9v4PLs+rJx59VltF3oIiS9IKGB6L+Mh/ybtNPAU NXKyj13kcF7esm45gsYIS/K21NQsn9X4gRadbeBgdO6vMmJC0m53/zTI+VfryNylgZcP A4K5x+cpFyYage/dGqeaozteNGg9NPRWVN6SPGKCvJY4vZzhjMFUAgyHbw6J0Wru6rPY CuWaNmP8OgFelb78BIOPBs62e2w+UeW608q/ZBxCqW/DpuhyZky/EGxHTIlgfcB5NPSH 2Akg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b+EtGyi6; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id r4-20020a50d684000000b0056e861a30dasi1851539edi.187.2024.04.19.02.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:45:55 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b+EtGyi6; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 0C528886E7; Fri, 19 Apr 2024 11:45:54 +0200 (CEST) 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="b+EtGyi6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D323886F3; Fri, 19 Apr 2024 11:45:52 +0200 (CEST) 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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 83C3D886CC for ; Fri, 19 Apr 2024 11:45:50 +0200 (CEST) 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-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-571bddd74c1so1510858a12.0 for ; Fri, 19 Apr 2024 02:45:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713519950; x=1714124750; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=HVklAy+qSzBO559pr/KsbRMAwulsSpReQFNUPaUCM0g=; b=b+EtGyi6p1hzFtWTdepGfeyIQS7uty35MqP4wxHrSCX0y3Nw6Q3veAgHFJ2/6W4ZXe c1FdQDatWyu+3s85iJTapPDUu3bee4/W/tnqZBQYtdG7sVsqJJDUb+Szsc5Wn46SQRDZ WELIov7L9bNmFUyLDeSyYY1JyGEpVdxDQ20pelTejD5xNBJnLptH7hwdHYvzvixKB3IF Ei0pEFUOjZ+CtT+yVsZSMG2uq1rKUnBPjjD3eVm8K+iSi2ku44818DgIuO8NaTW9IpnP ISJq77ggAeTCCQ7huymItq3rI/qgDVdxTFHQ3EEd5he0TrYLLtSUYl4xylzjypaA5XA8 9SYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713519950; x=1714124750; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HVklAy+qSzBO559pr/KsbRMAwulsSpReQFNUPaUCM0g=; b=u5NggeAbQhYd7qMik3tj64dpbZAtqhJKHxM/1wIU4LWI0pdNhjH50/U3q53betxl0H zn+u/umOJFCxpYQj4nEIPU0H9rwHl9yYLBgLgsbomgG4Vu9uiy+9q4B9VMOamEC+hnLC 4JyUpkxFRsvgKI2IGDh/GL1kB0CpcQfp/UNtZ3yY0mqVsIwAULo8QBNwWHeXpFHljTA8 00+7Ws6YhvbFZ9TPDEw78K+QKP3U/QJy7ZRJusf83VV5MwAhBCGXgG1fSF+TsfROe4Ae Tz+EyV0H2QBJggheUpG+wHw1Rvge03JYxzTz1+PlKmwu2/dEgSHGzl+rymxg3/GjWJ9D CVMw== X-Forwarded-Encrypted: i=1; AJvYcCXdafiPjp8aOTp44C4klenW4qmgNSElpv7LL3IfRFN0sW8xpbC32CyyVX0u2nJXbMXewuH9Z2quZOidsBTGG+llb8cbsQ== X-Gm-Message-State: AOJu0YxkoC/uuwLa8wGt/sXlKzPuLznMO7x8CNrvTLlladoKOMjFzr/P UuJJLMaEqOH3qoi/pr/bpLx1Pjar0MPIpVY2zEt88IsyZYF3wDo5+llptzpqm0c= X-Received: by 2002:a17:907:11db:b0:a55:63de:9aa9 with SMTP id va27-20020a17090711db00b00a5563de9aa9mr991747ejb.49.1713519950023; Fri, 19 Apr 2024 02:45:50 -0700 (PDT) Received: from localhost.localdomain (ppp176092141112.access.hol.gr. [176.92.141.112]) by smtp.gmail.com with ESMTPSA id v22-20020a1709064e9600b00a55865b2760sm587299eju.30.2024.04.19.02.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 02:45:49 -0700 (PDT) From: Ilias Apalodimas To: heinrich.schuchardt@canonical.com Cc: Ilias Apalodimas , Heinrich Schuchardt , Tom Rini , Simon Glass , Weizhao Ouyang , u-boot@lists.denx.de Subject: [PATCH v2] efi_loader: change the error message when storing EFI variables Date: Fri, 19 Apr 2024 12:45:45 +0300 Message-ID: <20240419094546.12653-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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 When we try to store EFI variables on a file, we need to use an ESP. if an ESP is not found, variables will change in memory, but U-Boot won't be able to restore them across reboots. Adjust the error message so users can understand what's going on Signed-off-by: Ilias Apalodimas --- Changes since v1: - print different messages if ESP is missing or write to file failed lib/efi_loader/efi_var_file.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.43.0 diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c index 413e1794e88c..d5d347d50f8d 100644 --- a/lib/efi_loader/efi_var_file.c +++ b/lib/efi_loader/efi_var_file.c @@ -73,16 +73,20 @@ efi_status_t efi_var_to_file(void) goto error; ret = efi_set_blk_dev_to_system_partition(); - if (ret != EFI_SUCCESS) + if (ret != EFI_SUCCESS) { + log_err("ESP not found."); goto error; + } r = fs_write(EFI_VAR_FILE_NAME, map_to_sysmem(buf), 0, len, &actlen); - if (r || len != actlen) + if (r || len != actlen) { + log_err("Failed to store variables."); ret = EFI_DEVICE_ERROR; + } error: if (ret != EFI_SUCCESS) - log_err("Failed to persist EFI variables\n"); + log_err(" UEFI variables won't persist reboot\n"); free(buf); return ret; #else