From bfa02282620cdeca363bdafd18d68670e151e5a5 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sun, 25 Dec 2016 21:27:41 +0100 Subject: tools: Add boot-keys tool to handle keys and images verification Signed-off-by: Paul Kocialkowski --- tools/boot-keys/boot-keys-helper | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 tools/boot-keys/boot-keys-helper (limited to 'tools/boot-keys/boot-keys-helper') diff --git a/tools/boot-keys/boot-keys-helper b/tools/boot-keys/boot-keys-helper new file mode 100755 index 00000000..5046cbfb --- /dev/null +++ b/tools/boot-keys/boot-keys-helper @@ -0,0 +1,72 @@ +#!/bin/bash + +KERNEL="kernel" +TYPE="type" +ROM="rom" +IMG="img" + +boot_keys_cros() { + local cros_script=$1 + shift + + local vboot_tools_path=$( project_install_path "vboot" "tools" ) + local cros_scripts_path=$( project_install_path "cros-scripts" ) + local cros_script_path="$cros_scripts_path/$cros_script" + + if ! [ -x "$cros_script_path" ] + then + printf "$cros_script script missing from cros-scripts install" >&2 + return 1 + fi + + VBOOT_KEYS_PATH=$VBOOT_KEYS_PATH VBOOT_TOOLS_PATH=$vboot_tools_path $cros_script_path "$@" +} + +boot_keys_type() { + tool_file_contents "$tool" "$CONFIGS" "$TYPE" "$@" +} + +boot_keys_files_install_path() { + local project=$1 + shift + + local helper_arguments + local argument + local ifs_save + + helper_arguments=$( project_action_helper "arguments" "$project" "$@" ) + + + if [ $? -ne 0 ] || [ -z "$helper_arguments" ] + then + project_install_path "$project" "$@" + else + # This it to allow space characters in arguments. + ifs_save=$IFS + IFS=$'\n' + + for argument in $( echo "$helper_arguments" ) + do + ( + IFS=$ifs_save + + # Only a single argument at a time is returned by the helper. + boot_keys_files_install_path "$project" "$@" "$argument" + ) + done + + IFS=$ifs_save + fi +} + +boot_keys_files() { + local project=$1 + shift + + local cros_scripts_path=$( project_install_path "cros-scripts" ) + local cros_boot_keys="$cros_scripts_path/cros-boot-keys" + + project_action_arguments_verify_recursive "install" "$project" "$@" + + boot_keys_files_install_path "$project" "$@" +} -- cgit v1.2.3-70-g09d2