diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | futility/cmd_vb2_verify_fw.c (renamed from utility/vb2_verify_fw.c) | 12 | ||||
-rwxr-xr-x | tests/futility/test_main.sh | 16 | ||||
-rwxr-xr-x | tests/vb2_firmware_tests.sh | 2 |
4 files changed, 17 insertions, 23 deletions
@@ -490,11 +490,6 @@ UTIL_NAMES += \ utility/signature_digest_utility \ utility/verify_data -ifneq (${VBOOT2},) -UTIL_NAMES += \ - utility/vb2_verify_fw -endif - endif UTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC}) @@ -550,6 +545,11 @@ FUTIL_SRCS = \ futility/cmd_vbutil_key.c \ futility/cmd_vbutil_keyblock.c +ifneq (${VBOOT2},) +FUTIL_SRCS += \ + futility/cmd_vb2_verify_fw.c +endif + FUTIL_LDS = futility/futility.lds FUTIL_STATIC_OBJS = ${FUTIL_STATIC_SRCS:%.c=${BUILD}/%.o} diff --git a/utility/vb2_verify_fw.c b/futility/cmd_vb2_verify_fw.c index f7ec0b50..7343d7a4 100644 --- a/utility/vb2_verify_fw.c +++ b/futility/cmd_vb2_verify_fw.c @@ -11,6 +11,7 @@ #include "2sysincludes.h" #include "2api.h" +#include "futility.h" const char *progname = "vb2_verify_fw"; @@ -133,12 +134,18 @@ int hash_body(struct vb2_context *ctx) return VB2_SUCCESS; } -int main(int argc, char *argv[]) +int do_vb2_verify_fw(int argc, char *argv[]) { struct vb2_context ctx; uint8_t workbuf[16384]; int rv; + progname = strrchr(argv[0], '/'); + if (progname) + progname++; + else + progname = argv[0]; + if (argc < 4) { fprintf(stderr, "usage: %s <gbb> <vblock> <body>\n", progname); @@ -207,3 +214,6 @@ int main(int argc, char *argv[]) return 0; } + +DECLARE_FUTIL_COMMAND(vb2_verify_fw, do_vb2_verify_fw, + "Verifies firmware using vboot2 library"); diff --git a/tests/futility/test_main.sh b/tests/futility/test_main.sh index 62177e68..5a09c282 100755 --- a/tests/futility/test_main.sh +++ b/tests/futility/test_main.sh @@ -12,22 +12,6 @@ cd "$OUTDIR" # No args returns nonzero exit code "$FUTILITY" && false -# Make sure all built-in commands are listed and have help -expected=\ -'dev_sign_file -dump_fmap -dump_kernel_config -gbb_utility -help -vbutil_firmware -vbutil_kernel -vbutil_key -vbutil_keyblock' -got=$("$FUTILITY" help | - egrep '^[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+' | - awk '{print $1}') -[ "$expected" = "$got" ] - # It's weird but okay if the command is a full path. "$FUTILITY" /fake/path/to/help > "$TMP" grep Usage "$TMP" diff --git a/tests/vb2_firmware_tests.sh b/tests/vb2_firmware_tests.sh index a32dc6d8..e1981dba 100755 --- a/tests/vb2_firmware_tests.sh +++ b/tests/vb2_firmware_tests.sh @@ -52,6 +52,6 @@ ${BIN_DIR}/vbutil_firmware \ echo 'Verifying test firmware using vb2_verify_fw' # Verify the firmware using vboot2 utility -${BIN_DIR}/vb2_verify_fw gbb.test vblock.test body.test +${BIN_DIR}/futility vb2_verify_fw gbb.test vblock.test body.test happy 'vb2_verify_fw succeeded' |