mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH v2 2/5] scripts: rockchip: rename hashtype to flags
Date: Tue, 05 Aug 2025 09:33:47 +0200	[thread overview]
Message-ID: <20250805-rkimage-cleanup-v2-2-5d015f6c9059@pengutronix.de> (raw)
In-Reply-To: <20250805-rkimage-cleanup-v2-0-5d015f6c9059@pengutronix.de>

The hashtype is actually a bitfield that contains flags for the
different hash types and other information. Rename the field to flags
and add constants for the flags in this field.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
Changes in v2:
- none
---
 scripts/rkimage.c  | 5 +++--
 scripts/rockchip.h | 5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/rkimage.c b/scripts/rkimage.c
index ba89f32d9376d0153692baa3ddde1c793c1e4cc2..4c972746cdabbc831b0b5c0024e840c81b1c1120 100644
--- a/scripts/rkimage.c
+++ b/scripts/rkimage.c
@@ -66,11 +66,12 @@ static int create_newidb(struct newidb *idb)
 
 	idb->magic = NEWIDB_MAGIC;
 	idb->n_files = (n_code << 16) | (1 << 7) | (1 << 8);
+	idb->flags = 0;
 
 	if (hash_type == HASH_TYPE_SHA256)
-		idb->hashtype = (1 << 0);
+		idb->flags |= NEWIDB_FLAGS_SHA256;
 	else if (hash_type == HASH_TYPE_SHA512)
-		idb->hashtype = (1 << 1);
+		idb->flags |= NEWIDB_FLAGS_SHA512;
 
 	if (!keep_cert)
 		image_offset = 4;
diff --git a/scripts/rockchip.h b/scripts/rockchip.h
index 2d060fdefe909118d157a7aafef3284a35679fe3..8033878b34d369c7e291f38fd2a4beaaf395556b 100644
--- a/scripts/rockchip.h
+++ b/scripts/rockchip.h
@@ -3,6 +3,9 @@
 
 #define NEWIDB_MAGIC 0x534e4b52 /* 'RKNS' */
 
+#define NEWIDB_FLAGS_SHA256	(1U << 0)
+#define NEWIDB_FLAGS_SHA512	(1U << 1)
+
 struct newidb_entry {
 	uint32_t sector;
 	uint32_t unknown_ffffffff;
@@ -16,7 +19,7 @@ struct newidb {
 	uint32_t magic;
 	unsigned char unknown1[4];
 	uint32_t n_files;
-	uint32_t hashtype;
+	uint32_t flags;
 	unsigned char unknown2[8];
 	unsigned char unknown3[8];
 	unsigned char unknown4[88];

-- 
2.39.5




  parent reply	other threads:[~2025-08-05  7:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05  7:33 [PATCH v2 0/5] scripts: rockchip: fix and cleanup rkimage Michael Tretter
2025-08-05  7:33 ` [PATCH v2 1/5] scripts: rockchip: use correct header size Michael Tretter
2025-08-05  7:33 ` Michael Tretter [this message]
2025-08-05  7:33 ` [PATCH v2 3/5] scripts: rockchip: add helper for updating hash Michael Tretter
2025-08-05  7:33 ` [PATCH v2 4/5] scripts: rockchip: rename NEWIDB_MAGIC to NEWIDB_MAGIC_RKNS Michael Tretter
2025-08-05  7:33 ` [PATCH v2 5/5] scripts: rockchip: support RKSS images Michael Tretter
2025-08-05  9:05 ` [PATCH v2 0/5] scripts: rockchip: fix and cleanup rkimage Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250805-rkimage-cleanup-v2-2-5d015f6c9059@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox