summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-07-17 11:32:17 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-18 22:45:13 +0000
commite155044a7bbb9b8c6eb751af051726cfe1b411a4 (patch)
tree62f23cc87ed2d01b42623f91e67f6feeb3aa749c
parent119140eae54f61c9aa25b063702aa6c25c2bda8d (diff)
downloadvboot-e155044a7bbb9b8c6eb751af051726cfe1b411a4.tar.gz
futility: deprecate eficompress and efidecompress
I don't think these utilities are needed any longer, so mark them as deprecated. They will still be built and can be run via futility, but invoking them directly will fail with a warning message. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ie704f2cecc3c37c91e4a0ffbcbcf94e2bf3ba05b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/208775 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--Makefile40
-rw-r--r--firmware/lib/include/vboot_common.h2
-rw-r--r--futility/futility.c30
-rw-r--r--futility/futility.h14
4 files changed, 78 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index fa14a2c7..d7742f45 100644
--- a/Makefile
+++ b/Makefile
@@ -534,14 +534,38 @@ FUTIL_BIN = ${BUILD}/futility/futility
FUTIL_STATIC_BIN = ${FUTIL_BIN}_s
# These are the executables to be replaced with symlinks.
-FUTIL_OLD = bmpblk_font bmpblk_utility cgpt chromeos-tpm-recovery crossystem \
- dev_debug_vboot dev_make_keypair dev_sign_file dumpRSAPublicKey \
- dump_fmap dump_kernel_config eficompress efidecompress \
- enable_dev_usb_boot gbb_utility load_kernel_test \
- make_dev_firmware.sh make_dev_ssd.sh pad_digest_utility \
- resign_firmwarefd.sh set_gbb_flags.sh signature_digest_utility \
- tpm-nvsize tpm_init_temp_fix tpmc vbutil_firmware vbutil_kernel \
- vbutil_key vbutil_keyblock vbutil_what_keys verify_data
+FUTIL_OLD = \
+ bmpblk_font \
+ bmpblk_utility \
+ cgpt \
+ chromeos-tpm-recovery \
+ crossystem \
+ dev_debug_vboot \
+ dev_make_keypair \
+ dev_sign_file \
+ dumpRSAPublicKey \
+ dump_fmap \
+ dump_kernel_config \
+ eficompress \
+ efidecompress \
+ enable_dev_usb_boot \
+ gbb_utility \
+ load_kernel_test \
+ make_dev_firmware.sh \
+ make_dev_ssd.sh \
+ pad_digest_utility \
+ resign_firmwarefd.sh \
+ set_gbb_flags.sh \
+ signature_digest_utility \
+ tpm-nvsize \
+ tpm_init_temp_fix \
+ tpmc \
+ vbutil_firmware \
+ vbutil_kernel \
+ vbutil_key \
+ vbutil_keyblock \
+ vbutil_what_keys \
+ verify_data
FUTIL_STATIC_SRCS = \
futility/futility.c \
diff --git a/firmware/lib/include/vboot_common.h b/firmware/lib/include/vboot_common.h
index 61c7431f..83064d2b 100644
--- a/firmware/lib/include/vboot_common.h
+++ b/firmware/lib/include/vboot_common.h
@@ -16,11 +16,13 @@
#endif
/* Test an important condition at compile time, not run time */
+#ifndef BUILD_ASSERT
#define _BA1_(cond, line) \
extern int __build_assertion_ ## line[1 - 2*!(cond)] \
__attribute__ ((unused))
#define _BA0_(c, x) _BA1_(c, x)
#define BUILD_ASSERT(cond) _BA0_(cond, __LINE__)
+#endif
/* Error Codes for all common functions. */
enum {
diff --git a/futility/futility.c b/futility/futility.c
index 59145c3a..5e852c33 100644
--- a/futility/futility.c
+++ b/futility/futility.c
@@ -79,6 +79,29 @@ static int do_help(int argc, char *argv[])
}
DECLARE_FUTIL_COMMAND(help, do_help, "show a bit of help");
+/* Deprecated functions can't be invoked through symlinks. */
+static char *dep_cmds[] = {
+ "eficompress",
+ "efidecompress",
+};
+
+static const char * const dep_usage= "\n\
+The program \"%s\" is deprecated.\n\
+\n\
+If you feel this is in error, please open a bug at\n\
+\n\
+ http://dev.chromium.org/for-testers/bug-reporting-guidelines\n\
+\n\
+In the meantime, you may continue to use the program by invoking it as\n\
+\n\
+ " MYNAME " %s [...]\n\
+\n";
+
+static void deprecated(const char *depname)
+{
+ fprintf(stderr, dep_usage, depname, depname);
+ exit(1);
+}
/******************************************************************************/
/* Logging stuff */
@@ -214,6 +237,7 @@ int main(int argc, char *argv[], char *envp[])
ssize_t r;
char *s;
struct futil_cmd_t **cmd;
+ int i;
log_args(argc, argv);
@@ -241,6 +265,12 @@ int main(int argc, char *argv[], char *envp[])
progname++;
else
progname = argv[0];
+ } else { /* Invoked by symlink */
+
+ /* Block any deprecated functions. */
+ for (i = 0; i < ARRAY_SIZE(dep_cmds); i++)
+ if (0 == strcmp(dep_cmds[i], progname))
+ deprecated(progname);
}
/* See if it's asking for something we know how to do ourselves */
diff --git a/futility/futility.h b/futility/futility.h
index 005a0ce7..a1417c01 100644
--- a/futility/futility.h
+++ b/futility/futility.h
@@ -35,4 +35,18 @@ struct futil_cmd_t {
/* This is the list of pointers to all commands. */
extern struct futil_cmd_t *futil_cmds[];
+/* Size of an array */
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
+#endif
+
+/* Test an important condition at compile time, not run time */
+#ifndef BUILD_ASSERT
+#define _BA1_(cond, line) \
+ extern int __build_assertion_ ## line[1 - 2*!(cond)] \
+ __attribute__ ((unused))
+#define _BA0_(c, x) _BA1_(c, x)
+#define BUILD_ASSERT(cond) _BA0_(cond, __LINE__)
+#endif
+
#endif /* VBOOT_REFERENCE_FUTILITY_H_ */