aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2015-06-03 13:58:48 +0000
committerJohn Crispin <john@openwrt.org>2015-06-03 13:58:48 +0000
commit5d3f0eea1c2ff9e72ba9c2a750e45e915e9bae52 (patch)
treec07493925b66ca3edc8da35ec72849c0f1ccc73f /tools
parentf9f093baa33cb747d511f741cae514307a0671f4 (diff)
downloadupstream-5d3f0eea1c2ff9e72ba9c2a750e45e915e9bae52.tar.gz
upstream-5d3f0eea1c2ff9e72ba9c2a750e45e915e9bae52.tar.bz2
upstream-5d3f0eea1c2ff9e72ba9c2a750e45e915e9bae52.zip
tools/firmware-utils: Allow changing the CRC32 poly value in mkbrnimg
VGV7519 is currently the only device with brnboot support. It seems to be happy with 0x2083b8ed as CRC32 poly. However, VGV7510KW22 fails to validate the checksum - it requires 0x04c11db7 instead. I have built an brnboot image manually on the command line, once with the old code and then with the new code but passing the old CRC32 poly value. Both resulted in a brnboot image with the same sha1sum. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> SVN-Revision: 45881
Diffstat (limited to 'tools')
-rw-r--r--tools/firmware-utils/src/mkbrnimg.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/tools/firmware-utils/src/mkbrnimg.c b/tools/firmware-utils/src/mkbrnimg.c
index fff92c4ef6..fde30b2ea5 100644
--- a/tools/firmware-utils/src/mkbrnimg.c
+++ b/tools/firmware-utils/src/mkbrnimg.c
@@ -32,9 +32,14 @@
static uint32_t crc32[1<<BPB];
+static char *output_file = "default-brnImage";
+static uint32_t magic = 0x12345678;
+static char *signature = "BRNDTW502";
+static uint32_t crc32_poly = 0x2083b8ed;
+
static void init_crc32()
{
- const uint32_t poly = ntohl(0x2083b8ed);
+ const uint32_t poly = ntohl(crc32_poly);
int n;
for (n = 0; n < 1<<BPB; n++) {
@@ -61,21 +66,17 @@ static void usage(const char *) __attribute__ (( __noreturn__ ));
static void usage(const char *mess)
{
fprintf(stderr, "Error: %s\n", mess);
- fprintf(stderr, "Usage: mkbrnimg [-o output_file] [-m magic] [-s signature] kernel_file [additional files]\n");
+ fprintf(stderr, "Usage: mkbrnimg [-o output_file] [-m magic] [-s signature] [-p crc32 poly] kernel_file [additional files]\n");
fprintf(stderr, "\n");
exit(1);
}
-static char *output_file = "default-brnImage";
-static uint32_t magic = 0x12345678;
-static char *signature = "BRNDTW502";
-
static void parseopts(int *argc, char ***argv)
{
char *endptr;
int res;
- while ((res = getopt(*argc, *argv, "o:m:s:")) != -1) {
+ while ((res = getopt(*argc, *argv, "o:m:s:p:")) != -1) {
switch (res) {
default:
usage("Unknown option");
@@ -91,6 +92,11 @@ static void parseopts(int *argc, char ***argv)
case 's':
signature = optarg;
break;
+ case 'p':
+ crc32_poly = strtoul(optarg, &endptr, 0);
+ if (endptr == optarg || *endptr != 0)
+ usage("'crc32 poly' must be a decimal or hexadecimal 32-bit value");
+ break;
}
}
*argc -= optind;