diff options
Diffstat (limited to 'scripts/image_signing/get_gbb_flags.sh')
-rwxr-xr-x | scripts/image_signing/get_gbb_flags.sh | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/scripts/image_signing/get_gbb_flags.sh b/scripts/image_signing/get_gbb_flags.sh index b3d2c44d..2d00713c 100755 --- a/scripts/image_signing/get_gbb_flags.sh +++ b/scripts/image_signing/get_gbb_flags.sh @@ -4,8 +4,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # -# This script can change GBB flags in system live firmware or a given image -# file. +# This script can read GBB flags from system flash or a file. +# This script calls `futility gbb --get`, consider using that directly. SCRIPT_BASE="$(dirname "$0")" . "${SCRIPT_BASE}/gbb_flags_common.sh" @@ -26,30 +26,28 @@ main() { echo 'NOTICE: This script has been replaced with futility functionality and will be removed.' 1>&2 echo 'NOTICE: Please try `futility gbb --get --flags`' 1>&2 - local image_file="${FLAGS_file}" - local programmer="${FLAGS_programmer}" - - if [ -z "${FLAGS_file}" ]; then - image_file="$(make_temp_file)" - if [ "${FLAGS_servo}" = "${FLAGS_TRUE}" ]; then - update_programmer_for_servo - fi - flashrom_read "${image_file}" "${programmer}" + local args=() + if [ -n "${FLAGS_file}" ]; then + args+=("${FLAGS_file}") + elif [ "${FLAGS_servo}" = "${FLAGS_TRUE}" ]; then + args+=("--servo") + else + args+=("--flash" "--programmer=${FLAGS_programmer}") fi - # Process file. - # Keep 'local' declaration split from assignment so return code is checked. local gbb_flags - gbb_flags="$(futility gbb -g --flags "${image_file}")" - local raw_gbb_flags="$(echo "${gbb_flags}" | egrep -o "0x[0-9a-fA-F]+")" - printf "Chrome OS GBB set ${gbb_flags}\n" + gbb_flags="$(futility gbb --get --flags "${args[@]}" | grep "flags: ")" + + local raw_gbb_flags + raw_gbb_flags="$(echo "${gbb_flags}" | grep -E -o "0x[0-9a-fA-F]+")" + printf "Chrome OS GBB set %s\n" "${gbb_flags}" if [ "${FLAGS_explicit}" = "${FLAGS_TRUE}" ]; then printf "Chrome OS GBB set flags listed:\n" echo "${GBBFLAGS_LIST}" | while read -r flag code; do if [ $((code & raw_gbb_flags)) -ne 0 ]; then - printf "${flag}\n" + printf "%s\n" "${flag}" fi done fi |