aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-06-03 13:58:48 +0000
committerJohn Crispin <blogic@openwrt.org>2015-06-03 13:58:48 +0000
commit9631957f47ba0180e8290e84daa6a6d9f5e0dfb4 (patch)
tree03087561901b8501e9912758fb5ca1b484325d27 /tools/firmware-utils
parentbf98ea70d66688c54ce035a9f6e3888afa004b9e (diff)
downloadmaster-187ad058-9631957f47ba0180e8290e84daa6a6d9f5e0dfb4.tar.gz
master-187ad058-9631957f47ba0180e8290e84daa6a6d9f5e0dfb4.tar.bz2
master-187ad058-9631957f47ba0180e8290e84daa6a6d9f5e0dfb4.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> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45881 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'tools/firmware-utils')
-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;