From patchwork Thu Jan 4 18:50:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1882584 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collins.com header.i=@collins.com header.a=rsa-sha256 header.s=POD051818 header.b=i84EFEBd; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T5bMS0yDxz1ydd for ; Fri, 5 Jan 2024 05:53:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DABD1877CD; Thu, 4 Jan 2024 19:53:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collins.com 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=collins.com header.i=@collins.com header.b="i84EFEBd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BBB58878AD; Thu, 4 Jan 2024 19:53:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mx0a-00105401.pphosted.com (mx0a-00105401.pphosted.com [67.231.144.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3ECED87716 for ; Thu, 4 Jan 2024 19:53:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collins.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=brandon.maier@collins.com Received: from pps.filterd (m0346907.ppops.net [127.0.0.1]) by mx0a-00105401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 404Hbxgt029928; Thu, 4 Jan 2024 18:53:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=collins.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=POD051818; bh=ThsrrfOL5UGRg8vD0nqdlf8bCOQmu/Gjn/1BggxFCA4=; b=i84EFEBdNzqBe2w6a3xdJA0M7hxCExFIJKWsaBptQsOC+Tl5X9hNf4SvoRWTtz5kxVcy YVfISpnKZUdoM9U6+ynuQ/EQc6SlREa6rSgxAUx1AuLR/enXyEK2z3aK+SVoiOkRsFoQ Q81iNmGoeV+ozyHKMYtzqtAssfb156bgRXbij1rmvZREmMF6Qf0mk48tb5uUYTL6fqay 8lGaw7SnA57G9LB1gZtTKjl5asa/bmi3lG9zsj5HfKK6CMOvSjcBSF2akLWAHfz3UgC6 SLEY7omXjoXi6P03LOWHI8AuhL+aEbjfn1jyZjkjqsLdv+QAYeBNROEpUKDrlZUGHUQr wQ== Received: from xusxph005rp050.rtx.com (xusxph005rp050.rtx.com [128.13.121.147]) by mx0a-00105401.pphosted.com (PPS) with ESMTPS id 3ve182scy4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Jan 2024 18:53:07 +0000 Received: from xusxph005rp020.corp.ray.com ([128.13.121.224]) by xusxph005rp050.rtx.com (8.17.1.19/8.17.1.19) with ESMTPS id 404Ir6hW017518 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Jan 2024 18:53:06 GMT Received: from dtulimr01.rockwellcollins.com (snat-utc-mailhub.rockwellcollins.com [10.172.224.19]) by xusxph005rp020.corp.ray.com (8.17.1.19/8.17.1.19) with ESMTPS id 404Ir6Uo013619 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 4 Jan 2024 18:53:06 GMT X-Received: from bspbox.kirk (kirk.rockwellcollins.lab [10.148.204.208]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id B5DC1603A0; Thu, 4 Jan 2024 12:53:05 -0600 (CST) From: Brandon Maier To: Michal Simek , Simon Glass Cc: Brandon Maier , This contributor prefers not to receive mails , u-boot@lists.denx.de Subject: [PATCH 1/4] tools: zynqmpimage: show info on partition 0 Date: Thu, 4 Jan 2024 18:50:06 +0000 Message-ID: <20240104185258.39465-1-brandon.maier@collins.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_11,2024-01-03_01,2023-05-22_02 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_11,2024-01-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=705 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 malwarescore=0 mlxlogscore=648 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 X-Proofpoint-ORIG-GUID: 8VvjMuY3f99Cj8Mh_bnFqQ1N3WUY277s X-Proofpoint-GUID: 8VvjMuY3f99Cj8Mh_bnFqQ1N3WUY277s X-Proofpoint-Spam-Details: rule=outbound_default_notspam policy=outbound_default score=0 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 clxscore=1011 impostorscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 spamscore=0 mlxlogscore=808 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 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.8 at phobos.denx.de X-Virus-Status: Clean The zynqmpimage_print_header() skips printing the first partition. This is because the image header can contain duplicate fields as the first partition. However some fields, like the partition attributes, are only present in the partition table. It is also possible for the first partition to not be declared in the image header, if the image is not a bootloader image. Signed-off-by: Brandon Maier --- tools/zynqmpimage.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c index bb54f41a153..05af1e81a24 100644 --- a/tools/zynqmpimage.c +++ b/tools/zynqmpimage.c @@ -262,9 +262,7 @@ void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params) for (i = 0; i < le32_to_cpu(iht->nr_parts); i++) { next = le32_to_cpu(ph->next_partition_offset) * 4; - /* Partition 0 is the base image itself */ - if (i) - print_partition(ptr, ph); + print_partition(ptr, ph); ph = (void *)ptr + next; } From patchwork Thu Jan 4 18:50:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1882585 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collins.com header.i=@collins.com header.a=rsa-sha256 header.s=POD051818 header.b=tzqspJvX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T5bMY3vvGz1ydd for ; Fri, 5 Jan 2024 05:53:29 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C08BF8797D; Thu, 4 Jan 2024 19:53:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collins.com 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=collins.com header.i=@collins.com header.b="tzqspJvX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5338E8799E; Thu, 4 Jan 2024 19:53:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mx0b-00105401.pphosted.com (mx0b-00105401.pphosted.com [67.231.152.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D548E8795E for ; Thu, 4 Jan 2024 19:53:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collins.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=brandon.maier@collins.com Received: from pps.filterd (m0346902.ppops.net [127.0.0.1]) by mx0a-00105401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 404HZjPZ012388; Thu, 4 Jan 2024 18:53:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=collins.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=POD051818; bh=WXaeJ1IyrH5Wwdah9MLbKbJLouIXe7Q0SqoGi/QoWMY=; b=tzqspJvXSqEWZFzeqKx0wYxdYuLGUFXWigLtbNxx0NOTZgaRd8gkv07htOfkFiwUr2sc IBs1uuWCQR5RUl+sVvqvdrGZSIH81B98XPOcva2Ks8nkuGlcZwQUw9lcPg4b3ZqiNOJM /HyfUKyUx7t9nkV2d6o4FgdXLuxD3Mp1gTD2TRpusbTf35KAzQ8aqNGuKVC5XFs+2yBQ ANDO1FF3gr/DjtylsuJTp7bXZZSMyMkObEaKJO7FHGXeZdkwMt9cy8ffnp+hYy8jHfiA 7qBAsro9lg1BLRL9MggyCuhh8xx7g4goLoM7US2ls4kyvklayBZfXLRCXAxPP8g+0TSu Cg== Received: from xusxph005rp050.rtx.com (xusxph005rp050.rtx.com [128.13.121.147]) by mx0a-00105401.pphosted.com (PPS) with ESMTPS id 3ve179hbw0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Jan 2024 18:53:15 +0000 Received: from xusxph005rp020.corp.ray.com ([128.13.121.224]) by xusxph005rp050.rtx.com (8.17.1.19/8.17.1.19) with ESMTPS id 404IrEW5017555 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Jan 2024 18:53:14 GMT Received: from dtulimr01.rockwellcollins.com (snat-utc-mailhub.rockwellcollins.com [10.172.224.19]) by xusxph005rp020.corp.ray.com (8.17.1.19/8.17.1.19) with ESMTPS id 404IrEx6013688 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 4 Jan 2024 18:53:14 GMT X-Received: from bspbox.kirk (kirk.rockwellcollins.lab [10.148.204.208]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id CCCDB600C1; Thu, 4 Jan 2024 12:53:13 -0600 (CST) From: Brandon Maier To: Michal Simek , Simon Glass Cc: Brandon Maier , This contributor prefers not to receive mails , u-boot@lists.denx.de Subject: [PATCH 2/4] tools: zynqmpimage: print all partition sizes Date: Thu, 4 Jan 2024 18:50:07 +0000 Message-ID: <20240104185258.39465-2-brandon.maier@collins.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240104185258.39465-1-brandon.maier@collins.com> References: <20240104185258.39465-1-brandon.maier@collins.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_11,2024-01-03_01,2023-05-22_02 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_11,2024-01-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 X-Proofpoint-ORIG-GUID: Jm79dRo_iedTcoQq0Ebe6djhDMjwr6V9 X-Proofpoint-GUID: Jm79dRo_iedTcoQq0Ebe6djhDMjwr6V9 X-Proofpoint-Spam-Details: rule=outbound_default_notspam policy=outbound_default score=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 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.8 at phobos.denx.de X-Virus-Status: Clean Two of the partition size fields are not printed. Currently only the "total" size is displayed, which is the size of the image data (encrypted), padding, expansion, and authentication data. Add the "unencrypted data" size, which is the original size of the data before being encrypted. And "encrypted data" size, which is just the encrypted data. To avoid printing useless information, only print the encrypted and unencrypted sizes if they are different from the total. Signed-off-by: Brandon Maier --- tools/zynqmpimage.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c index 05af1e81a24..2795a2b9a77 100644 --- a/tools/zynqmpimage.c +++ b/tools/zynqmpimage.c @@ -139,6 +139,8 @@ static void print_partition(const void *ptr, const struct partition_header *ph) { uint32_t attr = le32_to_cpu(ph->attributes); unsigned long len = le32_to_cpu(ph->len) * 4; + unsigned long len_enc = le32_to_cpu(ph->len_enc) * 4; + unsigned long len_unenc = le32_to_cpu(ph->len_unenc) * 4; const char *part_owner; const char *dest_devs[0x8] = { "none", "PS", "PL", "PMU", "unknown", "unknown", "unknown", @@ -163,6 +165,10 @@ static void print_partition(const void *ptr, const struct partition_header *ph) printf(" Offset : 0x%08x\n", le32_to_cpu(ph->offset) * 4); printf(" Size : %lu (0x%lx) bytes\n", len, len); + if (len != len_unenc) + printf(" Size Data : %lu (0x%lx) bytes\n", len_unenc, len_unenc); + if (len_unenc != len_enc) + printf(" Size Enc : %lu (0x%lx) bytes\n", len_unenc, len_unenc); printf(" Load : 0x%08llx", (unsigned long long)le64_to_cpu(ph->load_address)); if (ph->load_address != ph->entry_point) From patchwork Thu Jan 4 18:50:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1882586 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collins.com header.i=@collins.com header.a=rsa-sha256 header.s=POD051818 header.b=eqWoDRv4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T5bMq2LT6z1ydd for ; Fri, 5 Jan 2024 05:53:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 662648795E; Thu, 4 Jan 2024 19:53:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collins.com 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=collins.com header.i=@collins.com header.b="eqWoDRv4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 78FFC8793E; Thu, 4 Jan 2024 19:53:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mx0b-00105401.pphosted.com (mx0b-00105401.pphosted.com [67.231.152.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 568DC8795E for ; Thu, 4 Jan 2024 19:53:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collins.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=brandon.maier@collins.com Received: from pps.filterd (m0346901.ppops.net [127.0.0.1]) by mx0a-00105401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 404HUN9Q015064; Thu, 4 Jan 2024 18:53:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=collins.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=POD051818; bh=sGOJ9pzkgWYSPddaI2RPFiqGoJZZIWynkZjGcUAZnF4=; b=eqWoDRv4rvyliFOSsf/C72YqIZsR3F6FiSKQO/rISV7JAWanbALz+BVeYY+H15qGNGhE 2RpfhgTWJLJceBqv+2Tknc7EzDznicihQ920nwcrPtiqMw+XAdgly5zSnvnfwjXYcxT7 HvEw9Cm1W7tRGPfJJYJu/qiieml6PFanhnoMKSJkKpxawkQ8fTMN+sWcn1f0On1sTaxb 2cElVaCvN7p6DHJEH5ib8mvlt9NYLtfF+NWEUNlxLBgo6zkW+dFy2u0kDBQt+wBs54wS 71UtWPXbwZjcLEdjH8Z4HXB2uNCW1LHWHMJCpLfFaSZHGDHTQOTPHt/5HEEjOukVSDH8 aA== Received: from xusxph004rp050.rtx.com (xusxph004rp050.rtx.com [128.13.120.147]) by mx0a-00105401.pphosted.com (PPS) with ESMTPS id 3ve14a9eec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Jan 2024 18:53:18 +0000 Received: from xusxph008rp020.corp.ray.com ([128.13.124.224]) by xusxph004rp050.rtx.com (8.17.1.19/8.17.1.19) with ESMTPS id 404IrHQ6006925 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Jan 2024 18:53:17 GMT Received: from dtulimr01.rockwellcollins.com (snat-utc-mailhub.rockwellcollins.com [10.172.224.19]) by xusxph008rp020.corp.ray.com (8.17.1.19/8.17.1.19) with ESMTPS id 404IrG1C004868 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 4 Jan 2024 18:53:16 GMT X-Received: from bspbox.kirk (kirk.rockwellcollins.lab [10.148.204.208]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id 121E8600C1; Thu, 4 Jan 2024 12:53:16 -0600 (CST) From: Brandon Maier To: Michal Simek , Simon Glass Cc: Brandon Maier , This contributor prefers not to receive mails , u-boot@lists.denx.de Subject: [PATCH 3/4] tools: zynqmpimage: add partition extracting Date: Thu, 4 Jan 2024 18:50:08 +0000 Message-ID: <20240104185258.39465-3-brandon.maier@collins.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240104185258.39465-1-brandon.maier@collins.com> References: <20240104185258.39465-1-brandon.maier@collins.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_11,2024-01-03_01,2023-05-22_02 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_11,2024-01-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=547 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=494 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 X-Proofpoint-GUID: M7ClqdtPpgsvIJ1BhuN1N7BLejh-tAhT X-Proofpoint-ORIG-GUID: M7ClqdtPpgsvIJ1BhuN1N7BLejh-tAhT X-Proofpoint-Spam-Details: rule=outbound_default_notspam policy=outbound_default score=0 clxscore=1015 bulkscore=0 mlxlogscore=647 suspectscore=0 adultscore=0 spamscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 mlxscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 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.8 at phobos.denx.de X-Virus-Status: Clean Extract partitions from a Xilinx Boot Image using dumpimage. Add helper for_each_zynqmp_part() to reuse the partition walking code between the printing and extracting functions. Signed-off-by: Brandon Maier --- tools/zynqmpimage.c | 57 +++++++++++++++++++++++++++++--------------- tools/zynqmpimage.h | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 19 deletions(-) diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c index 2795a2b9a77..307edd63ebb 100644 --- a/tools/zynqmpimage.c +++ b/tools/zynqmpimage.c @@ -218,6 +218,7 @@ static void print_partition(const void *ptr, const struct partition_header *ph) void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params) { struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr; + struct partition_header *ph; int i; printf("Image Type : Xilinx ZynqMP Boot Image support\n"); @@ -255,23 +256,8 @@ void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params) le32_to_cpu(zynqhdr->register_init[i].data)); } - if (zynqhdr->image_header_table_offset) { - struct image_header_table *iht = (void *)ptr + - zynqhdr->image_header_table_offset; - struct partition_header *ph; - uint32_t ph_offset; - uint32_t next; - int i; - - ph_offset = le32_to_cpu(iht->partition_header_offset) * 4; - ph = (void *)ptr + ph_offset; - for (i = 0; i < le32_to_cpu(iht->nr_parts); i++) { - next = le32_to_cpu(ph->next_partition_offset) * 4; - - print_partition(ptr, ph); - - ph = (void *)ptr + next; - } + for_each_zynqmp_part(zynqhdr, i, ph) { + print_partition(ptr, ph); } free(dynamic_header); @@ -296,7 +282,7 @@ static int zynqmpimage_check_params(struct image_tool_params *params) return -1; } - return !(params->lflag || params->dflag); + return !(params->lflag || params->dflag || params->outfile); } static int zynqmpimage_check_image_types(uint8_t type) @@ -431,6 +417,39 @@ static void zynqmpimage_set_header(void *ptr, struct stat *sbuf, int ifd, zynqhdr->checksum = zynqmpimage_checksum(zynqhdr); } +static int zynqmpimage_partition_extract(struct zynqmp_header *zynqhdr, + const struct partition_header *ph, + const char *filename) +{ + ulong data = (ulong)zynqmp_get_offset(zynqhdr, ph->offset); + unsigned long len = le32_to_cpu(ph->len_enc) * 4; + + return imagetool_save_subimage(filename, data, len); +} + +/** + * zynqmpimage_extract_contents - retrieve a sub-image component from the image + * @ptr: pointer to the image header + * @params: command line parameters + * + * returns: + * zero in case of success or a negative value if fail. + */ +static int zynqmpimage_extract_contents(void *ptr, struct image_tool_params *params) +{ + struct zynqmp_header *zynqhdr = (struct zynqmp_header *)ptr; + struct partition_header *ph; + int i; + + for_each_zynqmp_part(zynqhdr, i, ph) { + if (i == params->pflag) + return zynqmpimage_partition_extract(ptr, ph, params->outfile); + } + + printf("No partition found\n"); + return -1; +} + static int zynqmpimage_vrec_header(struct image_tool_params *params, struct image_type_params *tparams) { @@ -484,7 +503,7 @@ U_BOOT_IMAGE_TYPE( zynqmpimage_verify_header, zynqmpimage_print_header, zynqmpimage_set_header, - NULL, + zynqmpimage_extract_contents, zynqmpimage_check_image_types, NULL, zynqmpimage_vrec_header diff --git a/tools/zynqmpimage.h b/tools/zynqmpimage.h index ca7489835a8..32be0d125fd 100644 --- a/tools/zynqmpimage.h +++ b/tools/zynqmpimage.h @@ -135,4 +135,62 @@ struct zynqmp_header { void zynqmpimage_default_header(struct zynqmp_header *ptr); void zynqmpimage_print_header(const void *ptr, struct image_tool_params *params); +static inline struct image_header_table * +zynqmp_get_iht(const struct zynqmp_header *zynqhdr) +{ + if (!zynqhdr->image_header_table_offset) + return NULL; + return (struct image_header_table *)((void *)zynqhdr + zynqhdr->image_header_table_offset); +} + +static inline void *zynqmp_get_offset(const struct zynqmp_header *zynqhdr, + uint32_t offset) +{ + uint32_t offset_cpu = le32_to_cpu(offset); + + if (!offset_cpu) + return NULL; + return (void *)zynqhdr + offset_cpu * 4; +} + +static inline struct partition_header * +zynqmp_part_first(const struct zynqmp_header *zynqhdr) +{ + struct image_header_table *iht; + + iht = zynqmp_get_iht(zynqhdr); + if (!iht) + return NULL; + + return zynqmp_get_offset(zynqhdr, iht->partition_header_offset); +} + +static inline struct partition_header * +zynqmp_part_next(const struct zynqmp_header *zynqhdr, + const struct partition_header *ph) +{ + return zynqmp_get_offset(zynqhdr, ph->next_partition_offset); +} + +static inline size_t zynqmp_part_count(const struct zynqmp_header *zynqhdr) +{ + struct image_header_table *iht; + + iht = zynqmp_get_iht(zynqhdr); + if (!iht) + return 0; + + return le32_to_cpu(iht->nr_parts); +} + +#define _for_each_zynqmp_part(_zynqhdr, _iter, _ph, _start, _count) \ + for (_iter = 0, _ph = _start; \ + _iter < (_count) && _ph; \ + _iter++, _ph = zynqmp_part_next(_zynqhdr, _ph)) + +#define for_each_zynqmp_part(_zynqhdr, _iter, _ph) \ + _for_each_zynqmp_part(_zynqhdr, _iter, _ph, \ + zynqmp_part_first(_zynqhdr), \ + zynqmp_part_count(_zynqhdr)) + #endif /* _ZYNQMPIMAGE_H_ */ From patchwork Thu Jan 4 18:50:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1882587 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=collins.com header.i=@collins.com header.a=rsa-sha256 header.s=POD051818 header.b=IvT4Y1dR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T5bMy1gPjz1ydd for ; Fri, 5 Jan 2024 05:53:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DD08E8798B; Thu, 4 Jan 2024 19:53:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collins.com 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=collins.com header.i=@collins.com header.b="IvT4Y1dR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 80D7487989; Thu, 4 Jan 2024 19:53:24 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mx0b-00105401.pphosted.com (mx0b-00105401.pphosted.com [67.231.152.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4BA4B87966 for ; Thu, 4 Jan 2024 19:53:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=collins.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=brandon.maier@collins.com Received: from pps.filterd (m0346902.ppops.net [127.0.0.1]) by mx0a-00105401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 404HZise012318; Thu, 4 Jan 2024 18:53:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=collins.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=POD051818; bh=JqkHZvDZrmtTvlF/atK/d/HbNYYeilSic2d5Zf9nfN8=; b=IvT4Y1dR2TmkeaAx84b446f0f0Ut+LsNlTvfcTT7yZ2997VJlHRR9CSVwpZ3UQ1JXuTv sSfjzzUOQJ3VCRaunW14l3Jty6KnmSu1nUJBKf10KRPabssBXd9uoaFpHjoF8+AEQsDk 1MgMymFEvO6ZGYWKmp6gcJHbJWF9fllOcUpw/uyzA9f37l4zL1Bm7UqkPzXe6ybyiu0k xhuDc0yI6nbb/hvmhmGAhzfpGtxUEWYEMFn+dczfQDeLTgLOMY96EzQQ/6HB3fBOy5G4 cL1PlEssqk6l3zt4fVaUyHTExQ9boBklN4Cc2YYTtTNHzIE61FbV7VM6cFjm0erMARaV pg== Received: from xusxph004rp050.rtx.com (xusxph004rp050.rtx.com [128.13.120.147]) by mx0a-00105401.pphosted.com (PPS) with ESMTPS id 3ve179hbx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 04 Jan 2024 18:53:19 +0000 Received: from xusxph005rp020.corp.ray.com ([128.13.121.224]) by xusxph004rp050.rtx.com (8.17.1.19/8.17.1.19) with ESMTPS id 404IrI5v006936 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Jan 2024 18:53:18 GMT Received: from dtulimr01.rockwellcollins.com (snat-utc-mailhub.rockwellcollins.com [10.172.224.19]) by xusxph005rp020.corp.ray.com (8.17.1.19/8.17.1.19) with ESMTPS id 404IrHLP013712 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 4 Jan 2024 18:53:17 GMT X-Received: from bspbox.kirk (kirk.rockwellcollins.lab [10.148.204.208]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id 3B7E7600C1; Thu, 4 Jan 2024 12:53:17 -0600 (CST) From: Brandon Maier To: Michal Simek , Simon Glass Cc: Brandon Maier , This contributor prefers not to receive mails , u-boot@lists.denx.de Subject: [PATCH 4/4] tools: zynqmpimage: print partition names Date: Thu, 4 Jan 2024 18:50:09 +0000 Message-ID: <20240104185258.39465-4-brandon.maier@collins.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240104185258.39465-1-brandon.maier@collins.com> References: <20240104185258.39465-1-brandon.maier@collins.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_11,2024-01-03_01,2023-05-22_02 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-04_11,2024-01-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=958 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 malwarescore=0 mlxlogscore=884 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 X-Proofpoint-ORIG-GUID: GX_JqvzKL6v0xNlTyq6TL7jF7yli67Az X-Proofpoint-GUID: GX_JqvzKL6v0xNlTyq6TL7jF7yli67Az X-Proofpoint-Spam-Details: rule=outbound_default_notspam policy=outbound_default score=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401040147 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.8 at phobos.denx.de X-Virus-Status: Clean Each partition may belong to an image, which has a name. That name can be useful for debugging as it helps identify where the partition came from. Signed-off-by: Brandon Maier --- tools/zynqmpimage.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ tools/zynqmpimage.h | 49 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) diff --git a/tools/zynqmpimage.c b/tools/zynqmpimage.c index 307edd63ebb..4db9877127e 100644 --- a/tools/zynqmpimage.c +++ b/tools/zynqmpimage.c @@ -135,6 +135,53 @@ static int zynqmpimage_verify_header(unsigned char *ptr, int image_size, return 0; } +static struct image_header * +find_partition_image(const struct zynqmp_header *zynqhdr, + const struct partition_header *ph) +{ + struct partition_header *ph_walk; + struct image_header *ih; + int i; + + for_each_zynqmp_image(zynqhdr, ih) { + for_each_zynqmp_part_in_image(zynqhdr, i, ph_walk, ih) { + if (ph == ph_walk) + return ih; + } + } + + return NULL; +} + +static void print_partition_name(const struct zynqmp_header *zynqhdr, + const struct partition_header *ph) +{ + const struct image_header *ih; + size_t word_len; + char *name; + int i; + + ih = find_partition_image(zynqhdr, ph); + if (!ih) + return; + + /* Name is stored in big-endian words, find the terminating word and + * byte-swap into a new buffer + */ + word_len = strlen((char *)ih->image_name); + word_len = ALIGN(word_len + 1, 4); + + name = calloc(1, word_len); + if (!name) + return; + + for (i = 0; i < word_len / 4; i++) + ((uint32_t *)name)[i] = uswap_32(ih->image_name[i]); + + printf(" Image name : %s\n", name); + free(name); +} + static void print_partition(const void *ptr, const struct partition_header *ph) { uint32_t attr = le32_to_cpu(ph->attributes); @@ -163,6 +210,7 @@ static void print_partition(const void *ptr, const struct partition_header *ph) dest_cpus[(attr & PART_ATTR_DEST_CPU_MASK) >> 8], dest_devs[(attr & PART_ATTR_DEST_DEVICE_MASK) >> 4]); + print_partition_name(ptr, ph); printf(" Offset : 0x%08x\n", le32_to_cpu(ph->offset) * 4); printf(" Size : %lu (0x%lx) bytes\n", len, len); if (len != len_unenc) diff --git a/tools/zynqmpimage.h b/tools/zynqmpimage.h index 32be0d125fd..7c47dc0763b 100644 --- a/tools/zynqmpimage.h +++ b/tools/zynqmpimage.h @@ -51,6 +51,14 @@ struct image_header_table { uint32_t checksum; /* 0x3c */ }; +struct image_header { + uint32_t next_image_header_offset; /* 0x00 */ + uint32_t corresponding_partition_header; /* 0x04 */ + uint32_t __reserved1; /* 0x08 */ + uint32_t partition_count; /* 0x0c */ + uint32_t image_name[]; /* 0x10 */ +}; + #define PART_ATTR_VEC_LOCATION 0x800000 #define PART_ATTR_BS_BLOCK_SIZE_MASK 0x700000 #define PART_ATTR_BS_BLOCK_SIZE_DEFAULT 0x000000 @@ -193,4 +201,45 @@ static inline size_t zynqmp_part_count(const struct zynqmp_header *zynqhdr) zynqmp_part_first(_zynqhdr), \ zynqmp_part_count(_zynqhdr)) +static inline struct partition_header * +zynqmp_part_in_image_first(const struct zynqmp_header *zynqhdr, + const struct image_header *ih) +{ + return zynqmp_get_offset(zynqhdr, ih->corresponding_partition_header); +} + +static inline size_t zynqmp_part_in_image_count(const struct image_header *ih) +{ + return le32_to_cpu(ih->partition_count); +} + +#define for_each_zynqmp_part_in_image(_zynqhdr, _iter, _ph, _ih) \ + _for_each_zynqmp_part(_zynqhdr, _iter, _ph, \ + zynqmp_part_in_image_first(_zynqhdr, _ih), \ + zynqmp_part_in_image_count(_ih)) + +static inline struct image_header * +zynqmp_image_first(const struct zynqmp_header *zynqhdr) +{ + struct image_header_table *iht; + + iht = zynqmp_get_iht(zynqhdr); + if (!iht) + return NULL; + + return zynqmp_get_offset(zynqhdr, iht->image_header_offset); +} + +static inline struct image_header * +zynqmp_image_next(const struct zynqmp_header *zynqhdr, + const struct image_header *ih) +{ + return zynqmp_get_offset(zynqhdr, ih->next_image_header_offset); +} + +#define for_each_zynqmp_image(_zynqhdr, _ih) \ + for (_ih = zynqmp_image_first(_zynqhdr); \ + _ih; \ + _ih = zynqmp_image_next(_zynqhdr, _ih)) + #endif /* _ZYNQMPIMAGE_H_ */