I would have liked to get an ack, but the error this corrects is pretty
authorRonald G. Minnich <rminnich@gmail.com>
Sat, 9 May 2009 17:14:58 +0000 (17:14 +0000)
committerRonald G. Minnich <rminnich@gmail.com>
Sat, 9 May 2009 17:14:58 +0000 (17:14 +0000)
critical, since unless it is fixed this tool creates empty tables that cause
coreboot to (in some cases, e.g. on qemu) triple fault and die.

For the record, an empty option_table is not allowed. The table must,
at least, have 3 32-bit entries in this order:
type -- should be 200, 0r 0xc8, i.e. 0xc8, 0, 0, 0
size of table in LE order, 4 bytes
size of header in LE order, which is always 12,0,0,0

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Acked-by: Ronald G. Minnich <rminnich@gmail.com>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4264 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

util/options/build_opt_tbl.c

index f86090aeb49429e775dd4f48c1ccdcfdf105b39c..075387d1d8d89b5704261fa9620cc80ede77d6ef 100644 (file)
@@ -511,13 +511,13 @@ int main(int argc, char **argv)
                }
                /* write the array values */
                for(i=0;i<(ct->size-1);i++) {
-                       if(!(i%10) && !err) err=fwrite("\n\t",1,2,fp);
+                       if(!(i%10) && !err) err=!fwrite("\n\t",1,2,fp);
                        sprintf(buf,"0x%02x,",cmos_table[i]);
-                       if(!err) err=fwrite(buf,1,5,fp);
+                       if(!err) err=!fwrite(buf,1,5,fp);
                }
                /* write the end */
                sprintf(buf,"0x%02x\n",cmos_table[i]);
-               if(!err) err=fwrite(buf,1,4,fp);
+               if(!err) err=!fwrite(buf,1,4,fp);
                if(!fwrite("};\n",1,3,fp)) {
                        perror("Error - Could not write image file");
                        fclose(fp);