[PATCH 2/6] fwu: v2: try reading both copies of metadata

Michal Simek michal.simek at amd.com
Wed Sep 4 09:59:20 CEST 2024



On 8/30/24 13:40, Sughosh Ganu wrote:
> In the version 2 of the FWU metadata, the metadata is broken into two
> parts, a top-level structure, which provides information on the total
> size of the structure among other things. Try reading the primary
> partition first, and if that fails, try reading the secondary
> partition. This will help in the scenario where the primary metadata
> partition has been corrupted, but the secondary partition is intact.
> 
> Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
> ---
>   lib/fwu_updates/fwu_v2.c | 77 +++++++++++++++++++++-------------------
>   1 file changed, 41 insertions(+), 36 deletions(-)
> 
> diff --git a/lib/fwu_updates/fwu_v2.c b/lib/fwu_updates/fwu_v2.c
> index d0d8a25929..69306282aa 100644
> --- a/lib/fwu_updates/fwu_v2.c
> +++ b/lib/fwu_updates/fwu_v2.c
> @@ -10,6 +10,12 @@
>   #include <linux/types.h>
>   
>   #define FWU_MDATA_VERSION	0x2U
> +#define FWU_IMG_DESC_OFFSET	0x20U

And this is value which is sizeof(struct fwu_mdata) right?


> +
> +static struct fwu_mdata g_mdata;
> +
> +#define PRI_PART		0x1U
> +#define SEC_PART		0x2U

You already have them in include/fwu.h

  88 enum {
  89         PRIMARY_PART = 1,
  90         SECONDARY_PART,
  91         BOTH_PARTS,
  92 };
  93


M


More information about the U-Boot mailing list