[OpenWrt-Devel] [PATCH v1 4/7] trx: Add custom TRX option to trx firmware tool

Will Sheppard sheppard.will at gmail.com
Mon Feb 9 11:29:21 EST 2015


Signed-off-by: Will Sheppard <wsheppard at embedded-bits.co.uk>
---
 tools/firmware-utils/Makefile  |  4 ++++
 tools/firmware-utils/src/trx.c | 10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 83c51d7..9c9a6a5 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -18,7 +18,11 @@ endef
 define Host/Compile
 	mkdir -p $(HOST_BUILD_DIR)/bin
 	$(call cc,addpattern)
+ifeq ($(CONFIG_KERNEL_TRX_MAGIC_OVERRIDE),y)
+	$(call cc,trx,-DCONFIG_KERNEL_TRX_MAGIC_OVERRIDE -DCONFIG_KERNEL_TRX_MAGIC=$(CONFIG_KERNEL_TRX_MAGIC) )
+else
 	$(call cc,trx)
+endif
 	$(call cc,motorola-bin)
 	$(call cc,dgfirmware)
 	$(call cc,mksenaofw md5)
diff --git a/tools/firmware-utils/src/trx.c b/tools/firmware-utils/src/trx.c
index aa1f5be..848d67b 100644
--- a/tools/firmware-utils/src/trx.c
+++ b/tools/firmware-utils/src/trx.c
@@ -66,7 +66,15 @@ uint32_t crc32buf(char *buf, size_t len);
 /**********************************************************************/
 /* from trxhdr.h */
 
-#define TRX_MAGIC	0x30524448	/* "HDR0" */
+
+#ifndef CONFIG_KERNEL_TRX_MAGIC_OVERRIDE
+#warning  Using default TRX MAGIC
+#define TRX_MAGIC       0x30524448      /* "HDR0" */
+#else
+#warning TRX firmware tool is using overridden TRX_MAGIC
+#define TRX_MAGIC (CONFIG_KERNEL_TRX_MAGIC)
+#endif
+
 #define TRX_MAX_LEN	0x720000
 #define TRX_NO_HEADER	1		/* Do not write TRX header */
 
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list