summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-10-23 06:49:26 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-23 13:01:33 -0700
commit4840df70f7bb8a8a13df6ad28a55be0ebf7de3ab (patch)
tree03fb6ed312a0c9cbb4f2e7087a96e9a92170aa11
parent6b5f9978fbfcfcab96b56a53429c9fd377176a9c (diff)
downloadvboot-4840df70f7bb8a8a13df6ad28a55be0ebf7de3ab.tar.gz
futility: update: Add `--host_only` argument
The legacy firmware updater can update explicitly only some type of images by using `--[no]update_main`, `--[no]update_ec`, `--[no]update_pd`. Since software sync is introduced, usually it does not make sense to only update EC or PD; instead the real request is to "ignore provided EC and PD images and update only host". The new `--host_only` argument provides an easy way to ignore images in command line (`--ec_image`, `--pd_image`) and archives (`ec.bin`, `pd.bin`). BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: Idf403680880cd58a00867172ccec97fd60c1b826 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1295210 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--futility/cmd_update.c5
-rw-r--r--futility/updater.c9
-rw-r--r--futility/updater.h2
-rwxr-xr-xtests/futility/test_update.sh5
4 files changed, 17 insertions, 4 deletions
diff --git a/futility/cmd_update.c b/futility/cmd_update.c
index 14b16877..1b202c0f 100644
--- a/futility/cmd_update.c
+++ b/futility/cmd_update.c
@@ -33,6 +33,7 @@ static struct option const long_opts[] = {
{"force", 0, NULL, 'F'},
{"programmer", 1, NULL, 'p'},
{"wp", 1, NULL, 'W'},
+ {"host_only", 0, NULL, 'H'},
{"emulate", 1, NULL, 'E'},
{"output_dir", 1, NULL, 'U'},
{"sys_props", 1, NULL, 'S'},
@@ -67,6 +68,7 @@ static void print_help(int argc, char *argv[])
"\n"
"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"
" --signature_id=S\tOverride signature ID for key files\n"
@@ -132,6 +134,9 @@ static int do_update(int argc, char *argv[])
case 'W':
args.write_protection = optarg;
break;
+ case 'H':
+ args.host_only = 1;
+ break;
case 'E':
args.emulation = optarg;
break;
diff --git a/futility/updater.c b/futility/updater.c
index 6029612d..f4e793b3 100644
--- a/futility/updater.c
+++ b/futility/updater.c
@@ -1641,6 +1641,7 @@ static int save_from_stdin(const char *output)
* Returns 0 on success, otherwise number of failures.
*/
static int updater_load_images(struct updater_config *cfg,
+ int host_only,
const char *image,
const char *ec_image,
const char *pd_image)
@@ -1657,7 +1658,7 @@ static int updater_load_images(struct updater_config *cfg,
}
errorcnt += !!load_firmware_image(&cfg->image, image, ar);
}
- if (cfg->emulation)
+ if (cfg->emulation || host_only)
return errorcnt;
if (!cfg->ec_image.data && ec_image)
@@ -1769,7 +1770,8 @@ static int updater_setup_archive(
}
errorcnt += updater_load_images(
- cfg, model->image, model->ec_image, model->pd_image);
+ cfg, arg->host_only, model->image, model->ec_image,
+ model->pd_image);
errorcnt += patch_image_by_model(&cfg->image, model, ar);
return errorcnt;
}
@@ -1862,7 +1864,8 @@ int updater_setup_config(struct updater_config *cfg,
/* Always load images specified from command line directly. */
errorcnt += updater_load_images(
- cfg, arg->image, arg->ec_image, arg->pd_image);
+ cfg, arg->host_only, arg->image, arg->ec_image,
+ arg->pd_image);
if (!archive_path)
archive_path = ".";
diff --git a/futility/updater.h b/futility/updater.h
index 26e88dad..9c8502b1 100644
--- a/futility/updater.h
+++ b/futility/updater.h
@@ -117,7 +117,7 @@ struct updater_config_arguments {
char *programmer, *model, *signature_id;
char *emulation, *sys_props, *write_protection;
char *output_dir;
- int is_factory, try_update, force_update, do_manifest;
+ int is_factory, try_update, force_update, do_manifest, host_only;
int verbosity;
};
diff --git a/tests/futility/test_update.sh b/tests/futility/test_update.sh
index 3838361c..740e53cf 100755
--- a/tests/futility/test_update.sh
+++ b/tests/futility/test_update.sh
@@ -182,6 +182,11 @@ test_update "Full update (GBB=0 -> 0)" \
"${FROM_IMAGE}.gbb0" "${TMP}.expected.full.gbb0" \
-i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1
+test_update "Full update (--host_only)" \
+ "${FROM_IMAGE}" "${TMP}.expected.full" \
+ -i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1 \
+ --host_only --ec_image non-exist.bin --pd_image non_exist.bin
+
# Test RW-only update.
test_update "RW update" \
"${FROM_IMAGE}" "${TMP}.expected.rw" \