summaryrefslogtreecommitdiff
path: root/futility/cmd_update.c
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-10-01 17:03:42 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-13 11:42:13 -0700
commit7db7a6db8f0719fe0fda8219c7111c7caf0b4546 (patch)
treeb0492521037e1082220794315d12f9089c201cfa /futility/cmd_update.c
parent66381ae51d7da4a385b5898473d3ccaa8ee20c11 (diff)
downloadvboot-7db7a6db8f0719fe0fda8219c7111c7caf0b4546.tar.gz
futility: updater: Add '--archive' to read from an archive or directory
A firmware update is usually released as a package with multiple images, instructions, signed vblocks and other files. To work with that, a new argument '--archive' is added. The --archive accepts a directory or file, and will determine the correct driver automatically. For resources (for example --image) in relative path, updater should find files from archive. Note in current implementation, only ZIP is supported for file type drivers (and need the system to have libzip already installed). BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I6a91cbe73fb4ee203c5fa4607f6651a39ba854d5 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1253229 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/cmd_update.c')
-rw-r--r--futility/cmd_update.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/futility/cmd_update.c b/futility/cmd_update.c
index d220988e..830f9ace 100644
--- a/futility/cmd_update.c
+++ b/futility/cmd_update.c
@@ -22,6 +22,7 @@ static struct option const long_opts[] = {
{"ec_image", 1, NULL, 'e'},
{"pd_image", 1, NULL, 'P'},
{"try", 0, NULL, 't'},
+ {"archive", 1, NULL, 'a'},
{"quirks", 1, NULL, 'f'},
{"list-quirks", 0, NULL, 'L'},
{"mode", 1, NULL, 'm'},
@@ -37,7 +38,7 @@ static struct option const long_opts[] = {
{NULL, 0, NULL, 0},
};
-static const char * const short_opts = "hi:e:tm:p:dv";
+static const char * const short_opts = "hi:e:ta:m:p:dv";
static void print_help(int argc, char *argv[])
{
@@ -48,6 +49,7 @@ static void print_help(int argc, char *argv[])
"-e, --ec_image=FILE \tEC firmware image (i.e, ec.bin)\n"
" --pd_image=FILE \tPD firmware image (i.e, pd.bin)\n"
"-t, --try \tTry A/B update on reboot if possible\n"
+ "-a, --archive=PATH \tRead resources from archive\n"
"-p, --programmer=PRG\tChange AP (host) flashrom programmer\n"
" --quirks=LIST \tSpecify the quirks to apply\n"
" --list-quirks \tPrint all available quirks\n"
@@ -72,6 +74,7 @@ static int do_update(int argc, char *argv[])
const char *opt_image = NULL,
*opt_ec_image = NULL,
*opt_pd_image = NULL,
+ *opt_archive = NULL,
*opt_quirks = NULL,
*opt_mode = NULL,
*opt_programmer = NULL,
@@ -102,6 +105,9 @@ static int do_update(int argc, char *argv[])
case 't':
opt_try_update = 1;
break;
+ case 'a':
+ opt_archive = optarg;
+ break;
case 'f':
opt_quirks = optarg;
break;
@@ -162,8 +168,8 @@ static int do_update(int argc, char *argv[])
if (!errorcnt)
errorcnt += updater_setup_config(
cfg, opt_image, opt_ec_image, opt_pd_image,
- opt_quirks, opt_mode, opt_programmer,
- opt_emulation, opt_sys_props,
+ opt_archive, opt_quirks, opt_mode,
+ opt_programmer, opt_emulation, opt_sys_props,
opt_write_protection, opt_is_factory,
opt_try_update, opt_force_update,
opt_verbosity);