summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2012-08-24 14:24:12 -0400
committerGerrit <chrome-bot@google.com>2012-08-24 12:50:56 -0700
commit513be212d9ee71dfb6efe1c8d3ff49a9f8eaf4ee (patch)
tree7fcb3c6d27f576dcd445dfd12d9725f3e1d7d804
parentf7257d56288a3d59007062db3116b30d8aa71d58 (diff)
downloadvboot-513be212d9ee71dfb6efe1c8d3ff49a9f8eaf4ee.tar.gz
signer scripts: include debug output when we fail
When checking kernel params fail, it's useful to know all the variables as to what it's doing. So dump some state when an error occurs. BRANCH=None BUG=None TEST=ran `ensure_secure_kernelparams.sh` on a bad image and saw useful output TEST=ran `ensure_secure_kernelparams.sh` on a good image and saw no output Change-Id: I0e499f87a6d8feed80da72aba75e1e6c1b4076c9 Reviewed-on: https://gerrit.chromium.org/gerrit/31355 Reviewed-by: David McMahon <djmm@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
-rwxr-xr-xscripts/image_signing/ensure_secure_kernelparams.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/image_signing/ensure_secure_kernelparams.sh b/scripts/image_signing/ensure_secure_kernelparams.sh
index 52a3ce99..1eb4364b 100755
--- a/scripts/image_signing/ensure_secure_kernelparams.sh
+++ b/scripts/image_signing/ensure_secure_kernelparams.sh
@@ -57,6 +57,8 @@ main() {
# So, any time we find one, we set testfail=1 and continue.
# When finished we will use testfail to determine our exit value.
local testfail=0
+ # A buffer to include useful information that we dump when things fail.
+ local output
if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
usage
@@ -92,13 +94,26 @@ main() {
eval "optional_kparams=(\${optional_kparams_$board[@]})"
eval "optional_kparams_regex=(\${optional_kparams_regex_$board[@]})"
eval "required_dmparams=(\"\${required_dmparams_$board[@]}\")"
+ output+="required_kparams=(\n"
+ output+="$(printf "\t'%s'\n" "${required_kparams[@]}")\n)\n"
+ output+="optional_kparams=(\n"
+ output+="$(printf "\t'%s'\n" "${optional_kparams[@]}")\n)\n"
+ output+="optional_kparams_regex=(\n"
+ output+="$(printf "\t'%s'\n" "${optional_kparams_regex[@]}")\n)\n"
+ output+="required_dmparams=(\n"
+ output+="$(printf "\t'%s'\n" "${required_dmparams[@]}")\n)\n"
# Divide the dm params from the rest and process seperately.
local kparams=$(dump_kernel_config "$kernelblob")
local dmparams=$(get_dmparams "$kparams")
local kparams_nodm=$(kparams_remove_dm "$kparams")
+ output+="\nkparams='${kparams}'\n"
+ output+="\ndmparams='${dmparams}'\n"
+ output+="\nkparams_nodm='${kparams_nodm}'\n"
+
mangled_dmparams=$(dmparams_mangle "${dmparams}")
+ output+="\nmangled_dmparams='${mangled_dmparams}'\n"
# Special-case handling of the dm= param:
for expected_dmparams in "${required_dmparams[@]}"; do
# Filter out all dynamic parameters.
@@ -146,6 +161,12 @@ main() {
testfail=1
fi
+ if [[ ${testfail} -eq 1 ]]; then
+ echo "Debug output:"
+ printf '%b\n' "${output}"
+ echo "(actual error will be at the top of output)"
+ fi
+
exit $testfail
}