mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 06:01:16 +02:00
Replace --mainboard with -p internal:mainboard
NOTE: The --list-supported-wiki output changed to use -p internal:mainboard= instead of -m The --list-supported output changed the heading of the mainboard list from Vendor Board Status Required option to Vendor Board Status Required value for -p internal:mainboard= Fix lb_vendor_dev_from_string() not to write to the supplied string. Corresponding to flashrom svn r1483. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
@ -2070,7 +2070,8 @@ static int it8718f_gpio63_raise(void)
|
|||||||
* The coreboot ids are used two fold. When running with a coreboot firmware,
|
* The coreboot ids are used two fold. When running with a coreboot firmware,
|
||||||
* the ids uniquely matches the coreboot board identification string. When a
|
* the ids uniquely matches the coreboot board identification string. When a
|
||||||
* legacy bios is installed and when autodetection is not possible, these ids
|
* legacy bios is installed and when autodetection is not possible, these ids
|
||||||
* can be used to identify the board through the -m command line argument.
|
* can be used to identify the board through the -p internal:mainboard=
|
||||||
|
* programmer parameter.
|
||||||
*
|
*
|
||||||
* When a board is identified through its coreboot ids (in both cases), the
|
* When a board is identified through its coreboot ids (in both cases), the
|
||||||
* main pci ids are still required to match, as a safeguard.
|
* main pci ids are still required to match, as a safeguard.
|
||||||
@ -2245,7 +2246,8 @@ static const struct board_match *board_match_cbname(const char *vendor,
|
|||||||
msg_pinfo("AMBIGUOUS BOARD NAME: %s\n", part);
|
msg_pinfo("AMBIGUOUS BOARD NAME: %s\n", part);
|
||||||
msg_pinfo("At least vendors '%s' and '%s' match.\n",
|
msg_pinfo("At least vendors '%s' and '%s' match.\n",
|
||||||
partmatch->lb_vendor, board->lb_vendor);
|
partmatch->lb_vendor, board->lb_vendor);
|
||||||
msg_perr("Please use the full -m vendor:part syntax.\n");
|
msg_perr("Please use the full -p internal:mainboard="
|
||||||
|
"vendor:part syntax.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
partmatch = board;
|
partmatch = board;
|
||||||
@ -2259,7 +2261,8 @@ static const struct board_match *board_match_cbname(const char *vendor,
|
|||||||
* coreboot table. If it was, the coreboot implementor is
|
* coreboot table. If it was, the coreboot implementor is
|
||||||
* expected to fix flashrom, too.
|
* expected to fix flashrom, too.
|
||||||
*/
|
*/
|
||||||
msg_perr("\nUnknown vendor:board from -m option: %s:%s\n\n",
|
msg_perr("\nUnknown vendor:board from -p internal:mainboard="
|
||||||
|
" programmer parameter:\n%s:%s\n\n",
|
||||||
vendor, part);
|
vendor, part);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
19
cbtable.c
19
cbtable.c
@ -33,18 +33,27 @@
|
|||||||
char *lb_part = NULL, *lb_vendor = NULL;
|
char *lb_part = NULL, *lb_vendor = NULL;
|
||||||
int partvendor_from_cbtable = 0;
|
int partvendor_from_cbtable = 0;
|
||||||
|
|
||||||
void lb_vendor_dev_from_string(char *boardstring)
|
/* Parse the [<vendor>:]<board> string specified by the user as part of
|
||||||
|
* -p internal:mainboard=[<vendor>:]<board> and set lb_vendor and lb_part
|
||||||
|
* to the extracted values.
|
||||||
|
* Note: strtok modifies the original string, so we work on a copy and allocate
|
||||||
|
* memory for lb_vendor and lb_part with strdup.
|
||||||
|
*/
|
||||||
|
void lb_vendor_dev_from_string(const char *boardstring)
|
||||||
{
|
{
|
||||||
|
/* strtok may modify the original string. */
|
||||||
|
char *tempstr = strdup(boardstring);
|
||||||
char *tempstr2 = NULL;
|
char *tempstr2 = NULL;
|
||||||
strtok(boardstring, ":");
|
strtok(tempstr, ":");
|
||||||
tempstr2 = strtok(NULL, ":");
|
tempstr2 = strtok(NULL, ":");
|
||||||
if (tempstr2) {
|
if (tempstr2) {
|
||||||
lb_vendor = boardstring;
|
lb_vendor = strdup(tempstr);
|
||||||
lb_part = tempstr2;
|
lb_part = strdup(tempstr2);
|
||||||
} else {
|
} else {
|
||||||
lb_vendor = NULL;
|
lb_vendor = NULL;
|
||||||
lb_part = boardstring;
|
lb_part = strdup(tempstr);
|
||||||
}
|
}
|
||||||
|
free(tempstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long compute_checksum(void *addr, unsigned long length)
|
static unsigned long compute_checksum(void *addr, unsigned long length)
|
||||||
|
@ -106,7 +106,7 @@ static void cli_classic_usage(const char *name)
|
|||||||
"-z|"
|
"-z|"
|
||||||
#endif
|
#endif
|
||||||
"-E|-r <file>|-w <file>|-v <file>]\n"
|
"-E|-r <file>|-w <file>|-v <file>]\n"
|
||||||
" [-c <chipname>] [-m [<vendor>:]<part>] [-l <file>]\n"
|
" [-c <chipname>] [-l <file>]\n"
|
||||||
" [-i <image>] [-p <programmername>[:<parameters>]]\n\n");
|
" [-i <image>] [-p <programmername>[:<parameters>]]\n\n");
|
||||||
|
|
||||||
printf("Please note that the command line interface for flashrom has "
|
printf("Please note that the command line interface for flashrom has "
|
||||||
@ -128,11 +128,6 @@ static void cli_classic_usage(const char *name)
|
|||||||
" -V | --verbose more verbose output\n"
|
" -V | --verbose more verbose output\n"
|
||||||
" -c | --chip <chipname> probe only for specified "
|
" -c | --chip <chipname> probe only for specified "
|
||||||
"flash chip\n"
|
"flash chip\n"
|
||||||
#if CONFIG_INTERNAL == 1
|
|
||||||
/* FIXME: --mainboard should be a programmer parameter */
|
|
||||||
" -m | --mainboard <[vendor:]part> override mainboard "
|
|
||||||
"detection\n"
|
|
||||||
#endif
|
|
||||||
" -f | --force force specific operations "
|
" -f | --force force specific operations "
|
||||||
"(see man page)\n"
|
"(see man page)\n"
|
||||||
" -n | --noverify don't auto-verify\n"
|
" -n | --noverify don't auto-verify\n"
|
||||||
@ -190,7 +185,6 @@ int main(int argc, char *argv[])
|
|||||||
{"verify", 1, NULL, 'v'},
|
{"verify", 1, NULL, 'v'},
|
||||||
{"noverify", 0, NULL, 'n'},
|
{"noverify", 0, NULL, 'n'},
|
||||||
{"chip", 1, NULL, 'c'},
|
{"chip", 1, NULL, 'c'},
|
||||||
{"mainboard", 1, NULL, 'm'},
|
|
||||||
{"verbose", 0, NULL, 'V'},
|
{"verbose", 0, NULL, 'V'},
|
||||||
{"force", 0, NULL, 'f'},
|
{"force", 0, NULL, 'f'},
|
||||||
{"layout", 1, NULL, 'l'},
|
{"layout", 1, NULL, 'l'},
|
||||||
@ -275,17 +269,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
erase_it = 1;
|
erase_it = 1;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
|
||||||
#if CONFIG_INTERNAL == 1
|
|
||||||
tempstr = strdup(optarg);
|
|
||||||
lb_vendor_dev_from_string(tempstr);
|
|
||||||
#else
|
|
||||||
fprintf(stderr, "Error: Internal programmer support "
|
|
||||||
"was not compiled in and --mainboard only\n"
|
|
||||||
"applies to the internal programmer. Aborting.\n");
|
|
||||||
cli_classic_abort_usage();
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case 'f':
|
case 'f':
|
||||||
force = 1;
|
force = 1;
|
||||||
break;
|
break;
|
||||||
@ -426,14 +409,6 @@ int main(int argc, char *argv[])
|
|||||||
if (prog == PROGRAMMER_INVALID)
|
if (prog == PROGRAMMER_INVALID)
|
||||||
prog = default_programmer;
|
prog = default_programmer;
|
||||||
|
|
||||||
#if CONFIG_INTERNAL == 1
|
|
||||||
if ((prog != PROGRAMMER_INTERNAL) && (lb_part || lb_vendor)) {
|
|
||||||
fprintf(stderr, "Error: --mainboard requires the internal "
|
|
||||||
"programmer. Aborting.\n");
|
|
||||||
cli_classic_abort_usage();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* FIXME: Delay calibration should happen in programmer code. */
|
/* FIXME: Delay calibration should happen in programmer code. */
|
||||||
myusec_calibrate_delay();
|
myusec_calibrate_delay();
|
||||||
|
|
||||||
|
28
flashrom.8
28
flashrom.8
@ -5,7 +5,7 @@ flashrom \- detect, read, write, verify and erase flash chips
|
|||||||
.B flashrom \fR[\fB\-n\fR] [\fB\-V\fR] [\fB\-f\fR] [\fB\-h\fR|\fB\-R\fR|\
|
.B flashrom \fR[\fB\-n\fR] [\fB\-V\fR] [\fB\-f\fR] [\fB\-h\fR|\fB\-R\fR|\
|
||||||
\fB\-L\fR|\fB\-z\fR|\fB\-E\fR|\fB\-r\fR <file>|\fB\-w\fR <file>|\
|
\fB\-L\fR|\fB\-z\fR|\fB\-E\fR|\fB\-r\fR <file>|\fB\-w\fR <file>|\
|
||||||
\fB\-v\fR <file>]
|
\fB\-v\fR <file>]
|
||||||
[\fB\-c\fR <chipname>] [\fB\-m\fR [<vendor>:]<board>] \
|
[\fB\-c\fR <chipname>] \
|
||||||
[\fB\-l\fR <file>]
|
[\fB\-l\fR <file>]
|
||||||
[\fB\-i\fR <image>] [\fB\-p\fR <programmername>[:<parameters>]]
|
[\fB\-i\fR <image>] [\fB\-p\fR <programmername>[:<parameters>]]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
@ -88,19 +88,6 @@ printed by
|
|||||||
without the vendor name as parameter. Please note that the chip name is
|
without the vendor name as parameter. Please note that the chip name is
|
||||||
case sensitive.
|
case sensitive.
|
||||||
.TP
|
.TP
|
||||||
.B "\-m, \-\-mainboard" [<vendor>:]<board>
|
|
||||||
Override mainboard settings.
|
|
||||||
.sp
|
|
||||||
flashrom reads the coreboot table to determine the current mainboard. If no
|
|
||||||
coreboot table could be read or if you want to override these values, you can
|
|
||||||
specify \-m, e.g.:
|
|
||||||
.sp
|
|
||||||
.B " flashrom \-\-mainboard AGAMI:ARUMA \-w agami_aruma.rom"
|
|
||||||
.sp
|
|
||||||
See the 'Known boards' or 'Known laptops' section in the output
|
|
||||||
of 'flashrom \-L' for a list of boards which require the specification of
|
|
||||||
the board name, if no coreboot table is found.
|
|
||||||
.TP
|
|
||||||
.B "\-f, \-\-force"
|
.B "\-f, \-\-force"
|
||||||
Force one or more of the following actions:
|
Force one or more of the following actions:
|
||||||
.sp
|
.sp
|
||||||
@ -245,10 +232,15 @@ autodetected using one of the following mechanisms: If your system is
|
|||||||
running coreboot, the mainboard type is determined from the coreboot table.
|
running coreboot, the mainboard type is determined from the coreboot table.
|
||||||
Otherwise, the mainboard is detected by examining the onboard PCI devices
|
Otherwise, the mainboard is detected by examining the onboard PCI devices
|
||||||
and possibly DMI info. If PCI and DMI do not contain information to uniquely
|
and possibly DMI info. If PCI and DMI do not contain information to uniquely
|
||||||
identify the mainboard (which is the exception), it might be necessary to
|
identify the mainboard (which is the exception), or if you want to override
|
||||||
specify the mainboard using the
|
the detected mainboard model, you can specify the mainboard using the
|
||||||
.B \-m
|
.sp
|
||||||
switch (see above).
|
.B " flashrom \-p internal:mainboard=[<vendor>:]<board>"
|
||||||
|
syntax.
|
||||||
|
.sp
|
||||||
|
See the 'Known boards' or 'Known laptops' section in the output
|
||||||
|
of 'flashrom \-L' for a list of boards which require the specification of
|
||||||
|
the board name, if no coreboot table is found.
|
||||||
.sp
|
.sp
|
||||||
Some of these board-specific flash enabling functions (called
|
Some of these board-specific flash enabling functions (called
|
||||||
.BR "board enables" )
|
.BR "board enables" )
|
||||||
|
10
internal.c
10
internal.c
@ -213,6 +213,16 @@ int internal_init(void)
|
|||||||
}
|
}
|
||||||
free(arg);
|
free(arg);
|
||||||
|
|
||||||
|
arg = extract_programmer_param("mainboard");
|
||||||
|
if (arg && strlen(arg)) {
|
||||||
|
lb_vendor_dev_from_string(arg);
|
||||||
|
} else if (arg && !strlen(arg)) {
|
||||||
|
msg_perr("Missing argument for mainboard.\n");
|
||||||
|
free(arg);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
free(arg);
|
||||||
|
|
||||||
get_io_perms();
|
get_io_perms();
|
||||||
if (register_shutdown(internal_shutdown, NULL))
|
if (register_shutdown(internal_shutdown, NULL))
|
||||||
return 1;
|
return 1;
|
||||||
|
25
layout.c
25
layout.c
@ -106,11 +106,11 @@ int show_id(uint8_t *bios, int size, int force)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If lb_vendor is not set, the coreboot table was
|
* If lb_vendor is not set, the coreboot table was
|
||||||
* not found. Nor was -m VENDOR:PART specified.
|
* not found. Nor was -p internal:mainboard=VENDOR:PART specified.
|
||||||
*/
|
*/
|
||||||
if (!lb_vendor || !lb_part) {
|
if (!lb_vendor || !lb_part) {
|
||||||
msg_pinfo("Note: If the following flash access fails, "
|
msg_pinfo("Note: If the following flash access fails, try "
|
||||||
"try -m <vendor>:<mainboard>.\n");
|
"-p internal:mainboard=<vendor>:<mainboard>.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,14 +126,17 @@ int show_id(uint8_t *bios, int size, int force)
|
|||||||
"seem to fit to this machine - forcing it.\n");
|
"seem to fit to this machine - forcing it.\n");
|
||||||
} else {
|
} else {
|
||||||
msg_pinfo("ERROR: Your firmware image (%s:%s) does not "
|
msg_pinfo("ERROR: Your firmware image (%s:%s) does not "
|
||||||
"appear to\n be correct for the detected "
|
"appear to\n"
|
||||||
"mainboard (%s:%s)\n\nOverride with -p internal:"
|
" be correct for the detected "
|
||||||
"boardmismatch=force if you are absolutely sure "
|
"mainboard (%s:%s)\n\n"
|
||||||
"that\nyou are using a correct "
|
"Override with -p internal:boardmismatch="
|
||||||
"image for this mainboard or override\nthe detected "
|
"force to ignore the board name in the\n"
|
||||||
"values with --mainboard <vendor>:<mainboard>.\n\n",
|
"firmware image or override the detected "
|
||||||
mainboard_vendor, mainboard_part, lb_vendor,
|
"mainboard with\n"
|
||||||
lb_part);
|
"-p internal:mainboard=<vendor>:<mainboard>."
|
||||||
|
"\n\n",
|
||||||
|
mainboard_vendor, mainboard_part, lb_vendor,
|
||||||
|
lb_part);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
print.c
7
print.c
@ -389,7 +389,10 @@ static void print_supported_boards_helper(const struct board_info *boards,
|
|||||||
for (i = strlen("Board"); i < maxboardlen; i++)
|
for (i = strlen("Board"); i < maxboardlen; i++)
|
||||||
msg_ginfo(" ");
|
msg_ginfo(" ");
|
||||||
|
|
||||||
msg_ginfo("Status Required option\n\n");
|
msg_ginfo("Status Required value for\n");
|
||||||
|
for (i = 0; i < maxvendorlen + maxboardlen + strlen("Status "); i++)
|
||||||
|
msg_ginfo(" ");
|
||||||
|
msg_ginfo("-p internal:mainboard=\n");
|
||||||
|
|
||||||
for (b = boards; b->vendor != NULL; b++) {
|
for (b = boards; b->vendor != NULL; b++) {
|
||||||
msg_ginfo("%s", b->vendor);
|
msg_ginfo("%s", b->vendor);
|
||||||
@ -407,7 +410,7 @@ static void print_supported_boards_helper(const struct board_info *boards,
|
|||||||
if (e->lb_vendor == NULL)
|
if (e->lb_vendor == NULL)
|
||||||
msg_ginfo("(autodetected)");
|
msg_ginfo("(autodetected)");
|
||||||
else
|
else
|
||||||
msg_ginfo("-m %s:%s", e->lb_vendor,
|
msg_ginfo("%s:%s", e->lb_vendor,
|
||||||
e->lb_part);
|
e->lb_part);
|
||||||
}
|
}
|
||||||
msg_ginfo("\n");
|
msg_ginfo("\n");
|
||||||
|
@ -167,7 +167,7 @@ static void wiki_helper(const char *devicetype, int cols,
|
|||||||
boards[i].url ? boards[i].url : "",
|
boards[i].url ? boards[i].url : "",
|
||||||
boards[i].name,
|
boards[i].name,
|
||||||
boards[i].url ? "]" : "",
|
boards[i].url ? "]" : "",
|
||||||
b[k].lb_vendor ? "-m " : "—",
|
b[k].lb_vendor ? "-p internal:mainboard=" : "—",
|
||||||
b[k].lb_vendor ? b[k].lb_vendor : "",
|
b[k].lb_vendor ? b[k].lb_vendor : "",
|
||||||
b[k].lb_vendor ? ":" : "",
|
b[k].lb_vendor ? ":" : "",
|
||||||
b[k].lb_vendor ? b[k].lb_part : "",
|
b[k].lb_vendor ? b[k].lb_part : "",
|
||||||
|
@ -264,7 +264,7 @@ int setup_cpu_msr(int cpu);
|
|||||||
void cleanup_cpu_msr(void);
|
void cleanup_cpu_msr(void);
|
||||||
|
|
||||||
/* cbtable.c */
|
/* cbtable.c */
|
||||||
void lb_vendor_dev_from_string(char *boardstring);
|
void lb_vendor_dev_from_string(const char *boardstring);
|
||||||
int coreboot_init(void);
|
int coreboot_init(void);
|
||||||
extern char *lb_part, *lb_vendor;
|
extern char *lb_part, *lb_vendor;
|
||||||
extern int partvendor_from_cbtable;
|
extern int partvendor_from_cbtable;
|
||||||
|
Reference in New Issue
Block a user