summaryrefslogtreecommitdiff
path: root/tests/futility/test_update.sh
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2018-08-31 15:43:02 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-09-10 01:13:20 -0700
commitf5223d920707f24724390019c14c2f759d51f71a (patch)
treeb70b168cd9bbfc508d7f5c6abb9b9934fe794d18 /tests/futility/test_update.sh
parent8c564a18969b14f7a86ffd93089bba9f37cb53a5 (diff)
downloadvboot-f5223d920707f24724390019c14c2f759d51f71a.tar.gz
futility: cmd_update: Add quirk 'unlock_me_for_update'
On recent Intel platforms, flashing to SI_ME may get corrupted due to ME execution in parallel. If we lock SI_ME immediately (by writing the new SI_DESC), the device may fail to boot due to ME execution failure. As a result, a quirk is added so the firmware updater will never lock SI_ME. The Flash Master values are always unlocked when updating SI_ME, and after system reboot, a board-postinst script should check ME status and reflash SI_DESC only if SI_ME looks all good. BUG=chromium:875551 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I584aa373797e2b4c2608f07aac21c16cdb34a5c4 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1198807 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'tests/futility/test_update.sh')
-rwxr-xr-xtests/futility/test_update.sh28
1 files changed, 19 insertions, 9 deletions
diff --git a/tests/futility/test_update.sh b/tests/futility/test_update.sh
index 4748f10a..6902a0cf 100755
--- a/tests/futility/test_update.sh
+++ b/tests/futility/test_update.sh
@@ -49,24 +49,26 @@ cp -f ${PEPPY_BIOS} ${FROM_IMAGE}
patch_file() {
local file="$1"
local section="$2"
- local data="$3"
+ local section_offset="$3"
+ local data="$4"
# NAME OFFSET SIZE
local fmap_info="$(${FUTILITY} dump_fmap -p ${file} ${section})"
- local offset="$(echo "${fmap_info}" | sed 's/^[^ ]* //; s/ [^ ]*$//')"
+ local base="$(echo "${fmap_info}" | sed 's/^[^ ]* //; s/ [^ ]*$//')"
+ local offset=$((base + section_offset))
echo "offset: ${offset}"
- echo -n "${data}" | dd of="${file}" bs=1 seek="${offset}" conv=notrunc
+ printf "${data}" | dd of="${file}" bs=1 seek="${offset}" conv=notrunc
}
# PEPPY and LINK have different platform element ("Google_Link" and
# "Google_Peppy") in firmware ID so we want to hack them by changing
# "Google_" to "Google.".
-patch_file ${TO_IMAGE} RW_FWID_A Google.
-patch_file ${TO_IMAGE} RW_FWID_B Google.
-patch_file ${TO_IMAGE} RO_FRID Google.
-patch_file ${FROM_IMAGE} RW_FWID_A Google.
-patch_file ${FROM_IMAGE} RW_FWID_B Google.
-patch_file ${FROM_IMAGE} RO_FRID Google.
+patch_file ${TO_IMAGE} RW_FWID_A 0 Google.
+patch_file ${TO_IMAGE} RW_FWID_B 0 Google.
+patch_file ${TO_IMAGE} RO_FRID 0 Google.
+patch_file ${FROM_IMAGE} RW_FWID_A 0 Google.
+patch_file ${FROM_IMAGE} RW_FWID_B 0 Google.
+patch_file ${FROM_IMAGE} RO_FRID 0 Google.
unpack_image() {
local folder="${TMP}.$1"
@@ -112,6 +114,9 @@ cp -f "${FROM_IMAGE}" "${TMP}.expected.legacy"
RW_LEGACY:${TMP}.to/RW_LEGACY
cp -f "${TMP}.expected.full" "${TMP}.expected.large"
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"
test_update() {
local test_name="$1"
@@ -228,3 +233,8 @@ test_update "Full update (wrong size)" \
test_update "Full update (--quirks enlarge_image)" \
"${FROM_IMAGE}.large" "${TMP}.expected.large" --quirks enlarge_image \
-i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1
+
+test_update "Full update (--quirks unlock_me_for_update)" \
+ "${FROM_IMAGE}" "${TMP}.expected.me_unlocked" \
+ --quirks unlock_me_for_update \
+ -i "${TO_IMAGE}" --wp=0 --sys_props 0,0x10001,1