From 8e7f0800961d8727193b14ca0553967bb0241d81 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Mon, 30 Apr 2001 00:06:35 +0000 Subject: 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.] --- sys/arch/mvme68k/stand/sboot/srec.c | 10 +++++----- 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 #include @@ -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 #include @@ -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); } -- cgit v1.2.3