A patch was added without proper header.
Add a header that explains what the patch does and its prerequisites.
Fixes: e42e9c8133
Signed-off-by: Shine <4c.fce2@proton.me>
Link: https://github.com/openwrt/openwrt/pull/23917
Signed-off-by: Robert Marko <robimarko@gmail.com>
39 lines
1.3 KiB
Diff
39 lines
1.3 KiB
Diff
From 6f51da2bb799a8b77da0167eeea45d5d5125f39c Mon Sep 17 00:00:00 2001
|
|
From: Shine <4c.fce2@proton.me>
|
|
Date: Mon, 22 Jun 2026 14:45:39 +0200
|
|
Subject: fix fiptool build on musl host
|
|
|
|
Due to POSIX style ioctl(int,int,...) declaration, building fiptool under
|
|
MUSL generates a compiler warning (BLKGETSIZE64 == 0x80081272, ie. integer
|
|
overflow). This causes a build failure when compiling with -Werror and
|
|
-pedantic GCC switches enabled.
|
|
|
|
Selectively cast the parameter to (int) when hinted to be running on a
|
|
MUSL based build host.
|
|
|
|
Requires a __MUSL__ macro to be defined. MUSL does not provide such a
|
|
predefined macro, so this has to be passed explicitly to GCC, e.g. with
|
|
-D__MUSL__ during build.
|
|
|
|
For OpenWrt, this is done in the arm-trusted-firmware-tools Makefile,
|
|
see commit e42e9c8133fbd0dce7abfe1ec696383745448078
|
|
|
|
Signed-off-by: Shine <4c.fce2@proton.me>
|
|
---
|
|
tools/fiptool/fiptool.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
--- a/tools/fiptool/fiptool.c
|
|
+++ b/tools/fiptool/fiptool.c
|
|
@@ -318,7 +318,11 @@ static int parse_fip(const char *filename, fip_toc_header_t *toc_header_out)
|
|
|
|
#ifdef BLKGETSIZE64
|
|
if ((st.st_mode & S_IFBLK) != 0)
|
|
+#ifdef __MUSL__
|
|
+ if (ioctl(fileno(fp), (int)BLKGETSIZE64, &st_size) == -1)
|
|
+#else
|
|
if (ioctl(fileno(fp), BLKGETSIZE64, &st_size) == -1)
|
|
+#endif
|
|
log_err("ioctl %s", filename);
|
|
#endif
|
|
|