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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF649C07E95 for ; Fri, 16 Jul 2021 07:09:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 02219613C0 for ; Fri, 16 Jul 2021 07:09:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02219613C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 73C9B829D4; Fri, 16 Jul 2021 09:09:49 +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="ar4wimMl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 391F7829E7; Fri, 16 Jul 2021 09:09:48 +0200 (CEST) Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (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 3E0B9829CD for ; Fri, 16 Jul 2021 09:09:44 +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-ej1-x632.google.com with SMTP id hd33so13618605ejc.9 for ; Fri, 16 Jul 2021 00:09:44 -0700 (PDT) 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=r9qBu9XcLEDDVcEg4X/7cd7+L0A36MtgwgiPFP2pzLg=; b=ar4wimMlQIRmSvY9ep/DL1jXeVmiyA6QE3Yvzr0uOyptIMQuVnr6NNTTw5suoODTPi xiZ+wDQx0eChB9XaCd0oVyVKdpyf8xouj+DPG+LXWLyb2bm8G4kgYAAfo+rwKmEyh41g cUbNmW3Or09eE6hM7eU+j1z3X/vf7vqBJos3DbQmB/bg365MqEwYtUHK64Jm11Z2a87p NPubocg4Trc00hWASXSPzOGGWGNaGfrQqXVNmbCUxdzNRbeAlSX2fJdL5ojlj9rkGKen G2W9IS8cpgIMTM/bhsulVJNIoX1ENuFJFJXAFG97jZF2ulZWHqGhkoam3+xNv3AiJs9V XkOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=r9qBu9XcLEDDVcEg4X/7cd7+L0A36MtgwgiPFP2pzLg=; b=V6b5wOuzZtE4gt8XIhPQZqHqRF0A4E+g59CrkpBKRarJ49bRsp2nD/0HoCXu9F6SHs U2C8qEGf8MJd/BqZeK1HvznUs39lZep8KEYChoJ+yMBprE4h1eNYlME1bwgg3j/qUqNr 2QO580zvCAN1ozSZz5JZ2zZYbeRSdRQK28O4qGiHxXh655dton+OartPfLoiCFOjjEVX WQOR3SHR1UF4RFx7laRnLM5jAVaUSNT73nJlEcNsIsj/L5XgLqZ82LeJmAJF5rkVf0p3 VjDwjaIlBT8cLY5Jd+7nUqD9xLthEPRaHPGIhCBmftBKsxixlwLMl5Iam+uYChrVpIUH ImoQ== X-Gm-Message-State: AOAM530sZEcy1tXEQyJifTwh7pTUTyCQga2sSPx9YT/IzzDA5xCW+HpH 6WeffCkja0nRyuFRFJTl3WcmXw== X-Google-Smtp-Source: ABdhPJymr4391cBtwDW7zjXedLjFoM7HrNh9DveYxLBU06akHIKko4Na6Jsyqe0Oi8fnJSawjjCQ9w== X-Received: by 2002:a17:906:1299:: with SMTP id k25mr10110631ejb.139.1626419383809; Fri, 16 Jul 2021 00:09:43 -0700 (PDT) Received: from enceladus (ppp-94-66-243-35.home.otenet.gr. [94.66.243.35]) by smtp.gmail.com with ESMTPSA id f24sm723130edv.93.2021.07.16.00.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 00:09:43 -0700 (PDT) Date: Fri, 16 Jul 2021 10:09:40 +0300 From: Ilias Apalodimas To: Heinrich Schuchardt Cc: masami.hiramatsu@linaro.org, takahiro.akashi@linaro.org, Alexander Graf , Sughosh Ganu , Simon Glass , u-boot@lists.denx.de Subject: Re: [PATCH 3/3] doc: Update CapsuleUpdate READMEs Message-ID: References: <20210715170030.97758-1-ilias.apalodimas@linaro.org> <20210715170030.97758-3-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.34 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.2 at phobos.denx.de X-Virus-Status: Clean > > + > > +The directory \EFI\UpdateCapsule is checked for capsules only within the > > +EFI system partition on the device specified in the active boot option > > +determine by reference to BootNext variable or BootOrder variable processing. > > %s/determine/determined/ > sure > > +The active Boot Variable is the variable with highest priority BootNext or > > Does only the device have to be present or also the file? > Should we check only the binary or also the initrd? I don't follow on the initrd. The whole paragraph is copied verbatim from the EFI spec. Basically you need a valid boot option (with priority) that points to the ESP partition your capsule is. Akashi's code is also doing the right thing following the spec. Regards /Ilias > > Best regards > > Heinrich > > > +within BootOrder that refers to a device found to be present. Boot variables > > +in BootOrder but referring to devices not present are ignored when determining > > +active boot variable. > > +Before starting a capsule update make sure your capsules are installed in the > > +correct ESP partition or set BootNext. > > + > > +Performing the update > > +********************* > > + > > +Since U-boot doesn't currently support SetVariable at runtime there's a Kconfig > > +option (CONFIG_EFI_IGNORE_OSINDICATIONS) to disable the OsIndications variable > > +check. If that option is enabled just copy your capsule to \EFI\UpdateCapsule. > > + > > +If that option is disabled, you'll need to set the OsIndications variable with:: > > + > > + => setenv -e -nv -bs -rt -v OsIndications =0x04 > > + > > +Finally, the capsule update can be initiated either by rebooting the board, > > +which is the preferred method, or by issuing the following command:: > > + > > + => efidebug capsule disk-update > > + > > +**The efidebug command is should only be used during debugging/development.** > > + > > +Enabling Capsule Authentication > > +******************************* > > + > > +The UEFI specification defines a way of authenticating the capsule to > > +be updated by verifying the capsule signature. The capsule signature > > +is computed and prepended to the capsule payload at the time of > > +capsule generation. This signature is then verified by using the > > +public key stored as part of the X509 certificate. This certificate is > > +in the form of an efi signature list (esl) file, which is embedded as > > +part of U-Boot. > > + > > +The capsule authentication feature can be enabled through the > > +following config, in addition to the configs listed above for capsule > > +update:: > > + > > + CONFIG_EFI_CAPSULE_AUTHENTICATE=y > > + CONFIG_EFI_CAPSULE_KEY_PATH= > > + > > +The public and private keys used for the signing process are generated > > +and used by the steps highlighted below:: > > + > > + 1. Install utility commands on your host > > + * OPENSSL > > + * efitools > > + > > + 2. Create signing keys and certificate files on your host > > + > > + $ openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=CRT/ \ > > + -keyout CRT.key -out CRT.crt -nodes -days 365 > > + $ cert-to-efi-sig-list CRT.crt CRT.esl > > + > > + $ openssl x509 -in CRT.crt -out CRT.cer -outform DER > > + $ openssl x509 -inform DER -in CRT.cer -outform PEM -out CRT.pub.pem > > + > > + $ openssl pkcs12 -export -out CRT.pfx -inkey CRT.key -in CRT.crt > > + $ openssl pkcs12 -in CRT.pfx -nodes -out CRT.pem > > + > > +The capsule file can be generated by using the GenerateCapsule.py > > +script in EDKII:: > > + > > + $ ./BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \ > > + --monotonic-count --fw-version \ > > + --lsv --guid \ > > + e2bb9c06-70e9-4b14-97a3-5a7913176e3f --verbose \ > > + --update-image-index --signer-private-cert \ > > + /path/to/CRT.pem --trusted-public-cert \ > > + /path/to/CRT.pub.pem --other-public-cert /path/to/CRT.pub.pem \ > > + > > + > > +Place the capsule generated in the above step on the EFI System > > +Partition under the EFI/UpdateCapsule directory > > + > > +Testing on QEMU > > +*************** > > + > > +Currently, support has been added on the QEMU ARM64 virt platform for > > +updating the U-Boot binary as a raw image when the platform is booted > > +in non-secure mode, i.e. with CONFIG_TFABOOT disabled. For this > > +configuration, the QEMU platform needs to be booted with > > +'secure=off'. The U-Boot binary placed on the first bank of the NOR > > +flash at offset 0x0. The U-Boot environment is placed on the second > > +NOR flash bank at offset 0x4000000. > > + > > +The capsule update feature is enabled with the following configuration > > +settings:: > > + > > + CONFIG_MTD=y > > + CONFIG_FLASH_CFI_MTD=y > > + CONFIG_CMD_MTDPARTS=y > > + CONFIG_CMD_DFU=y > > + CONFIG_DFU_MTD=y > > + CONFIG_PCI_INIT_R=y > > + CONFIG_EFI_CAPSULE_ON_DISK=y > > + CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT=y > > + CONFIG_EFI_CAPSULE_FIRMWARE=y > > + CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y > > + CONFIG_EFI_CAPSULE_FMP_HEADER=y > > + > > +In addition, the following config needs to be disabled(QEMU ARM specific):: > > + > > + CONFIG_TFABOOT > > + > > +The capsule file can be generated by using the tools/mkeficapsule:: > > + > > + $ mkeficapsule --raw --index 1 > > + > > Executing the boot manager > > ~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > >