diff options
Diffstat (limited to 'tools/firmware-utils')
-rw-r--r-- | tools/firmware-utils/Makefile | 2 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkdlinkfw-lib.c | 36 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkdlinkfw-lib.h | 7 | ||||
-rw-r--r-- | tools/firmware-utils/src/mkdlinkfw.c | 2 |
4 files changed, 5 insertions, 42 deletions
diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 63df63191d..a2f698622b 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -82,7 +82,7 @@ define Host/Compile $(call cc,mkbuffaloimg, -Wall) $(call cc,zyimage, -Wall) $(call cc,mkdhpimg buffalo-lib, -Wall) - $(call cc,mkdlinkfw mkdlinkfw-lib, -lz -Wall --std=gnu99) + $(call cc,mkdlinkfw mkdlinkfw-lib, -lz -Wall) $(call cc,dns313-header, -Wall) $(call cc,mksercommfw, -Wall --std=gnu99) endef diff --git a/tools/firmware-utils/src/mkdlinkfw-lib.c b/tools/firmware-utils/src/mkdlinkfw-lib.c index fcab856231..a661c0bc82 100644 --- a/tools/firmware-utils/src/mkdlinkfw-lib.c +++ b/tools/firmware-utils/src/mkdlinkfw-lib.c @@ -32,8 +32,6 @@ extern char *progname; -static unsigned char jffs2_eof_mark[4] = { 0xde, 0xad, 0xc0, 0xde }; - uint32_t jboot_timestamp(void) { time_t rawtime; @@ -106,40 +104,6 @@ int read_to_buf(const struct file_info *fdata, char *buf) return ret; } -int pad_jffs2(char *buf, int currlen, int maxlen) -{ - int len; - uint32_t pad_mask; - - len = currlen; - pad_mask = (4 * 1024) | (64 * 1024); /* EOF at 4KB and at 64KB */ - while ((len < maxlen) && (pad_mask != 0)) { - uint32_t mask; - int i; - - for (i = 10; i < 32; i++) { - mask = 1 << i; - if (pad_mask & mask) - break; - } - - len = ALIGN(len, mask); - - for (i = 10; i < 32; i++) { - mask = 1 << i; - if ((len & (mask - 1)) == 0) - pad_mask &= ~mask; - } - - for (i = 0; i < sizeof(jffs2_eof_mark); i++) - buf[len + i] = jffs2_eof_mark[i]; - - len += sizeof(jffs2_eof_mark); - } - - return len; -} - int write_fw(const char *ofname, const char *data, int len) { FILE *f; diff --git a/tools/firmware-utils/src/mkdlinkfw-lib.h b/tools/firmware-utils/src/mkdlinkfw-lib.h index d61124cb63..da4ecf010c 100644 --- a/tools/firmware-utils/src/mkdlinkfw-lib.h +++ b/tools/firmware-utils/src/mkdlinkfw-lib.h @@ -33,6 +33,10 @@ #define SCH2_MAGIC 0x2124 #define SCH2_VER 0x02 +/* + * compression type values in the header + * so far onlysupport for LZMA is added + */ #define FLAT 0 #define JZ 1 #define GZIP 2 @@ -49,8 +53,6 @@ #define FACTORY 0 #define SYSUPGRADE 1 -#define ALIGN(x, a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); }) - #define ERR(fmt, ...) do { \ fflush(0); \ fprintf(stderr, "[%s] *** error: " fmt "\n", \ @@ -77,7 +79,6 @@ uint32_t jboot_timestamp(void); uint16_t jboot_checksum(uint16_t start_val, uint16_t *data, int size); int get_file_stat(struct file_info *fdata); int read_to_buf(const struct file_info *fdata, char *buf); -int pad_jffs2(char *buf, int currlen, int maxlen); int write_fw(const char *ofname, const char *data, int len); #endif /* mkdlinkfw_lib_h */ diff --git a/tools/firmware-utils/src/mkdlinkfw.c b/tools/firmware-utils/src/mkdlinkfw.c index 87605004fe..71828bd91a 100644 --- a/tools/firmware-utils/src/mkdlinkfw.c +++ b/tools/firmware-utils/src/mkdlinkfw.c @@ -101,9 +101,7 @@ char *progname; uint32_t firmware_size; uint16_t family_member; char *rom_id[12] = { 0 }; - char image_type; -int add_jffs2_eof; static void usage(int status) { |