From patchwork Fri Apr 15 05:59:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 561934 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp77640map; Thu, 14 Apr 2022 23:01:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeBuR+Xigf6rs9nJZlnpbtW1DoSzGRjxFHgWF1s19hfsyzPJQlmmO/CEOMsgoUh1LO7c5w X-Received: by 2002:a17:907:60cc:b0:6e0:dab3:ca76 with SMTP id hv12-20020a17090760cc00b006e0dab3ca76mr5098233ejc.154.1650002507849; Thu, 14 Apr 2022 23:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650002507; cv=none; d=google.com; s=arc-20160816; b=T/vjlopR14T/Mkx9j3Fm3+mQoe5R/Lj8bHAc/M6UX0yO0d6aeFqtplEJsWH5yEo3qs 1DffE5cJht3RAWAG8Tiibs3dwiFuYkry1Fv6bTnfXMTAR7MFl01XemwMDKPIEZqEtcKb Ou7eqIMeZmp7LVJ2Zuba6pZ6vOPNgLaaMkU1VvDf/BY2gKL29hIhY6Llu2sfZ55Okph9 8644jHEBmO5btw5RcoT8HLKVltzbiMR+FMJVj4lEKbubdn66Zl0fZ32W75Pq8gh+xdB6 599EFM9N9RaMTtQJeomRt1pwhzC77sWSdpVm8uTW2q3rT056IeW46b1CO8dKMMCPLsep k/rw== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=szZIFtBsk8p+YzkVBsCVGq7+GE0tRXEp8mG2FC2ThbQ=; b=Vje3+yHq0G/L5yLvYMdKwjWc5XHIL5hsJXzXHqOW+lzXbEkOM2KVx/zPPxrqCCWN2m 6fBY1w2X87Tq2AupsXRShDoBb1Y1SNxy7AY1MIWJSSawXDMe1YuY1v01bf1H+3Y/O+XW 9lHw0mFoEU0UDCrGdIhN0jDQpcHVb+Mr6Qbz0AGC+oXdOWD4MvYAQpZskbqqpfsREgLv lrTlHweRnHspk7cYpEqbsKBb65gZkdVI0WdJ3waBKDtHYgtTgKuA3Svq2FR3cBCZ8AIM jaUpzRRVrVklSivOPGkjSABK0jbioVetIlrrAo+l2aYkkhKDLa9sw9svyE/YVwRmAQal 22qg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id dc26-20020a170906c7da00b006e86aac6b67si440061ejb.351.2022.04.14.23.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 23:01:47 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (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 2991583D61; Fri, 15 Apr 2022 08:00:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 5B90E83D92; Fri, 15 Apr 2022 08:00:41 +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=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id AE69D839B9 for ; Fri, 15 Apr 2022 08:00:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1376F1042; Thu, 14 Apr 2022 23:00:37 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3482C3F5A1; Thu, 14 Apr 2022 23:00:31 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , AKASHI Takahiro , Ying-Chun Liu , Tuomas Tynkkynen , Heiko Thiery , Frieder Schrempf , Michael Walle , Masami Hiramatsu , Jassi Brar , Michal Simek , Michal Simek , Sughosh Ganu Subject: [PATCH v8 8/8] doc: uefi: Update the capsule update related documentation Date: Fri, 15 Apr 2022 11:29:41 +0530 Message-Id: <20220415055941.609416-9-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220415055941.609416-1-sughosh.ganu@linaro.org> References: <20220415055941.609416-1-sughosh.ganu@linaro.org> 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.5 at phobos.denx.de X-Virus-Status: Clean 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. Signed-off-by: Sughosh Ganu Reviewed-by: Masami Hiramatsu --- Changes since V7: * Add a comment about using update_info variable doc/develop/uefi/uefi.rst | 100 +++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 2 deletions(-) diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index fe337c88bd..753a4e5e29 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,8 +333,104 @@ 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_image { + 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, + }; + +Platforms must declare a variable update_info of type struct +efi_capsule_update_info as shown in the example above. The platform +will also 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 *******************************