F7D3301/F7D7301, F7D3302/F7D7302 and F7D4301 all have replacements for the TRX magic ("HDR0"), and all those models also appear to support a single "QA" TRX magic. Add all of this to the lzmaloader's trx recognition code.
Signed-off-by: Cody P Schafer <de...@codyps.com> --- .../brcm47xx/image/lzma-loader/src/decompress.c | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/target/linux/brcm47xx/image/lzma-loader/src/decompress.c b/target/linux/brcm47xx/image/lzma-loader/src/decompress.c index 05681b1..56f4500 100644 --- a/target/linux/brcm47xx/image/lzma-loader/src/decompress.c +++ b/target/linux/brcm47xx/image/lzma-loader/src/decompress.c @@ -90,6 +90,11 @@ struct trx_header { #define EDIMAX_PS_HEADER_MAGIC 0x36315350 /* "PS16" */ #define EDIMAX_PS_HEADER_LEN 0xc /* 12 bytes long for edimax header */ +#define BELKIN_F7D3301_MAGIC 0x20100322 /* a date of some sort */ +#define BELKIN_F7D3302_MAGIC 0x20090928 +#define BELKIN_F7D4302_MAGIC 0x20101006 +#define BELKIN_F7DXXXX_QA_MAGIC 0x12345678 + /* beyound the image end, size not known in advance */ extern unsigned char workspace[]; @@ -121,6 +126,23 @@ static __inline__ unsigned char get_byte(void) return read_byte(0, &buffer, &fake), *buffer; } +static int has_trx_magic(unsigned char *data) +{ + UInt32 magic = ((struct trx_header *)data)->magic; + + switch (magic) { + case TRX_MAGIC: + case EDIMAX_PS_HEADER_MAGIC: + case BELKIN_F7D3301_MAGIC: + case BELKIN_F7D3302_MAGIC: + case BELKIN_F7D4302_MAGIC: + case BELKIN_F7DXXXX_QA_MAGIC: + return 1; + default: + return 0; + } +} + /* should be the first function */ void entry(unsigned long icache_size, unsigned long icache_lsize, unsigned long dcache_size, unsigned long dcache_lsize, @@ -138,8 +160,7 @@ void entry(unsigned long icache_size, unsigned long icache_lsize, /* look for trx header, 32-bit data access */ for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH)); - ((struct trx_header *)data)->magic != TRX_MAGIC && - ((struct trx_header *)data)->magic != EDIMAX_PS_HEADER_MAGIC; + !has_trx_magic(data); data += 65536); if (((struct trx_header *)data)->magic == EDIMAX_PS_HEADER_MAGIC) -- 1.8.4.2 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel