From patchwork Thu Mar 23 11:09:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 666125 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp619796wrt; Thu, 23 Mar 2023 04:09:38 -0700 (PDT) X-Google-Smtp-Source: AK7set/U+TlgLB5rMrLgseh9+FT6rxDOegKS1Qo4joX5vh0PWfdeb+jjSGzEhWhuyBTaHe1d2DjZ X-Received: by 2002:a5d:8f96:0:b0:750:a574:7c3c with SMTP id l22-20020a5d8f96000000b00750a5747c3cmr6968524iol.1.1679569778032; Thu, 23 Mar 2023 04:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679569778; cv=none; d=google.com; s=arc-20160816; b=cPgfwixZPZJxxWDyozTa2M4h3T/fJ0t4+phgkFNAAy/CCVynFtIT4tlAMJ106KDEVT TKfBgeiF4jaVIq4ZXyiRHGTAr4+QNDNznEKcGRkyuQSg9ibqkukjVx2bckm22u6fHIlH zJC2u8vtz7xgTLWqI6VW+eTT/Vl3oc+W7kb7FViJ2vxYC4PFxjm3uhMVbsXt7TCAdsk2 MS3eetNIoP0clBC/sJ2yk1cHTzleXqxu2rdJCIwjQgy6iwQ5it8P0/KUpfbH9+YwD7SD 9fstGAbDkxUXwZf8HylqmzGvmA6nKpjRj7NCoeUR9it+gz+K0KANlKIkuso2g7dopskU BDgw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=mjpg6IBO5UqGaX6hUHdtGiStu1jwmhMmzCthGQAtu3w=; b=ktJyiN9LvMVTrllnb4xb1OL8torGYAm5o/o7Lyb42x7fgzbelaVXsLXEjIS0owsZkI Yb5BY01YgD86pMh5xhdntM2zh+ki7uYc0Jwj+fGGOArSiKzwl2h+jK0fXt+dyR/zwbvZ gRpMz5NEZBoy0OS81wfPCGMKY5cnDcmO3GEyeFq3uFSEdtBR3AFN8MrV2xwUY+e5Pps7 HsTSlot8dfFPskOZ6NKJMmk7ngd99QsmvG2HG0LSZqEPfQ50n3jsxFa1p2v9csGnXe3g qWBcbnx5V4FBmr445AHVrG2PVbIovzUwI+7TAOnbDAlFRq2zc1NnGg4CMIcHnZNOQEl+ wekQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qrrUgUWy; 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 a5-20020a6b6c05000000b0074cb4e7337asi18983238ioh.96.2023.03.23.04.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 04:09:38 -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=qrrUgUWy; 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 904A485D4A; Thu, 23 Mar 2023 12:09:32 +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="qrrUgUWy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0340085CB7; Thu, 23 Mar 2023 12:09:29 +0100 (CET) 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-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) (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 93AEA85BC0 for ; Thu, 23 Mar 2023 12:09:26 +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=masahisa.kojima@linaro.org Received: by mail-pl1-x634.google.com with SMTP id w4so13853843plg.9 for ; Thu, 23 Mar 2023 04:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679569765; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mjpg6IBO5UqGaX6hUHdtGiStu1jwmhMmzCthGQAtu3w=; b=qrrUgUWycTz7JAeD6g7eYVINcwvQ7tbS7J1yF3nhowTec7/hM2VbJXCeFPXikK6f6m vUhrR5CM+fKfIkzpsF3Y17EVsE/0AMc0WgiR/bHKZCgSod17JKQKq+B6TlMp8/zNvl98 rVvsK9jk7OHebVHm65220pu8+0ShJy5SR7z1gZ6MhGWrys6Ru57IlovhjvkRoE7WKfKe GOf1khvusUeJYOxOE9QwTaevH49IZxMW000BO7Qtfw4nJC30KYuGM9dyIIjMJK052ym/ W9yv9fZq7/Y/PDA12zKf5F6FAHFFQ12glJpyIkdnjo+OyCl78uDMBWMMSOWUJ8ziy8pv f9Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679569765; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mjpg6IBO5UqGaX6hUHdtGiStu1jwmhMmzCthGQAtu3w=; b=YCfGhzWtP/x/lZXB2e7SCOHfb4SM1HWn4ERA4th/WhGM3dFDp/VaWmH85Pb4zAoMsI efyTq69rEkbIapaJFF6qlz8AX1TmrIZZaWr3MYSk//TAaYxAVHUXv0rh0F/fBhIRXfWj v4763S6uHMz+cisbSY4P2lZfr1CVFMK2Z1oJRmV6X3z6wQuEKnbgsItVSKFAj5YgxvVc sult/0Myw2TEsixe2CKqgJ5IrmWvDGtWz4kaez64bAReoSU3ax7y3oMfN8ck9+nI6283 pHFkTyJr8GRKua98c3rFOQFxH5bURqY0S8wGLAhLtR9Bv3InGFZsC0Ti9COTookP6goE 91mA== X-Gm-Message-State: AO0yUKURXQbd605CUBbG0veDMXHlfoge1JDMITuijHHZToXWM9j3Gajq 9PwB0WMuoGJqvS3o/6IO4aaTLJH1bcckPqHi1hA= X-Received: by 2002:a05:6a20:a905:b0:d8:161e:46 with SMTP id cd5-20020a056a20a90500b000d8161e0046mr2565299pzb.58.1679569764556; Thu, 23 Mar 2023 04:09:24 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id q17-20020a62ae11000000b005abc0d426c4sm11787011pff.54.2023.03.23.04.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 04:09:24 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Masahisa Kojima Subject: [PATCH v4 0/5] FMP versioning support Date: Thu, 23 Mar 2023 20:09:00 +0900 Message-Id: <20230323110906.23783-1-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 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 Firmware version management is not implemented in the current FMP implementation. This series aims to add the versioning support in FMP. EDK II reference implementation utilizes the FMP Payload Header inserted right before the capsule payload. With this series, U-Boot also follows the EDK II implementation. Currently, there is no way to know the current running firmware version through the EFI interface. FMP->GetImageInfo() returns always 0 for the version number. So a user can not know that expected firmware is running after the capsule update. With this series applied, version number can be specified in the capsule file generation with mkeficapsule tool, then user can know the running firmware version through FMP->GetImageInfo() and ESRT. Note that this series does not mandate the FMP Payload Header, compatible with boards that are already using the existing U-Boot FMP implementation. If no FMP Payload Header is found in the capsule file, fw_version, lowest supported version, last attempt version and last attempt status is set to 0 and this is the same behavior as existing FMP implementation. Major Changes in v4: - add python-based test Major Changes in v3: - exclude CONFIG_FWU_MULTI_BANK_UPDATE case Masahisa Kojima (5): efi_loader: store firmware version into FmpState variable efi_loader: versioning support in GetImageInfo efi_loader: check lowest supported version in capsule update mkeficapsule: add FMP Payload Header test/py: efi_capsule: test for FMP versioning doc/mkeficapsule.1 | 16 + lib/efi_loader/efi_firmware.c | 328 ++++++++++++++++-- test/py/tests/test_efi_capsule/conftest.py | 58 ++++ .../test_capsule_firmware_fit.py | 187 ++++++++++ .../test_capsule_firmware_raw.py | 199 +++++++++++ .../test_capsule_firmware_signed_fit.py | 159 +++++++++ .../test_capsule_firmware_signed_raw.py | 169 +++++++++ tools/eficapsule.h | 31 ++ tools/mkeficapsule.c | 51 ++- 9 files changed, 1161 insertions(+), 37 deletions(-)