[coreboot] [PATCH] Fixes the build error while generating option_table.h

Vikram Narayanan vikram186 at gmail.com
Sun May 8 19:54:41 CEST 2011


Hi, 
I was facing a compilation error while the make is trying to generate the option_table.h from cmos.layout file. 
Unfortunately the error info generated doesn't tell where the problem is. While going through the source, I found the error producing lines.
Below is the code snippet.
<code>
if (!is_ident((char *)ce->name)) {
			fprintf(stderr,
				"Error - Name %s is an invalid identifier in line\n %s\n",
				ce->name, line);
			exit(1);
		}
</code>
Since the ce->name and line doesn't contain any thing, the make just showed me this.
"Error - Name is an invalid identifier in line"
After spending a little time I found that the line endings in the file cmos.layout are the one that is causing issues. (Think I have opened the file in windows.)
A little change in the code can make the user happy and he doesn't need to worry about the line endings. (If this isn't a good idea, may be we can give the user a more intuitive error. something like "please check your line endings". If you want it this way, I will post the patch for that too).
Please share your views.

Signed-off by: Vikram Narayanan <vikram186 at gmail.com>
---
--- a/util/options/build_opt_tbl.c.orig	Sun May  8 22:18:54 2011
+++ a/util/options/build_opt_tbl.c	Sun May  8 22:34:34 2011
@@ -372,7 +372,7 @@
 
 		/* skip commented and blank lines */
 		if(line[0]=='#') continue;
-		if(line[strspn(line," ")]=='\n') continue;
+		if(line[0]=='\n' || line[0]=='\r') continue;
 		/* scan in the input data */
 		sscanf(line,"%d %d %c %d %s",
 			&ce->bit,&ce->length,&uc,&ce->config_id,&ce->name[0]);

-
Thanks,
Vikram 




More information about the coreboot mailing list