[OpenWrt-Devel] [PATCH v1 2/7] mtd: Add custom trx magic option to mtd tool
Will Sheppard
sheppard.will at gmail.com
Mon Feb 9 11:29:19 EST 2015
Signed-off-by: Will Sheppard <wsheppard at embedded-bits.co.uk>
---
package/system/mtd/Makefile | 8 +++++++-
package/system/mtd/src/trx.c | 6 ++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/package/system/mtd/Makefile b/package/system/mtd/Makefile
index 8d7bb44..91c4fac 100644
--- a/package/system/mtd/Makefile
+++ b/package/system/mtd/Makefile
@@ -39,7 +39,13 @@ endef
target=$(firstword $(subst -, ,$(BOARD)))
MAKE_FLAGS += TARGET="$(target)"
-TARGET_CFLAGS := $(TARGET_CFLAGS) -Dtarget_$(target)=1 -Wall
+
+
+TARGET_CFLAGS := $(TARGET_CFLAGS) -Dtarget_$(target)=1 -Wall
+
+ifdef CONFIG_KERNEL_TRX_MAGIC_OVERRIDE
+ TARGET_CFLAGS += -DCONFIG_KERNEL_TRX_MAGIC_OVERRIDE -DCONFIG_KERNEL_TRX_MAGIC=$(CONFIG_KERNEL_TRX_MAGIC)
+endif
ifdef CONFIG_MTD_REDBOOT_PARTS
MAKE_FLAGS += FIS_SUPPORT=1
diff --git a/package/system/mtd/src/trx.c b/package/system/mtd/src/trx.c
index 089d1ac..5d0f364 100644
--- a/package/system/mtd/src/trx.c
+++ b/package/system/mtd/src/trx.c
@@ -34,7 +34,13 @@
#include "mtd.h"
#include "crc32.h"
+#ifndef CONFIG_KERNEL_TRX_MAGIC_OVERRIDE
+#warning Using default TRX MAGIC
#define TRX_MAGIC 0x30524448 /* "HDR0" */
+#else
+#warning mtd is using overridden TRX_MAGIC
+#define TRX_MAGIC (CONFIG_KERNEL_TRX_MAGIC)
+#endif
struct trx_header {
uint32_t magic; /* "HDR0" */
uint32_t len; /* Length of file including 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