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 B0094C07E95 for ; Fri, 16 Jul 2021 12:34:07 +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 C8382611C1 for ; Fri, 16 Jul 2021 12:34:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8382611C1 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 259458296F; Fri, 16 Jul 2021 14:34:04 +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="BkgZ50NV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A771482999; Fri, 16 Jul 2021 14:34:02 +0200 (CEST) Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) (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 796A88296A for ; Fri, 16 Jul 2021 14:33:58 +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=takahiro.akashi@linaro.org Received: by mail-pf1-x42a.google.com with SMTP id 17so8812235pfz.4 for ; Fri, 16 Jul 2021 05:33:58 -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:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=iqEjoV6NLqfZZB+u/NQqvDSLzJh216gLH9Ma2pIeyeg=; b=BkgZ50NVLOIbRLJHGat5x+MM9lMJ7jaRBrU5afUEFKS+jsw/seEkewdaJrm/yglcfT 6Ue/0M7ZJEK/mzygg+oM3w3ztaj2+TZ0aoUIz+o6FW4QQu2T8WdadCdBhqLw3o8dLaVb 9s4TbKhciQJlidzyETewAGTd72G24loOyyag8a9nft7T5pNzjoO+dX1daQJ2jaYGIsZV DYY4PqHGOJdBury3XiiiTfZoVsI5eaNlrelY2lczDRWoFG7p8o0mGY/hSC2jgSZcxSvD FlnLJifHSKXl8ekFRYk79zTOjR3ybgNTb/ru44DSSASTcFfEZkH4lRiz0vjIhpKdHVYn 9jfg== 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=iqEjoV6NLqfZZB+u/NQqvDSLzJh216gLH9Ma2pIeyeg=; b=n2Xs6w6fmrWWgllKOhOThDgD2FxP8LH3SxitDgux4ewKptUeJjXDqcYwpiS0UOnwJq eOetPmkwuo4WNrqavtVaEalXeMU/O7xUYIHHnE9aMRroYobSqpKuY7xljV1HaOg4R0Zm xlVKF4dr7WQNaR9M8a2Mb8vbbZLOzhAnPEVl9X5lFwPOg+Uy3ACSy7zeTxkng8iaVOzs c8VzjTl8nUGCLTWDK+q1h3e0lRPtnkTr91jkz48VMzcpkrdWZMJ378OQDIj4Y0xTXfdn C2B+2XVKTPFYZIsDHuICfny2QKVn4ZuzeyHEfpXf8gMIzglu31mkBpBdq8Rprc/e1YSb wSqg== X-Gm-Message-State: AOAM533oh+l84So8/4euNp1KQibrMiGpEWoUkI/nzSRz9Kd64dE+e6Lv 01bC41RLiPJ3n3tAlb1cE9kZHw== X-Google-Smtp-Source: ABdhPJyG78N0a7fnY0rwR6X1NLDM9P1HO/xfC872BwQUpLnO1Oi0+Ip0RKlOFQaiftz+kjzJawwnUA== X-Received: by 2002:a65:51c9:: with SMTP id i9mr9699034pgq.102.1626438836614; Fri, 16 Jul 2021 05:33:56 -0700 (PDT) Received: from laputa (p3dd30549.tkyea130.ap.so-net.ne.jp. [61.211.5.73]) by smtp.gmail.com with ESMTPSA id x23sm10888896pgk.90.2021.07.16.05.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 05:33:52 -0700 (PDT) Date: Fri, 16 Jul 2021 21:33:44 +0900 From: AKASHI Takahiro To: Ilias Apalodimas Cc: Heinrich Schuchardt , masami.hiramatsu@linaro.org, Alexander Graf , Sughosh Ganu , Simon Glass , u-boot@lists.denx.de Subject: Re: [PATCH 3/3] doc: Update CapsuleUpdate READMEs Message-ID: <20210716123344.GA68948@laputa> Mail-Followup-To: AKASHI Takahiro , Ilias Apalodimas , Heinrich Schuchardt , masami.hiramatsu@linaro.org, Alexander Graf , Sughosh Ganu , Simon Glass , u-boot@lists.denx.de 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 On Fri, Jul 16, 2021 at 10:09:40AM +0300, Ilias Apalodimas wrote: > > > + > > > +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. I *guess* that Heinrich thinks of all the device paths contained in an boot option, including "initrd" that you added a support for. IIRC, all the paths in one option must point to the same device. (So no for Heinrich's concern?) -Takahiro Akashi > 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 > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > >