diff options
Diffstat (limited to 'futility/cmd_update.c')
-rw-r--r-- | futility/cmd_update.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/futility/cmd_update.c b/futility/cmd_update.c index db29db20..3d99664e 100644 --- a/futility/cmd_update.c +++ b/futility/cmd_update.c @@ -21,6 +21,7 @@ enum { OPT_FACTORY, OPT_FAST, OPT_FORCE, + OPT_GBB_FLAGS, OPT_HOST_ONLY, OPT_MANIFEST, OPT_MODEL, @@ -58,6 +59,7 @@ static struct option const long_opts[] = { {"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}, {"list-quirks", 0, NULL, OPT_QUIRKS_LIST}, {"manifest", 0, NULL, OPT_MANIFEST}, @@ -90,6 +92,17 @@ static void print_help(int argc, char *argv[]) printf("\n" "Usage: " MYNAME " %s [OPTIONS]\n" "\n" + "Updates firmware in one of the following modes (default to recovery):\n" + " autoupdate:\tUpdate RW[A|B], or recovery if RO changed.\n" + " recovery: \tUpdate RW[A&B], (RO, RO:GBB[keys] - if RO changed)\n" + " factory: \tUpdate RW[A&B], RO, RO:GBB[keys,flags]\n" + "\n" + "Note: firmware sections with PRESERVE flags like VPD and\n" + " HWID in GBB are always preserved.\n" + " GBB flags are preserved in autoupdate and recovery modes.\n" + "\n" + "OPTIONS:\n" + "\n" "-i, --image=FILE \tAP (host) firmware image (image.bin)\n" "-e, --ec_image=FILE \tEC firmware image (i.e, ec.bin)\n" " --pd_image=FILE \tPD firmware image (i.e, pd.bin)\n" @@ -102,9 +115,9 @@ static void print_help(int argc, char *argv[]) " --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 specified mode\n" "\n" "Legacy and compatibility options:\n" - "-m, --mode=MODE \tRun updater in given mode\n" " --factory \tAlias for --mode=factory\n" " --force \tForce update (skip checking contents)\n" " --output_dir=DIR\tSpecify the target for --mode=output\n" @@ -114,6 +127,7 @@ static void print_help(int argc, char *argv[]) " --host_only \tUpdate only AP (host) firmware\n" " --emulate=FILE \tEmulate system firmware using file\n" " --model=MODEL \tOverride system model for images\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" @@ -132,6 +146,7 @@ static int do_update(int argc, char *argv[]) int i, errorcnt = 0, do_update = 1; int detect_servo = 0, do_servo_cpu_fw_spi = 0; char *servo_programmer = NULL; + char *endptr; cfg = updater_new_config(); assert(cfg); @@ -218,6 +233,15 @@ static int do_update(int argc, char *argv[]) case OPT_FAST: args.fast_update = 1; break; + case OPT_GBB_FLAGS: + args.gbb_flags = strtoul(optarg, &endptr, 0); + if (*endptr) { + ERROR("Invalid flags: %s\n", optarg); + errorcnt++; + } else { + args.override_gbb_flags = 1; + } + break; case OPT_CCD: args.fast_update = 1; args.force_update = 1; |