[coreboot] r791 - coreboot-v3/util/options

svn at coreboot.org svn at coreboot.org
Thu Aug 21 17:49:29 CEST 2008


Author: rminnich
Date: 2008-08-21 17:49:29 +0200 (Thu, 21 Aug 2008)
New Revision: 791

Modified:
   coreboot-v3/util/options/build_opt_tbl.c
Log:
Emergency patch so that section checker won't bounce option tables.

Also gets rid of hard-codes in fwrite for strings that might, in future,
vary.

Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
Acked-by: Ronald G. Minnich <rminnich at gmail.com>



Modified: coreboot-v3/util/options/build_opt_tbl.c
===================================================================
--- coreboot-v3/util/options/build_opt_tbl.c	2008-08-20 15:10:23 UTC (rev 790)
+++ coreboot-v3/util/options/build_opt_tbl.c	2008-08-21 15:49:29 UTC (rev 791)
@@ -237,7 +237,8 @@
 	int enum_length;
 	int len;
 	char buf[16];
-
+	char *preamble = "const unsigned char option_table[] = {";
+	char *postamble = "};\n";
         for(i=1;i<argc;i++) {
                 if(argv[i][0]!='-') {
                         display_usage();
@@ -503,7 +504,7 @@
 		}
 	}
 	/* write the header */
-        if(!fwrite("unsigned char option_table[] = {",1,32,fp)) {
+        if(!fwrite(preamble,1,strlen(preamble),fp)) {
                 fprintf(stderr, "Error - Could not write image file\n");
                 fclose(fp);
                 exit(1);
@@ -517,7 +518,7 @@
 	/* write the end */
 	sprintf(buf,"0x%02x",cmos_table[i]);
 	fwrite(buf,1,4,fp);
-        if(!fwrite("};\n",1,3,fp)) {
+        if(!fwrite(postamble,1,strlen(postamble),fp)) {
                 fprintf(stderr, "Error - Could not write image file\n");
                 fclose(fp);
                 exit(1);





More information about the coreboot mailing list