aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils/src/trx.c
diff options
context:
space:
mode:
authorFUKAUMI Naoki <naobsd@gmail.com>2017-01-29 01:05:54 +0900
committerRafał Miłecki <rafal@milecki.pl>2017-01-31 10:55:02 +0100
commit7faee1bc9f9ede0e23de19d6156dc8d769431bb3 (patch)
tree1a29ef2ce5644eaf7d569b6073603cb23ac3793a /tools/firmware-utils/src/trx.c
parentbc32f7deb57706e6235ec82ed0e2637c63deadff (diff)
downloadupstream-7faee1bc9f9ede0e23de19d6156dc8d769431bb3.tar.gz
upstream-7faee1bc9f9ede0e23de19d6156dc8d769431bb3.tar.bz2
upstream-7faee1bc9f9ede0e23de19d6156dc8d769431bb3.zip
firmware-utils: improve tools for Buffalo DHP series
some of Buffalo DHP series use slightly different trx magic, buffalo-enc, buffalo-tag, and factory image begin with 'bgn'. this patch adds support for building those images. Signed-off-by: FUKAUMI Naoki <naobsd@gmail.com>
Diffstat (limited to 'tools/firmware-utils/src/trx.c')
-rw-r--r--tools/firmware-utils/src/trx.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/firmware-utils/src/trx.c b/tools/firmware-utils/src/trx.c
index aa1f5be4b6..dc5bb672ae 100644
--- a/tools/firmware-utils/src/trx.c
+++ b/tools/firmware-utils/src/trx.c
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
int c, i, append = 0;
size_t n;
ssize_t n2;
- uint32_t cur_len, fsmark=0;
+ uint32_t cur_len, fsmark=0, magic;
unsigned long maxlen = TRX_MAX_LEN;
struct trx_header *p;
char trx_version = 1;
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
in = NULL;
i = 0;
- while ((c = getopt(argc, argv, "-:2o:m:a:x:b:f:A:F:")) != -1) {
+ while ((c = getopt(argc, argv, "-:2o:m:a:x:b:f:A:F:M:")) != -1) {
switch (c) {
case '2':
/* take care that nothing was written to buf so far */
@@ -243,6 +243,15 @@ int main(int argc, char **argv)
}
break;
+ case 'M':
+ errno = 0;
+ magic = strtoul(optarg, &e, 0);
+ if (errno || (e == optarg) || *e) {
+ fprintf(stderr, "illegal numeric string\n");
+ usage();
+ }
+ p->magic = STORE32_LE(magic);
+ break;
default:
usage();
}