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 5F8BDC433F5 for ; Fri, 15 Apr 2022 01:24:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 94A62831CA; Fri, 15 Apr 2022 03:24: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="Rqv3w1oL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A7DE6837C9; Fri, 15 Apr 2022 03:24:47 +0200 (CEST) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 EB06383046 for ; Fri, 15 Apr 2022 03:24:42 +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-pj1-x1031.google.com with SMTP id mm4-20020a17090b358400b001cb93d8b137so10731145pjb.2 for ; Thu, 14 Apr 2022 18:24:42 -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=yPrrLOxkSo5snntvBS/yLhRQMipJivJdanj04npEduM=; b=Rqv3w1oLpR2R1sttj6/N+rDwlikzWUtDYjOIRoxQuFc/Kt5/Bv0jlFxzZeKDLop6+y ah2HFBdB+B/SrzrzztxpYPSjgi1CpR8ISkXf0YD5N7N1y4GoLOg7dJ7xLGfQ2V/tMRVG U/nij7YbJwg/nyZqzTvlFWuEnahiW1Cz37o4CMIK+6A1JBUdjoJp1u1oMX0enRpfpQJu XsSrWThHv0m1PrWiMAWL38dYeZzD6OXkYgVt3Zk3mX6G+w+H0tgMskQus8RBsYP4oAZF 64R45ncTg4cgrSU5OddhJNN2CEc+W2gvLew9zjfqzAOM5Ii6ar8ZuLzzIHH29Xx6+cgS QFFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=yPrrLOxkSo5snntvBS/yLhRQMipJivJdanj04npEduM=; b=H1A2trulNuWswds5sI3kSfSTvY8MTOchmxfsm23S6TfA+G9w/Xb0FW0Z7UUYTEzmkP aqXVCfRcKuPVRt6yUmXfrc+JqwcuamnLr/ibRP1QNd450Osq4/zA1xzEj+gDmNWx7chU f0MP5f0SxhDKPziLAT7NAZBQv6E7pyqREatRsE2cMLxJ96wgA9tD05HvKOyTRQXoHjrA f5AA5dFVaC4ca0k+VHQjISCrwd1qa+QyiMOcJ80pfM9OjmbkLcVQTsmWEq5P8wd4RBYr erLMBH+KoZoK/8Xzv0DCchS/3BiLKCbMwoFU4JpdugsZVuuXJKEOC8cw6zltEmNCA48l iQCQ== X-Gm-Message-State: AOAM533+wmAtETrYZX0EOCMYmDvbC3Z77Q3a+DQm8gyL7UY1cBXnOwDJ b/M81Ey3/BSgwUAPsfSMCOQ5Zw== X-Google-Smtp-Source: ABdhPJwE2LgM4+AQqhKZS6+iM6c3hNsniCVSdLZbl+8Wry9dbiZa/484LVBlWY6IyJM/daocdhLF0Q== X-Received: by 2002:a17:902:f686:b0:158:8178:b2af with SMTP id l6-20020a170902f68600b001588178b2afmr17501401plg.4.1649985881122; Thu, 14 Apr 2022 18:24:41 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:18f3:1e4:6c4:6ea3]) by smtp.gmail.com with ESMTPSA id u17-20020a056a00159100b004faef351ebcsm1038778pfk.45.2022.04.14.18.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 18:24:40 -0700 (PDT) Date: Fri, 15 Apr 2022 10:24:35 +0900 From: AKASHI Takahiro To: Sughosh Ganu Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas , Ying-Chun Liu , Tuomas Tynkkynen , Heiko Thiery , Frieder Schrempf , Michael Walle , Masami Hiramatsu , Jassi Brar , Michal Simek , Michal Simek Subject: Re: [PATCH v7 8/8] doc: uefi: Update the capsule update related documentation Message-ID: <20220415012435.GA53581@laputa> Mail-Followup-To: AKASHI Takahiro , Sughosh Ganu , u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas , Ying-Chun Liu , Tuomas Tynkkynen , Heiko Thiery , Frieder Schrempf , Michael Walle , Masami Hiramatsu , Jassi Brar , Michal Simek , Michal Simek References: <20220414105448.559043-1-sughosh.ganu@linaro.org> <20220414105448.559043-9-sughosh.ganu@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220414105448.559043-9-sughosh.ganu@linaro.org> 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.5 at phobos.denx.de X-Virus-Status: Clean On Thu, Apr 14, 2022 at 04:24:48PM +0530, Sughosh Ganu wrote: > Update the capsule update functionality related documentation to > refect the additional definitions that need to be made per platform > for supporting the capsule update feature. Your code seems to expect that a global variable, "update_info", exists for each platform. If so, please describe this requirement explicitly in a document. -Takahiro Akashi > > Signed-off-by: Sughosh Ganu > --- > > Changes since V6: > * Add example for the struct efi_fw_image array and struct > efi_capsule_update_info as suggested by Takahiro > > doc/develop/uefi/uefi.rst | 98 ++++++++++++++++++++++++++++++++++++++- > 1 file changed, 96 insertions(+), 2 deletions(-) > > diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst > index fe337c88bd..1aea04a4e8 100644 > --- a/doc/develop/uefi/uefi.rst > +++ b/doc/develop/uefi/uefi.rst > @@ -312,8 +312,8 @@ Run the following command > .. code-block:: console > > $ mkeficapsule \ > - --index 1 --instance 0 \ > - [--fit | --raw ] \ > + --index --instance 0 \ > + --guid \ > > > Performing the update > @@ -333,9 +333,102 @@ won't be taken over across the reboot. If this is the case, you can skip > this feature check with the Kconfig option (CONFIG_EFI_IGNORE_OSINDICATIONS) > set. > > +A few values need to be defined in the board file for performing the > +capsule update. These values are defined in the board file by > +initialisation of a structure which provides information needed for > +capsule updates. The following structures have been defined for > +containing the image related information > + > +.. code-block:: c > + > + struct efi_fw_images { > + efi_guid_t image_type_id; > + u16 *fw_name; > + u8 image_index; > + }; > + > + struct efi_capsule_update_info { > + const char *dfu_string; > + struct efi_fw_image *images; > + }; > + > + > +A string is defined which is to be used for populating the > +dfu_alt_info variable. This string is used by the function > +set_dfu_alt_info. Instead of taking the variable from the environment, > +the capsule update feature requires that the variable be set through > +the function, since that is more robust. Allowing the user to change > +the location of the firmware updates is not a very secure > +practice. Getting this information from the firmware itself is more > +secure, assuming the firmware has been verified by a previous stage > +boot loader. > + > +The firmware images structure defines the GUID values, image index > +values and the name of the images that are to be updated through > +the capsule update feature. These values are to be defined as part of > +an array. These GUID values would be used by the Firmware Management > +Protocol(FMP) to populate the image descriptor array and also > +displayed as part of the ESRT table. The image index values defined in > +the array should be one greater than the dfu alt number that > +corresponds to the firmware image. So, if the dfu alt number for an > +image is 2, the value of image index in the fw_images array for that > +image should be 3. The dfu alt number can be obtained by running the > +following command:: > + > + dfu list > + > +When using the FMP for FIT images, the image index value needs to be > +set to 1. > + > Finally, the capsule update can be initiated by rebooting the board. > > +An example of setting the values in the struct efi_fw_image and > +struct efi_capsule_update_info is shown below > + > +.. code-block:: c > + > + struct efi_fw_image fw_images[] = { > + { > + .image_type_id = DEVELOPERBOX_UBOOT_IMAGE_GUID, > + .fw_name = u"DEVELOPERBOX-UBOOT", > + .image_index = 1, > + }, > + { > + .image_type_id = DEVELOPERBOX_FIP_IMAGE_GUID, > + .fw_name = u"DEVELOPERBOX-FIP", > + .image_index = 2, > + }, > + { > + .image_type_id = DEVELOPERBOX_OPTEE_IMAGE_GUID, > + .fw_name = u"DEVELOPERBOX-OPTEE", > + .image_index = 3, > + }, > + }; > + > + struct efi_capsule_update_info update_info = { > + .dfu_string = "mtd nor1=u-boot.bin raw 200000 100000;" > + "fip.bin raw 180000 78000;" > + "optee.bin raw 500000 100000", > + .images = fw_images, > + }; > + > +The platform will define a fw_images array which contains information > +of all the firmware images that are to be updated through capsule > +update mechanism. The dfu_string is the string that is to be set as > +dfu_alt_info. In the example above, the image index to be set for > +u-boot.bin binary is 0x1, for fip.bin is 0x2 and for optee.bin is 0x3. > + > +As an example, for generating the capsule for the optee.bin image, the > +following command can be issued > + > +.. code-block:: bash > + > + $ ./tools/mkeficapsule \ > + --index 0x3 --instance 0 \ > + --guid c1b629f1-ce0e-4894-82bf-f0a38387e630 \ > + optee.bin optee.capsule > + > + > Enabling Capsule Authentication > ******************************* > > -- > 2.25.1 >