[PATCH] firmware-utils: tplink-safeloader: use revision field

Sander Vanheule sander at svanheule.net
Wed Sep 1 12:15:57 PDT 2021


The structured soft-version partition has a field which contains a
(source) revision number. Factory images used to include this, but
it was accidentaly removed during an earlier refactoring.

Include the source revision number again in the generated soft-version
partition. Additionaly, also show this revision number when printing
image info.

Fixes: 1a211af2cb3b ("firmware-utils: tplink-safeloader: refactor meta-partition generation")
Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
This patch conflicts with my other tplink-safeloader patch [1] due to the
PKG_RELEASE version bump. Depending on which would get merged first, the
other patch needs to be rebased to bump from v10 to v11.

[1] http://lists.infradead.org/pipermail/openwrt-devel/2021-August/036172.html

Best,
Sander

 tools/firmware-utils/Makefile                | 2 +-
 tools/firmware-utils/src/tplink-safeloader.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 7b669ac0c661..ccc5e4609180 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME := firmware-utils
-PKG_RELEASE := 9
+PKG_RELEASE := 10
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/kernel.mk
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index bd4d4b562ec7..2ec7dd1416c2 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -2681,6 +2681,7 @@ static struct image_partition_entry make_soft_version(
 		.month = bcd(tm->tm_mon+1),
 		.day = bcd(tm->tm_mday),
+		.rev = htonl(rev),
 
 		.compat_level = htonl(info->soft_ver_compat_level)
 	};
 
@@ -3368,6 +3369,7 @@ static int firmware_info(const char *input)
 
 			printf("Version: %d.%d.%d\n", s->version_major, s->version_minor, s->version_patch);
 			printf("Date: %02x%02x-%02x-%02x\n", s->year_hi, s->year_lo, s->month, s->day);
+			printf("Revision: %d\n", ntohl(s->rev));
 		} else {
 			printf("Failed to parse data\n");
 		}
-- 
2.31.1




More information about the openwrt-devel mailing list