Changeset 1483 for trunk


Ignore:
Timestamp:
01/04/12 01:48:27 (5 months ago)
Author:
hailfinger
Message:

Replace --mainboard with -p internal:mainboard

--mainboard is a relic from a time before external programmers and makes
the CLI inconsistent.
Use a programmer parameter instead and free up the short option -m.

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.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>
Acked-by: Stefan Tauner <stefan.tauner@…>

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/board_enable.c

    r1469 r1483  
    20712071 * the ids uniquely matches the coreboot board identification string. When a 
    20722072 * legacy bios is installed and when autodetection is not possible, these ids 
    2073  * can be used to identify the board through the -m command line argument. 
     2073 * can be used to identify the board through the -p internal:mainboard= 
     2074 * programmer parameter. 
    20742075 * 
    20752076 * When a board is identified through its coreboot ids (in both cases), the 
     
    22462247                        msg_pinfo("At least vendors '%s' and '%s' match.\n", 
    22472248                                  partmatch->lb_vendor, board->lb_vendor); 
    2248                         msg_perr("Please use the full -m vendor:part syntax.\n"); 
     2249                        msg_perr("Please use the full -p internal:mainboard=" 
     2250                                 "vendor:part syntax.\n"); 
    22492251                        return NULL; 
    22502252                } 
     
    22602262                 * expected to fix flashrom, too. 
    22612263                 */ 
    2262                 msg_perr("\nUnknown vendor:board from -m option: %s:%s\n\n", 
     2264                msg_perr("\nUnknown vendor:board from -p internal:mainboard=" 
     2265                         " programmer parameter:\n%s:%s\n\n", 
    22632266                         vendor, part); 
    22642267        } 
  • trunk/cbtable.c

    r1284 r1483  
    3434int partvendor_from_cbtable = 0; 
    3535 
    36 void lb_vendor_dev_from_string(char *boardstring) 
    37 { 
     36/* Parse the [<vendor>:]<board> string specified by the user as part of 
     37 * -p internal:mainboard=[<vendor>:]<board> and set lb_vendor and lb_part 
     38 * to the extracted values. 
     39 * Note: strtok modifies the original string, so we work on a copy and allocate 
     40 * memory for lb_vendor and lb_part with strdup. 
     41 */ 
     42void lb_vendor_dev_from_string(const char *boardstring) 
     43{ 
     44        /* strtok may modify the original string. */ 
     45        char *tempstr = strdup(boardstring); 
    3846        char *tempstr2 = NULL; 
    39         strtok(boardstring, ":"); 
     47        strtok(tempstr, ":"); 
    4048        tempstr2 = strtok(NULL, ":"); 
    4149        if (tempstr2) { 
    42                 lb_vendor = boardstring; 
    43                 lb_part = tempstr2; 
     50                lb_vendor = strdup(tempstr); 
     51                lb_part = strdup(tempstr2); 
    4452        } else { 
    4553                lb_vendor = NULL; 
    46                 lb_part = boardstring; 
    47         } 
     54                lb_part = strdup(tempstr); 
     55        } 
     56        free(tempstr); 
    4857} 
    4958 
  • trunk/cli_classic.c

    r1482 r1483  
    107107#endif 
    108108                 "-E|-r <file>|-w <file>|-v <file>]\n" 
    109                "       [-c <chipname>] [-m [<vendor>:]<part>] [-l <file>]\n" 
     109               "       [-c <chipname>] [-l <file>]\n" 
    110110               "       [-i <image>] [-p <programmername>[:<parameters>]]\n\n"); 
    111111 
     
    129129               "   -c | --chip <chipname>            probe only for specified " 
    130130                 "flash chip\n" 
    131 #if CONFIG_INTERNAL == 1 
    132                /* FIXME: --mainboard should be a programmer parameter */ 
    133                "   -m | --mainboard <[vendor:]part>  override mainboard " 
    134                  "detection\n" 
    135 #endif 
    136131               "   -f | --force                      force specific operations " 
    137132                 "(see man page)\n" 
     
    191186                {"noverify",            0, NULL, 'n'}, 
    192187                {"chip",                1, NULL, 'c'}, 
    193                 {"mainboard",           1, NULL, 'm'}, 
    194188                {"verbose",             0, NULL, 'V'}, 
    195189                {"force",               0, NULL, 'f'}, 
     
    275269                        } 
    276270                        erase_it = 1; 
    277                         break; 
    278                 case 'm': 
    279 #if CONFIG_INTERNAL == 1 
    280                         tempstr = strdup(optarg); 
    281                         lb_vendor_dev_from_string(tempstr); 
    282 #else 
    283                         fprintf(stderr, "Error: Internal programmer support " 
    284                                 "was not compiled in and --mainboard only\n" 
    285                                 "applies to the internal programmer. Aborting.\n"); 
    286                         cli_classic_abort_usage(); 
    287 #endif 
    288271                        break; 
    289272                case 'f': 
     
    426409        if (prog == PROGRAMMER_INVALID) 
    427410                prog = default_programmer; 
    428  
    429 #if CONFIG_INTERNAL == 1 
    430         if ((prog != PROGRAMMER_INTERNAL) && (lb_part || lb_vendor)) { 
    431                 fprintf(stderr, "Error: --mainboard requires the internal " 
    432                                 "programmer. Aborting.\n"); 
    433                 cli_classic_abort_usage(); 
    434         } 
    435 #endif 
    436411 
    437412        /* FIXME: Delay calibration should happen in programmer code. */ 
  • trunk/flashrom.8

    r1461 r1483  
    66\fB\-L\fR|\fB\-z\fR|\fB\-E\fR|\fB\-r\fR <file>|\fB\-w\fR <file>|\ 
    77\fB\-v\fR <file>] 
    8          [\fB\-c\fR <chipname>] [\fB\-m\fR [<vendor>:]<board>] \ 
     8         [\fB\-c\fR <chipname>] \ 
    99[\fB\-l\fR <file>] 
    1010         [\fB\-i\fR <image>] [\fB\-p\fR <programmername>[:<parameters>]] 
     
    8989case sensitive. 
    9090.TP 
    91 .B "\-m, \-\-mainboard" [<vendor>:]<board> 
    92 Override mainboard settings. 
    93 .sp 
    94 flashrom reads the coreboot table to determine the current mainboard. If no 
    95 coreboot table could be read or if you want to override these values, you can 
    96 specify \-m, e.g.: 
    97 .sp 
    98 .B "  flashrom \-\-mainboard AGAMI:ARUMA \-w agami_aruma.rom" 
    99 .sp 
    100 See the 'Known boards' or 'Known laptops' section in the output 
    101 of 'flashrom \-L' for a list of boards which require the specification of 
    102 the board name, if no coreboot table is found. 
    103 .TP 
    10491.B "\-f, \-\-force" 
    10592Force one or more of the following actions: 
     
    246233Otherwise, the mainboard is detected by examining the onboard PCI devices 
    247234and possibly DMI info. If PCI and DMI do not contain information to uniquely 
    248 identify the mainboard (which is the exception), it might be necessary to 
    249 specify the mainboard using the 
    250 .B \-m 
    251 switch (see above). 
     235identify the mainboard (which is the exception), or if you want to override 
     236the detected mainboard model, you can specify the mainboard using the 
     237.sp 
     238.B "  flashrom \-p internal:mainboard=[<vendor>:]<board>" 
     239syntax. 
     240.sp 
     241See the 'Known boards' or 'Known laptops' section in the output 
     242of 'flashrom \-L' for a list of boards which require the specification of 
     243the board name, if no coreboot table is found. 
    252244.sp 
    253245Some of these board-specific flash enabling functions (called 
  • trunk/internal.c

    r1474 r1483  
    214214        free(arg); 
    215215 
     216        arg = extract_programmer_param("mainboard"); 
     217        if (arg && strlen(arg)) { 
     218                lb_vendor_dev_from_string(arg); 
     219        } else if (arg && !strlen(arg)) { 
     220                msg_perr("Missing argument for mainboard.\n"); 
     221                free(arg); 
     222                return 1; 
     223        } 
     224        free(arg); 
     225 
    216226        get_io_perms(); 
    217227        if (register_shutdown(internal_shutdown, NULL)) 
  • trunk/layout.c

    r1482 r1483  
    107107        /* 
    108108         * If lb_vendor is not set, the coreboot table was 
    109          * not found. Nor was -m VENDOR:PART specified. 
     109         * not found. Nor was -p internal:mainboard=VENDOR:PART specified. 
    110110         */ 
    111111        if (!lb_vendor || !lb_part) { 
    112                 msg_pinfo("Note: If the following flash access fails, " 
    113                        "try -m <vendor>:<mainboard>.\n"); 
     112                msg_pinfo("Note: If the following flash access fails, try " 
     113                          "-p internal:mainboard=<vendor>:<mainboard>.\n"); 
    114114                return 0; 
    115115        } 
     
    127127                } else { 
    128128                        msg_pinfo("ERROR: Your firmware image (%s:%s) does not " 
    129                                "appear to\n       be correct for the detected " 
    130                                "mainboard (%s:%s)\n\nOverride with -p internal:" 
    131                                "boardmismatch=force if you are absolutely sure " 
    132                                "that\nyou are using a correct " 
    133                                "image for this mainboard or override\nthe detected " 
    134                                "values with --mainboard <vendor>:<mainboard>.\n\n", 
    135                                mainboard_vendor, mainboard_part, lb_vendor, 
    136                                lb_part); 
     129                                  "appear to\n" 
     130                                  "       be correct for the detected " 
     131                                  "mainboard (%s:%s)\n\n" 
     132                                  "Override with -p internal:boardmismatch=" 
     133                                  "force to ignore the board name in the\n" 
     134                                  "firmware image or override the detected " 
     135                                  "mainboard with\n" 
     136                                  "-p internal:mainboard=<vendor>:<mainboard>." 
     137                                  "\n\n", 
     138                                  mainboard_vendor, mainboard_part, lb_vendor, 
     139                                  lb_part); 
    137140                        exit(1); 
    138141                } 
  • trunk/print.c

    r1472 r1483  
    390390                msg_ginfo(" "); 
    391391 
    392         msg_ginfo("Status  Required option\n\n"); 
     392        msg_ginfo("Status  Required value for\n"); 
     393        for (i = 0; i < maxvendorlen + maxboardlen + strlen("Status  "); i++) 
     394                msg_ginfo(" "); 
     395        msg_ginfo("-p internal:mainboard=\n"); 
    393396 
    394397        for (b = boards; b->vendor != NULL; b++) { 
     
    408411                                msg_ginfo("(autodetected)"); 
    409412                        else 
    410                                 msg_ginfo("-m %s:%s", e->lb_vendor, 
     413                                msg_ginfo("%s:%s", e->lb_vendor, 
    411414                                                   e->lb_part); 
    412415                } 
  • trunk/print_wiki.c

    r1454 r1483  
    168168                       boards[i].name, 
    169169                       boards[i].url ? "]" : "", 
    170                        b[k].lb_vendor ? "-m " : "&mdash;", 
     170                       b[k].lb_vendor ? "-p internal:mainboard=" : "&mdash;", 
    171171                       b[k].lb_vendor ? b[k].lb_vendor : "", 
    172172                       b[k].lb_vendor ? ":" : "", 
  • trunk/programmer.h

    r1480 r1483  
    265265 
    266266/* cbtable.c */ 
    267 void lb_vendor_dev_from_string(char *boardstring); 
     267void lb_vendor_dev_from_string(const char *boardstring); 
    268268int coreboot_init(void); 
    269269extern char *lb_part, *lb_vendor; 
Note: See TracChangeset for help on using the changeset viewer.