1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-06-30 21:52:36 +02:00

CONFIG_DEFAULT_PROGRAMMER_NAME: Use programmer name instead of enum

CONFIG_DEFAULT_PROGRAMER_NAME replaces CONFIG_DEFAULT_PROGRAMMER.
It uses the name of the programmer for identification.
make CONFIG_DEFAULT_PROGRAMER_NAME=dummy and
meson -Ddefault_programmer_name=dummy will extend to
CONFIG_DEFAULT_PROGRAMER_NAME=&programmer_dummy in the code.

Change-Id: I976447787c6f6bfbdc0145d80d61e1ddcf97ac33
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/55123
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Thomas Heijligen
2021-06-01 16:22:14 +02:00
committed by Nico Huber
parent bf0396a600
commit 732aafdfec
5 changed files with 28 additions and 16 deletions

View File

@ -172,7 +172,6 @@ int main(int argc, char *argv[])
int read_it = 0, extract_it = 0, write_it = 0, erase_it = 0, verify_it = 0;
int dont_verify_it = 0, dont_verify_all = 0, list_supported = 0, operation_specified = 0;
struct flashrom_layout *layout = NULL;
// enum programmer prog = PROGRAMMER_INVALID;
static const struct programmer_entry *prog = NULL;
enum {
OPTION_IFD = 0x0100,
@ -544,12 +543,14 @@ int main(int argc, char *argv[])
}
if (prog == NULL) {
if (CONFIG_DEFAULT_PROGRAMMER != PROGRAMMER_INVALID) {
prog = programmer_table[CONFIG_DEFAULT_PROGRAMMER];
const struct programmer_entry *const default_programmer = CONFIG_DEFAULT_PROGRAMMER_NAME;
if (default_programmer) {
prog = default_programmer;
/* We need to strdup here because we free(pparam) unconditionally later. */
pparam = strdup(CONFIG_DEFAULT_PROGRAMMER_ARGS);
msg_pinfo("Using default programmer \"%s\" with arguments \"%s\".\n",
programmer_table[CONFIG_DEFAULT_PROGRAMMER]->name, pparam);
default_programmer->name, pparam);
} else {
msg_perr("Please select a programmer with the --programmer parameter.\n"
#if CONFIG_INTERNAL == 1