summaryrefslogtreecommitdiff
path: root/futility/cmd_update.c
diff options
context:
space:
mode:
Diffstat (limited to 'futility/cmd_update.c')
-rw-r--r--futility/cmd_update.c57
1 files changed, 9 insertions, 48 deletions
diff --git a/futility/cmd_update.c b/futility/cmd_update.c
index 2f34c556..c47ab325 100644
--- a/futility/cmd_update.c
+++ b/futility/cmd_update.c
@@ -16,11 +16,8 @@
#ifdef USE_FLASHROM
enum {
- OPT_DUMMY = 0x100,
-
- OPT_CCD,
+ OPT_DUMMY = 0x1000,
OPT_DETECT_MODEL_ONLY,
- OPT_EMULATE,
OPT_FACTORY,
OPT_FAST,
OPT_FORCE,
@@ -33,9 +30,7 @@ enum {
OPT_QUIRKS,
OPT_QUIRKS_LIST,
OPT_REPACK,
- OPT_SERVO,
OPT_SERVO_NORESET,
- OPT_SERVO_PORT,
OPT_SIGNATURE,
OPT_SYS_PROPS,
OPT_UNPACK,
@@ -44,6 +39,7 @@ enum {
/* Command line options */
static struct option const long_opts[] = {
+ SHARED_FLASH_ARGS_LONGOPTS
/* name has_arg *flag val */
{"help", 0, NULL, 'h'},
{"debug", 0, NULL, 'd'},
@@ -53,25 +49,20 @@ static struct option const long_opts[] = {
{"ec_image", 1, NULL, 'e'},
{"try", 0, NULL, 't'},
{"archive", 1, NULL, 'a'},
- {"programmer", 1, NULL, 'p'},
{"mode", 1, NULL, 'm'},
- {"ccd", 0, NULL, OPT_CCD},
- {"servo", 0, NULL, OPT_SERVO},
- {"servo_port", 1, NULL, OPT_SERVO_PORT},
{"detect-model-only", 0, NULL, OPT_DETECT_MODEL_ONLY},
- {"emulate", 1, NULL, OPT_EMULATE},
{"factory", 0, NULL, OPT_FACTORY},
{"fast", 0, NULL, OPT_FAST},
{"force", 0, NULL, OPT_FORCE},
{"gbb_flags", 1, NULL, OPT_GBB_FLAGS},
{"host_only", 0, NULL, OPT_HOST_ONLY},
+ {"quirks", 1, NULL, OPT_QUIRKS},
{"list-quirks", 0, NULL, OPT_QUIRKS_LIST},
{"manifest", 0, NULL, OPT_MANIFEST},
{"model", 1, NULL, OPT_MODEL},
{"output_dir", 1, NULL, OPT_OUTPUT_DIR},
{"pd_image", 1, NULL, OPT_PD_IMAGE},
- {"quirks", 1, NULL, OPT_QUIRKS},
{"repack", 1, NULL, OPT_REPACK},
{"signature_id", 1, NULL, OPT_SIGNATURE},
{"sys_props", 1, NULL, OPT_SYS_PROPS},
@@ -90,7 +81,8 @@ static struct option const long_opts[] = {
{NULL, 0, NULL, 0},
};
-static const char * const short_opts = "hdvi:e:ta:m:p:";
+static const char *const short_opts =
+ "hdvi:e:ta:m:" SHARED_FLASH_ARGS_SHORTOPTS;
static void print_help(int argc, char *argv[])
{
@@ -114,12 +106,12 @@ static void print_help(int argc, char *argv[])
"-t, --try \tTry A/B update on reboot if possible\n"
"-a, --archive=PATH \tRead resources from archive\n"
" --unpack=DIR \tExtracts archive to DIR\n"
- "-p, --programmer=PRG\tChange AP (host) flashrom programmer\n"
" --fast \tReduce read cycles and do not verify\n"
" --quirks=LIST \tSpecify the quirks to apply\n"
" --list-quirks \tPrint all available quirks\n"
"-m, --mode=MODE \tRun updater in the specified mode\n"
" --manifest \tScan the archive to print a manifest in JSON\n"
+ SHARED_FLASH_ARGS_HELP
"\n"
" * If both --manifest and --fast are specified, the updater\n"
" will not scan the archive and simply dump the previously\n"
@@ -133,13 +125,9 @@ static void print_help(int argc, char *argv[])
"Debugging and testing options:\n"
" --wp=1|0 \tSpecify write protection status\n"
" --host_only \tUpdate only AP (host) firmware\n"
- " --emulate=FILE \tEmulate system firmware using file\n"
" --model=MODEL \tOverride system model for images\n"
" --detect-model-only\tDetect model by reading the FRID and exit\n"
" --gbb_flags=FLAG\tOverride new GBB flags\n"
- " --ccd \tDo fast,force,wp=0,p=raiden_debug_spi\n"
- " --servo \tFlash using Servo (v2, v4, micro, ...)\n"
- " --servo_port=PRT\tOverride servod port, implies --servo\n"
" --signature_id=S\tOverride signature ID for key files\n"
" --sys_props=LIST\tList of system properties to override\n"
"-d, --debug \tPrint debugging messages\n"
@@ -153,7 +141,6 @@ static int do_update(int argc, char *argv[])
struct updater_config *cfg;
struct updater_config_arguments args = {0};
int i, errorcnt = 0, update_needed = 1;
- int detect_servo = 0;
const char *prepare_ctrl_name = NULL;
char *servo_programmer = NULL;
char *endptr;
@@ -163,6 +150,8 @@ static int do_update(int argc, char *argv[])
opterr = 0;
while ((i = getopt_long(argc, argv, short_opts, long_opts, 0)) != -1) {
+ if (handle_flash_argument(&args, i, optarg))
+ continue;
switch (i) {
case 'h':
print_help(argc, argv);
@@ -190,9 +179,6 @@ static int do_update(int argc, char *argv[])
case 'm':
args.mode = optarg;
break;
- case 'p':
- args.programmer = optarg;
- break;
case OPT_PD_IMAGE:
args.pd_image = optarg;
@@ -227,9 +213,6 @@ static int do_update(int argc, char *argv[])
case OPT_WRITE_PROTECTION:
args.write_protection = optarg;
break;
- case OPT_EMULATE:
- args.emulation = optarg;
- break;
case OPT_SYS_PROPS:
args.sys_props = optarg;
break;
@@ -257,28 +240,6 @@ static int do_update(int argc, char *argv[])
args.override_gbb_flags = 1;
}
break;
- case OPT_CCD:
- args.fast_update = 1;
- args.force_update = 1;
- args.write_protection = "0";
- args.programmer = "raiden_debug_spi:target=AP";
- break;
- case OPT_SERVO:
- args.fast_update = 1;
- args.force_update = 1;
- args.write_protection = "0";
- args.host_only = 1;
- detect_servo = 1;
- break;
- case OPT_SERVO_PORT:
- setenv(ENV_SERVOD_PORT, optarg, 1);
- args.fast_update = 1;
- args.force_update = 1;
- args.write_protection = "0";
- args.host_only = 1;
- detect_servo = 1;
- break;
-
case OPT_DUMMY:
break;
@@ -302,7 +263,7 @@ static int do_update(int argc, char *argv[])
ERROR("Unexpected arguments.\n");
}
- if (!errorcnt && detect_servo) {
+ if (!errorcnt && args.detect_servo) {
servo_programmer = host_detect_servo(&prepare_ctrl_name);
if (!servo_programmer)