summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2001-04-30 00:06:35 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2001-04-30 00:06:35 +0000
commit8e7f0800961d8727193b14ca0553967bb0241d81 (patch)
tree7b8b442e16b10d448942803c8ccdde5cac58c7c7
parentff22fa3bb18d5bd296027f9b142e767e1b767aa4 (diff)
Fix the s-records encoding program so as to produce correct final
checksum if the chunk size is not 3 bytes. Update disillusionned comment accordingly. Ok deraadt@ [Note that the s-records files on the 2.9 cdroms have been corrected and are valid.]
-rw-r--r--sys/arch/mvme68k/stand/sboot/srec.c10
-rw-r--r--sys/arch/mvme88k/stand/sboot/srec.c10
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);
}