mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 00:51:29 +00:00
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>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user