diff options
-rw-r--r-- | sys/arch/mvme68k/stand/sboot/srec.c | 10 | ||||
-rw-r--r-- | sys/arch/mvme88k/stand/sboot/srec.c | 10 |
2 files changed, 11 insertions, 9 deletions
diff --git a/sys/arch/mvme68k/stand/sboot/srec.c b/sys/arch/mvme68k/stand/sboot/srec.c index 93ee5e2e53f..2919febe660 100644 --- a/sys/arch/mvme68k/stand/sboot/srec.c +++ b/sys/arch/mvme68k/stand/sboot/srec.c @@ -1,10 +1,9 @@ -/* $OpenBSD: srec.c,v 1.3 1996/04/28 10:49:45 deraadt Exp $ */ +/* $OpenBSD: srec.c,v 1.4 2001/04/30 00:06:26 miod Exp $ */ /* * Public domain, believed to be by Mike Price. * * convert binary file to Srecord format - * XXX srec generates improper checksums for 4-byte dumps */ #include <stdio.h> #include <ctype.h> @@ -75,10 +74,11 @@ main(argc, argv) } /* - * kludge -> don't know why you have to add the +1 = works - * for size =3 at least + * kludge -> some sizes need an extra count (1 if size == 3, 2 if + * size == 4). Don't ask why. */ - printf("%02X\n", checksum(base, (char *) 0, 0, size) + 1); + printf("%02X\n", checksum(base, (char *) 0, 0, size) + + (size - 2)); exit (0); } diff --git a/sys/arch/mvme88k/stand/sboot/srec.c b/sys/arch/mvme88k/stand/sboot/srec.c index 164fb4b458c..04458ecfcd6 100644 --- a/sys/arch/mvme88k/stand/sboot/srec.c +++ b/sys/arch/mvme88k/stand/sboot/srec.c @@ -1,8 +1,9 @@ +/* $OpenBSD: srec.c,v 1.2 2001/04/30 00:06:34 miod Exp $ */ + /* * Public domain, believed to be by Mike Price. * * convert binary file to Srecord format - * XXX srec generates improper checksums for 4-byte dumps */ #include <stdio.h> #include <ctype.h> @@ -73,10 +74,11 @@ main(argc, argv) } /* - * kludge -> don't know why you have to add the +1 = works - * for size =3 at least + * kludge -> some sizes need an extra count (1 if size == 3, 2 if + * size == 4). Don't ask why. */ - printf("%02X\n", checksum(base, (char *) 0, 0, size) + 1); + printf("%02X\n", checksum(base, (char *) 0, 0, size) + + (size - 2)); exit (0); } |