mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] scripts: rockchip: rename SECTOR_SIZE/PAGE_SIZE
Date: Thu,  5 Jun 2025 13:25:23 +0200	[thread overview]
Message-ID: <20250605112524.1958636-1-a.fatoum@pengutronix.de> (raw)

musl was found to define PAGE_SIZE on its own, which conflicts with the
definition we use in the host tool. Add a RK_ prefix for the
Rockchip-specific SECTOR_SIZE and PAGE_SIZE macros to avoid this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/rk-usb-loader.c | 4 ++--
 scripts/rkimage.c       | 4 ++--
 scripts/rockchip.h      | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/rk-usb-loader.c b/scripts/rk-usb-loader.c
index ad70cfe27147..2e0d5488deb9 100644
--- a/scripts/rk-usb-loader.c
+++ b/scripts/rk-usb-loader.c
@@ -266,8 +266,8 @@ static int upload_image(const char *filename)
 
 		log_info("Uploading %d/%d\n", i + 1, n_files);
 
-		foffset = (entry->sector & 0xffff) * SECTOR_SIZE;
-		fsize = (entry->sector >> 16) * SECTOR_SIZE;
+		foffset = (entry->sector & 0xffff) * RK_SECTOR_SIZE;
+		fsize = (entry->sector >> 16) * RK_SECTOR_SIZE;
 
 		log_debug("image starting at offset 0x%08x, size 0x%08x\n", foffset, fsize);
 
diff --git a/scripts/rkimage.c b/scripts/rkimage.c
index 551114ed8220..b31893fe8f45 100644
--- a/scripts/rkimage.c
+++ b/scripts/rkimage.c
@@ -82,7 +82,7 @@ static int create_newidb(struct newidb *idb)
 		struct rkcode *c = &code[i];
 		unsigned int image_sector;
 
-		image_sector = c->size / SECTOR_SIZE;
+		image_sector = c->size / RK_SECTOR_SIZE;
 
 		entry->sector  = (image_sector << 16) + image_offset;
 		entry->unknown_ffffffff = 0xffffffff;
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
 			exit(1);
 
 		c->path = path;
-		c->size = ALIGN(s.st_size, PAGE_SIZE);
+		c->size = ALIGN(s.st_size, RK_PAGE_SIZE);
 		c->buf = calloc(c->size, 1);
 		if (!c->buf)
 			exit(1);
diff --git a/scripts/rockchip.h b/scripts/rockchip.h
index 8cc14f8f2fbd..2d060fdefe90 100644
--- a/scripts/rockchip.h
+++ b/scripts/rockchip.h
@@ -29,7 +29,7 @@ struct newidb {
 	unsigned char hash[512];
 };
 
-#define SECTOR_SIZE 512
-#define PAGE_SIZE 2048
+#define RK_SECTOR_SIZE 512
+#define RK_PAGE_SIZE 2048
 
 #endif /* __ROCKCHIP_H */
-- 
2.39.5




             reply	other threads:[~2025-06-05 11:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 11:25 Ahmad Fatoum [this message]
2025-06-05 11:25 ` [PATCH 2/2] ci: add new musl-tools Github CI workflow Ahmad Fatoum
2025-06-05 11:54 ` [PATCH 1/2] scripts: rockchip: rename SECTOR_SIZE/PAGE_SIZE 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=20250605112524.1958636-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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