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
This commit is contained in:
parent
f9f093baa3
commit
5d3f0eea1c
1 changed files with 13 additions and 7 deletions
|
@ -32,9 +32,14 @@
|
||||||
|
|
||||||
static uint32_t crc32[1<<BPB];
|
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()
|
static void init_crc32()
|
||||||
{
|
{
|
||||||
const uint32_t poly = ntohl(0x2083b8ed);
|
const uint32_t poly = ntohl(crc32_poly);
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < 1<<BPB; 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)
|
static void usage(const char *mess)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: %s\n", 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");
|
fprintf(stderr, "\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *output_file = "default-brnImage";
|
|
||||||
static uint32_t magic = 0x12345678;
|
|
||||||
static char *signature = "BRNDTW502";
|
|
||||||
|
|
||||||
static void parseopts(int *argc, char ***argv)
|
static void parseopts(int *argc, char ***argv)
|
||||||
{
|
{
|
||||||
char *endptr;
|
char *endptr;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
while ((res = getopt(*argc, *argv, "o:m:s:")) != -1) {
|
while ((res = getopt(*argc, *argv, "o:m:s:p:")) != -1) {
|
||||||
switch (res) {
|
switch (res) {
|
||||||
default:
|
default:
|
||||||
usage("Unknown option");
|
usage("Unknown option");
|
||||||
|
@ -91,6 +92,11 @@ static void parseopts(int *argc, char ***argv)
|
||||||
case 's':
|
case 's':
|
||||||
signature = optarg;
|
signature = optarg;
|
||||||
break;
|
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;
|
*argc -= optind;
|
||||||
|
|
Loading…
Reference in a new issue