[PATCH 1/2] scripts: rockchip: rename SECTOR_SIZE/PAGE_SIZE
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Jun 5 04:25:23 PDT 2025
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 at 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
More information about the barebox
mailing list