summaryrefslogtreecommitdiff
path: root/tools/firmware-utils/src/mkdniimg.c
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-05-31 22:53:24 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-05-31 22:53:24 +0000
commit145402e11b0a4299c7cb8c666dbb1309281e89d5 (patch)
treea26c8fec3b381eedf2eac80784bfd7f6a4c00826 /tools/firmware-utils/src/mkdniimg.c
parentc8d182406d58ce6c329af47a28519fc1434002c7 (diff)
downloadmtk-20170518-145402e11b0a4299c7cb8c666dbb1309281e89d5.zip
mtk-20170518-145402e11b0a4299c7cb8c666dbb1309281e89d5.tar.gz
mtk-20170518-145402e11b0a4299c7cb8c666dbb1309281e89d5.tar.bz2
tools/firmware-utils: add support for hd_id tag into mkdniimg
Signed-off-by: Mark Mentovai <mark@moxienet.com> SVN-Revision: 27052
Diffstat (limited to 'tools/firmware-utils/src/mkdniimg.c')
-rw-r--r--tools/firmware-utils/src/mkdniimg.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/firmware-utils/src/mkdniimg.c b/tools/firmware-utils/src/mkdniimg.c
index 48e1727..7230f09 100644
--- a/tools/firmware-utils/src/mkdniimg.c
+++ b/tools/firmware-utils/src/mkdniimg.c
@@ -28,6 +28,7 @@ static char *progname;
static char *ofname;
static char *version = "1.00.00";
static char *region = "";
+static char *hd_id;
static char *board_id;
/*
@@ -60,6 +61,7 @@ void usage(int status)
" -o <file> write output to the file <file>\n"
" -v <version> set image version to <version>\n"
" -r <region> set image region to <region>\n"
+" -H <hd_id> set image hardware id to <hd_id>\n"
" -h show this screen\n"
);
@@ -73,7 +75,7 @@ int main(int argc, char *argv[])
int err;
struct stat st;
char *buf;
- int i;
+ int pos, rem, i;
uint8_t csum;
FILE *outfile, *infile;
@@ -83,7 +85,7 @@ int main(int argc, char *argv[])
while ( 1 ) {
int c;
- c = getopt(argc, argv, "B:i:o:v:r:h");
+ c = getopt(argc, argv, "B:i:o:v:r:H:h");
if (c == -1)
break;
@@ -103,6 +105,9 @@ int main(int argc, char *argv[])
case 'r':
region = optarg;
break;
+ case 'H':
+ hd_id = optarg;
+ break;
case 'h':
usage(EXIT_SUCCESS);
break;
@@ -141,8 +146,12 @@ int main(int argc, char *argv[])
}
memset(buf, 0, DNI_HDR_LEN);
- snprintf(buf, DNI_HDR_LEN, "device:%s\nversion:V%s\nregion:%s\n",
- board_id, version, region);
+ pos = snprintf(buf, DNI_HDR_LEN, "device:%s\nversion:V%s\nregion:%s\n",
+ board_id, version, region);
+ rem = DNI_HDR_LEN - pos;
+ if (pos >= 0 && rem > 1 && hd_id) {
+ snprintf(buf + pos, rem, "hd_id:%s\n", hd_id);
+ }
infile = fopen(ifname, "r");
if (infile == NULL) {