Use SUN-style checksums per default. The checksums on SUN OPB (at least on SPARC Enterprise platforms: M4000, M9000) is not implemented according to Open Firmware IEEE 1275-1994. This patch creates bug compatibility. Signed-off-by: Stefan Reinauer Index: toke/emit.c =================================================================== --- toke/emit.c (revision 670) +++ toke/emit.c (working copy) @@ -7,7 +7,7 @@ * This program is part of a free implementation of the IEEE 1275-1994 * Standard for Boot (Initialization Configuration) Firmware. * - * Copyright (C) 2001-2005 Stefan Reinauer, + * Copyright (C) 2001-2010 Stefan Reinauer, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -317,7 +317,7 @@ /* Calculate and place checksum and length, if haven't already */ if ( fcode_start_ob_off != -1 ) { - u16 checksum; + u32 checksum; int length; u8 *fcode_body = ostart+fcode_body_ob_off; @@ -331,7 +331,17 @@ fcode_body < ob_end ; checksum += *(fcode_body++) ) ; - BIG_ENDIAN_WORD_STORE(fcode_hdr->checksum , checksum); + if (sun_style_checksums) { + /* SUN OPB on the SPARC (Enterprise) platforms: M4000, M9000 + * expects a checksum algorithm that is not compliant to + * IEEE 1275-1994 section 5.2.2.5 + */ + checksum = (checksum & 0xffff) + (checksum >> 16); + checksum = (checksum & 0xffff) + (checksum >> 16); + } + + BIG_ENDIAN_WORD_STORE(fcode_hdr->checksum, + (u16)(checksum & 0xffff)); BIG_ENDIAN_LONG_STORE(fcode_hdr->length , length); if (verbose) Index: toke/clflags.c =================================================================== --- toke/clflags.c (revision 670) +++ toke/clflags.c (working copy) @@ -5,7 +5,7 @@ * This program is part of a free implementation of the IEEE 1275-1994 * Standard for Boot (Initialization Configuration) Firmware. * - * Copyright (C) 2001-2005 Stefan Reinauer, + * Copyright (C) 2001-2010 Stefan Reinauer, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,6 +94,7 @@ bool ibm_legacy_separator_message = TRUE ; bool enable_abort_quote = TRUE ; bool sun_style_abort_quote = TRUE ; +bool sun_style_checksums = TRUE ; bool abort_quote_throw = TRUE ; bool string_remark_escape = TRUE ; bool hex_remark_escape = TRUE ; @@ -181,6 +182,11 @@ "\t", "Use -2 THROW in an Abort\" phrase, rather than ABORT" } , + { "Sun-Checksums", + &sun_style_checksums, + "\t\t", + "Use this for SPARC (Enterprise) platforms: M4000, M9000" } , + { "String-remark-escape", &string_remark_escape, "\t", @@ -640,8 +646,8 @@ for ( indx = 0 ; indx < number_of_cl_flags ; indx++ ) { - printf(" %s %s%s%s\n", - *(cl_flags_list[indx].flag_var) ? " " : "no" , + printf(" %s %s%s%s\n", + *(cl_flags_list[indx].flag_var) ? "yes" : "no " , cl_flags_list[indx].clflag_name, cl_flags_list[indx].clflag_tabs, cl_flags_list[indx].clflag_expln); Index: toke/clflags.h =================================================================== --- toke/clflags.h (revision 670) +++ toke/clflags.h (working copy) @@ -8,7 +8,7 @@ * This program is part of a free implementation of the IEEE 1275-1994 * Standard for Boot (Initialization Configuration) Firmware. * - * Copyright (C) 2001-2005 Stefan Reinauer, + * Copyright (C) 2001-2010 Stefan Reinauer, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,6 +56,7 @@ * ibm_legacy_separator_message * enable_abort_quote * sun_style_abort_quote + * sun_style_checksums * string_remark_escape * hex_remark_escape * c_style_string_escape @@ -111,6 +112,7 @@ extern bool ibm_legacy_separator_message; extern bool enable_abort_quote; extern bool sun_style_abort_quote; +extern bool sun_style_checksums; extern bool abort_quote_throw; extern bool string_remark_escape; extern bool hex_remark_escape;