]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/cetools/files/sean-hsieh.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / cetools / files / sean-hsieh.patch
1
2 #
3 # Patch managed by http://www.holgerschurig.de/patcher.html
4 #
5
6 --- cetools-0.3/bin2rom.c~sean-hsieh
7 +++ cetools-0.3/bin2rom.c
8 @@ -14,6 +14,12 @@
9      You should have received a copy of the GNU General Public License
10      along with this program; if not, write to the Free Software
11      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
12 +
13 +       History:
14 +         07/14/2000    Sean Hsieh 
15 +                                       Clear padding bytes of the input buffer when 
16 +                                       "blockSize < BLOCKSIZE" to avoid the checksum
17 +                                       error
18  */
19  #include <stdio.h>
20  #include <sys/stat.h>
21 @@ -28,7 +34,7 @@
22  
23  #define min(a, b) (a<b)?(a):(b)
24  
25 -int bin2rom( char * inputName, char * outputName, long start, long boot )
26 +int bin2rom( char * inputName, char * outputName, long start, long boot, long record )
27  {
28      int input;
29      int output;
30 @@ -48,7 +54,7 @@
31      
32      int reste;
33      
34 -    printf("bin2rom : input filename = %s, output filename = %s, start = 0x%lx, boot=0x%lx\n", inputName, outputName, start, boot );
35 +    printf("bin2rom : input filename = %s, output filename = %s, start = 0x%08lx, boot=0x%08lx, record=0x%08lx\n", inputName, outputName, start, boot, record );
36  
37      input = open( inputName, O_RDONLY );
38      if( input == -1 )
39 @@ -247,7 +253,14 @@
40      while( reste > 0 )
41      {
42         blockSize = min( BLOCKSIZE, reste );
43 -       
44 +       /**********************************************************************/
45 +       /* Modified by Sean Hsieh                                             */
46 +       /* Clear the padding bytes to zero, this can avoid the checksum error */
47 +       /**********************************************************************/
48 +       if ( blockSize != BLOCKSIZE ) {
49 +               memset( inStart, 0, BLOCKSIZE );
50 +               //printf( "adding padding bytes\n" );
51 +       }
52         read( input, inStart, blockSize );
53  
54  #ifdef MAP_OUTPUT
55 @@ -285,7 +298,8 @@
56  
57      write( output, &boot, 4);
58  
59 -    write( output, &nullData, 4);
60 +    //write( output, &nullData, 4);
61 +       write( output, &record, 4);
62  
63  #endif
64  
65 @@ -339,17 +353,26 @@
66  {
67      long start;
68      long boot;
69 +       long record;
70      
71 -    if( argc < 5 )
72 +    if ( argc < 5 )
73      {
74 -       printf("bin2rom: <input file> <output file> <start address> <boot address>\n");
75 -       exit( -1 );
76 +               printf("bin2rom: <input file> <output file> <start address> <boot address> [<record address>] [-s] [-c]\n");
77 +               exit( -1 );
78      }
79      
80      sscanf( argv[3], "%lx", &start );
81      sscanf( argv[4], "%lx", &boot );
82 -        
83 -    bin2rom( argv[1], argv[2], start, boot );
84 +       if ( argc >= 6 )
85 +       {
86 +               sscanf( argv[5], "%lx", &record );
87 +       }
88 +       else 
89 +       {
90 +               record = 0xffffffff;
91 +       }
92 +       
93 +    bin2rom( argv[1], argv[2], start, boot, record );
94      
95      return 0;
96  }
97 \ No newline at end of file