summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--futility/updater.c15
-rwxr-xr-xtests/futility/test_update.sh14
2 files changed, 24 insertions, 5 deletions
diff --git a/futility/updater.c b/futility/updater.c
index 2511c6a0..66f42e48 100644
--- a/futility/updater.c
+++ b/futility/updater.c
@@ -539,11 +539,16 @@ static int preserve_management_engine(struct updater_config *cfg,
image_from, image_to, FMAP_SI_DESC);
}
- if (try_apply_quirk(QUIRK_PRESERVE_ME, cfg) > 0) {
- VB2_DEBUG("ME needs to be preserved - preserving %s.\n",
- FMAP_SI_ME);
- return preserve_firmware_section(
- image_from, image_to, FMAP_SI_ME);
+ if (!strcmp(image_from->programmer, PROG_HOST)) {
+ if (try_apply_quirk(QUIRK_PRESERVE_ME, cfg) > 0) {
+ VB2_DEBUG("ME needs to be preserved - preserving %s.\n",
+ FMAP_SI_ME);
+ return preserve_firmware_section(image_from, image_to,
+ FMAP_SI_ME);
+ }
+ } else {
+ VB2_DEBUG("Flashing via non-host programmer %s - no need to "
+ "preserve ME.\n", image_from->programmer);
}
return try_apply_quirk(QUIRK_UNLOCK_ME_FOR_UPDATE, cfg);
diff --git a/tests/futility/test_update.sh b/tests/futility/test_update.sh
index d2ab0288..25c55432 100755
--- a/tests/futility/test_update.sh
+++ b/tests/futility/test_update.sh
@@ -141,6 +141,9 @@ dd if=/dev/zero bs=8388608 count=1 | tr '\000' '\377' >>"${TMP}.expected.large"
cp -f "${TMP}.expected.full" "${TMP}.expected.me_unlocked"
patch_file "${TMP}.expected.me_unlocked" SI_DESC 128 \
"\x00\xff\xff\xff\x00\xff\xff\xff\x00\xff\xff\xff"
+cp -f "${TMP}.expected.full" "${TMP}.expected.me_preserved"
+"${FUTILITY}" load_fmap "${TMP}.expected.me_preserved" \
+ "SI_ME:${TMP}.from/SI_ME"
# A special set of images that only RO_VPD is preserved (RW_VPD is wiped) using
# FMAP_AREA_PRESERVE (\010=0x08).
@@ -357,6 +360,17 @@ test_update "Full update (--quirks no_check_platform)" \
--quirks no_check_platform \
-i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1
+test_update "Full update (--quirks preserve_me with non-host programmer)" \
+ "${FROM_IMAGE}" "${TMP}.expected.full" \
+ --quirks preserve_me \
+ -i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1 \
+ -p raiden_debug_spi:target=AP
+
+test_update "Full update (--quirks preserve_me)" \
+ "${FROM_IMAGE}" "${TMP}.expected.me_preserved" \
+ --quirks preserve_me \
+ -i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1
+
# Test archive and manifest.
A="${TMP}.archive"
mkdir -p "${A}/bin"