[PATCH] tools/firmware-utils: remove all std= settings

Rosen Penev rosenp at gmail.com
Sat Oct 2 13:42:25 PDT 2021

The minimum GCC today is GCC6, which defaults to gnu11. Compatibility
with older compilers is not needed.

Also removed fgnu89-inline. I have no idea why this was kept. Easier to
just fix the issue.

Added byteswap header to avoid warning about missing bswap_32 on some

Signed-off-by: Rosen Penev <rosenp at gmail.com>
 tools/firmware-utils/Makefile             | 16 ++++++++--------
 tools/firmware-utils/src/mktplinkfw-lib.h |  8 ++++----
 tools/firmware-utils/src/mktplinkfw.c     |  1 +
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index d5b0816816..a9e500cee2 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 PKG_NAME := firmware-utils
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/kernel.mk
@@ -54,7 +54,7 @@ define Host/Compile
 	$(call cc,mkdapimg,-Wall)
 	$(call cc,mkdapimg2,-Wall)
 	$(call cc,mkdhpimg buffalo-lib,-Wall)
-	$(call cc,mkdlinkfw mkdlinkfw-lib,-lz -Wall --std=c99)
+	$(call cc,mkdlinkfw mkdlinkfw-lib,-lz -Wall)
 	$(call cc,mkdniimg,-Wall)
 	$(call cc,mkedimaximg,-Wall)
 	$(call cc,mkfwimage,-lz -Wall -Werror -Wextra -D_FILE_OFFSET_BITS=64)
@@ -66,13 +66,13 @@ define Host/Compile
 	$(call cc,mkmylofw,-Wall)
 	$(call cc,mkplanexfw sha1,-Wall)
 	$(call cc,mkporayfw,-Wall)
-	$(call cc,mkrasimage,--std=gnu99 -Wall)
+	$(call cc,mkrasimage,-Wall)
 	$(call cc,mkrtn56uimg,-lz -Wall)
-	$(call cc,mksenaofw md5,-Wall --std=gnu99)
+	$(call cc,mksenaofw md5,-Wall)
 	$(call cc,mksercommfw,-Wall)
 	$(call cc,mktitanimg,-Wall)
-	$(call cc,mktplinkfw mktplinkfw-lib md5,-Wall -fgnu89-inline)
-	$(call cc,mktplinkfw2 mktplinkfw-lib md5,-Wall -fgnu89-inline)
+	$(call cc,mktplinkfw mktplinkfw-lib md5,-Wall)
+	$(call cc,mktplinkfw2 mktplinkfw-lib md5,-Wall)
 	$(call cc,mkwrggimg md5,-Wall)
 	$(call cc,mkwrgimg md5,-Wall)
 	$(call cc,mkzcfw cyg_crc32,-Wall)
@@ -80,7 +80,7 @@ define Host/Compile
 	$(call cc,mkzyxelzldfw md5,-Wall)
 	$(call cc,motorola-bin,-Wall)
 	$(call cc,nand_ecc,-Wall)
-	$(call cc,nec-enc,-Wall --std=gnu99)
+	$(call cc,nec-enc,-Wall)
 	$(call cc,osbridge-crc,-Wall)
 	$(call cc,oseama md5,-Wall)
 	$(call cc,otrx,-Wall)
@@ -90,7 +90,7 @@ define Host/Compile
 	$(call cc,sign_dlink_ru md5,-Wall)
 	$(call cc,spw303v,-Wall)
 	$(call cc,srec2bin)
-	$(call cc,tplink-safeloader md5,-Wall --std=gnu99)
+	$(call cc,tplink-safeloader md5,-Wall)
 	$(call cc,trx,-Wall)
 	$(call cc,trx2edips,-Wall)
 	$(call cc,trx2usr,-Wall)
diff --git a/tools/firmware-utils/src/mktplinkfw-lib.h b/tools/firmware-utils/src/mktplinkfw-lib.h
index 2003908cf9..a46a16f8f3 100644
--- a/tools/firmware-utils/src/mktplinkfw-lib.h
+++ b/tools/firmware-utils/src/mktplinkfw-lib.h
@@ -55,10 +55,10 @@ void get_md5(const char *data, int size, uint8_t *md5);
 int get_file_stat(struct file_info *fdata);
 int read_to_buf(const struct file_info *fdata, char *buf);
 int write_fw(const char *ofname, const char *data, int len);
-inline void inspect_fw_pstr(const char *label, const char *str);
-inline void inspect_fw_phex(const char *label, uint32_t val);
-inline void inspect_fw_phexdec(const char *label, uint32_t val);
-inline void inspect_fw_pmd5sum(const char *label, const uint8_t *val, const char *text);
+void inspect_fw_pstr(const char *label, const char *str);
+void inspect_fw_phex(const char *label, uint32_t val);
+void inspect_fw_phexdec(const char *label, uint32_t val);
+void inspect_fw_pmd5sum(const char *label, const uint8_t *val, const char *text);
 int build_fw(size_t header_size);
 #endif /* mktplinkfw_lib_h */
diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c
index e6d76a1942..16eff49d1f 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -7,6 +7,7 @@
  *   Copyright (C) 2008,2009 Wang Jian <lark at linux.net.cn>
+#include <byteswap.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>

More information about the openwrt-devel mailing list