From: Michal Simek Date: Fri, 21 Mar 2025 10:25:48 +0000 (+0100) Subject: cmd: fwu: Dump custom fields from mdata structure X-Git-Tag: v2025.07-rc1~80^2~10 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70d5f6e21ee33693d2d34b8eede34c83d45663b8;p=pandora-u-boot.git cmd: fwu: Dump custom fields from mdata structure The commit cb9ae40a16f0 ("tools: mkfwumdata: add logic to append vendor data to the FWU metadata") added support for adding vendor data to mdata structure but it is not visible anywhere that's why extend fwu command to dump it. Tested-by: Sughosh Ganu Reviewed-by: Sughosh Ganu Signed-off-by: Michal Simek --- diff --git a/cmd/Kconfig b/cmd/Kconfig index ecef664fcea..c2ce519d1e3 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -185,6 +185,7 @@ config CMD_UFETCH config CMD_FWU_METADATA bool "fwu metadata read" depends on FWU_MULTI_BANK_UPDATE + imply HEXDUMP if FWU_MDATA_V2 help Command to read the metadata and dump it's contents diff --git a/cmd/fwu_mdata.c b/cmd/fwu_mdata.c index 9c048d69a13..5b5a2e4d1cd 100644 --- a/cmd/fwu_mdata.c +++ b/cmd/fwu_mdata.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +46,30 @@ static void print_mdata(struct fwu_data *data) img_info->accepted == 0x1 ? "yes" : "no"); } } + + if (data->version == 2) { + struct fwu_mdata *mdata = data->fwu_mdata; + struct fwu_fw_store_desc *desc; + void *end; + u32 diff; + + /* + * fwu_mdata defines only header that's why taking it as array + * which exactly point to image description location + */ + desc = (struct fwu_fw_store_desc *)&mdata[1]; + + /* Number of entries is taken from for loop - variable i */ + end = &desc->img_entry[i]; + debug("mdata %p, desc %p, end %p\n", mdata, desc, end); + + diff = data->metadata_size - ((void *)end - (void *)mdata); + if (diff) { + printf("Custom fields covered by CRC len: 0x%x\n", diff); + print_hex_dump_bytes("CUSTOM ", DUMP_PREFIX_OFFSET, + end, diff); + } + } } int do_fwu_mdata_read(struct cmd_tbl *cmdtp, int flag,