diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-02-22 15:51:36 -0800 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2013-02-22 15:52:30 -0800 |
commit | 4c4a9cbcd5dd9717360e39eedbfd4275bf7bb6c4 (patch) | |
tree | 96cc3864faa5b67de6001b84f07d489053eac014 | |
parent | 7f5e3d744af83584c307b9dc2b6ec36f8b308285 (diff) | |
parent | e6cf2c21a1cd6fc46b6adcaadc865e2f8bd4874e (diff) | |
download | vboot-4c4a9cbcd5dd9717360e39eedbfd4275bf7bb6c4.tar.gz |
Merge remote-tracking branch 'm/master', if git will let me.
BUG=none
TEST=none
BRANCH=none
Change-Id: Ibd564bb05ce4d8ef26cad1ad7211294532c2adbb
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | Makefile | 90 | ||||
-rwxr-xr-x | utility/chromeos-tpm-recovery-test | 2 | ||||
-rw-r--r-- | utility/mount-encrypted.c | 9 |
3 files changed, 54 insertions, 47 deletions
@@ -42,8 +42,19 @@ export BUILD # Stuff for 'make install' INSTALL ?= install -DESTDIR ?= /usr/bin -O_DESTDIR = ${DESTDIR}/old_bins +DESTDIR ?= /usr/local/bin + +ifeq (${MINIMAL},) +# Host install just puts everything in one place +UB_DIR=${DESTDIR} +SB_DIR=${DESTDIR} +VB_DIR=${DESTDIR} +else +# Target install puts things into DESTDIR subdirectories +UB_DIR=${DESTDIR}/usr/bin +SB_DIR=${DESTDIR}/sbin +VB_DIR=${DESTDIR}/usr/share/vboot/bin +endif # Where to install the (exportable) executables for testing? TEST_INSTALL_DIR = ${BUILD}/install_for_test @@ -323,8 +334,6 @@ CGPT_SRCS = \ CGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o} ALL_OBJS += ${CGPT_OBJS} -C_DESTDIR = ${O_DESTDIR} - # Scripts to install directly (not compiled) UTIL_SCRIPTS = \ @@ -366,22 +375,21 @@ UTIL_NAMES += \ verify_data endif +UTIL_BINS_STATIC := $(addprefix ${BUILD}/utility/,${UTIL_NAMES_STATIC}) +UTIL_BINS = $(addprefix ${BUILD}/utility/,${UTIL_NAMES}) ifneq (${IN_CHROOT},) -UTIL_NAMES += mount-encrypted +UTIL_SBINS = $(addprefix ${BUILD}/utility/,mount-encrypted) endif -UTIL_BINS_STATIC := $(addprefix ${BUILD}/utility/,${UTIL_NAMES_STATIC}) -UTIL_BINS = $(addprefix ${BUILD}/utility/,${UTIL_NAMES}) ALL_DEPS += $(addsuffix .d,${UTIL_BINS}) -U_DESTDIR = ${O_DESTDIR} # Scripts for signing stuff. SIGNING_SCRIPTS = \ utility/tpm-nvsize \ utility/chromeos-tpm-recovery -# We need these wrapped, but the symlinks go in different places. +# These go in a different place. SIGNING_SCRIPTS_DEV = \ scripts/image_signing/resign_firmwarefd.sh \ scripts/image_signing/make_dev_firmware.sh \ @@ -391,20 +399,12 @@ SIGNING_SCRIPTS_DEV = \ # Installed, but not made executable. SIGNING_COMMON = scripts/image_signing/common_minimal.sh + # The unified firmware utility will eventually replace all the others FUTIL_BIN = ${BUILD}/futility/futility -# These are the others it will replace. -FUTIL_OLD = $(notdir ${CGPT} ${UTIL_BINS} ${UTIL_SCRIPTS} ${SIGNING_SCRIPTS}) - -# The ebuild will put these somewhere else on the target. -ifeq (${MINIMAL},) -FUTIL_OLD += $(notdir ${SIGNING_SCRIPTS_DEV}) -endif - FUTIL_SRCS = \ - futility/futility.c \ - futility/cmd_foo.c + futility/IGNOREME.c FUTIL_LDS = futility/futility.lds @@ -413,8 +413,6 @@ FUTIL_OBJS = ${FUTIL_SRCS:%.c=${BUILD}/%.o} ALL_DEPS += $(addsuffix .d,${FUTIL_BIN}) ALL_OBJS += ${FUTIL_OBJS} -F_DESTDIR = ${DESTDIR} - # Library of handy test functions. TESTLIB = ${BUILD}/tests/test.a @@ -558,7 +556,7 @@ clean: ${Q}/bin/rm -rf ${BUILD} .PHONY: install -install: cgpt_install utils_install futil_install +install: cgpt_install utils_install signing_install futil_install # Don't delete intermediate object files .SECONDARY: @@ -654,8 +652,8 @@ ${CGPT}: ${CGPT_OBJS} ${LIBS} .PHONY: cgpt_install cgpt_install: ${CGPT} @printf " INSTALL CGPT\n" - ${Q}mkdir -p ${C_DESTDIR} - ${Q}${INSTALL} -t ${C_DESTDIR} $^ + ${Q}mkdir -p ${UB_DIR} + ${Q}${INSTALL} -t ${UB_DIR} $^ # ---------------------------------------------------------------------------- # Utilities @@ -667,26 +665,32 @@ ${BUILD}/utility/%: INCLUDES += -Ihost/include -Iutility/include ${UTIL_BINS_STATIC}: LDFLAGS += -static .PHONY: utils -utils: ${UTIL_BINS} ${UTIL_SCRIPTS} -# TODO: change ebuild to pull scripts directly out of utility dir +utils: ${UTIL_BINS} ${UTIL_SCRIPTS} ${UTIL_SBINS} ${Q}cp -f ${UTIL_SCRIPTS} ${BUILD}/utility ${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS}) .PHONY: utils_install -utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} +utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} ${UTIL_SBINS} @printf " INSTALL UTILS\n" - ${Q}mkdir -p ${U_DESTDIR} - ${Q}${INSTALL} -t ${U_DESTDIR} $^ + ${Q}mkdir -p ${UB_DIR} + ${Q}${INSTALL} -t ${UB_DIR} ${UTIL_BINS} ${UTIL_SCRIPTS} +ifneq (${UTIL_SBINS},) + ${Q}mkdir -p ${SB_DIR} + ${Q}${INSTALL} -t ${SB_DIR} ${UTIL_SBINS} +endif -# And some signing stuff... +# And some signing stuff for the target .PHONY: signing_install signing_install: ${SIGNING_SCRIPTS} ${SIGNING_SCRIPTS_DEV} ${SIGNING_COMMON} +ifneq (${MINIMAL},) @printf " INSTALL SIGNING\n" - ${Q}mkdir -p ${U_DESTDIR} - ${Q}${INSTALL} -t ${U_DESTDIR} ${SIGNING_SCRIPTS} - ${Q}${INSTALL} -t ${U_DESTDIR} ${SIGNING_SCRIPTS_DEV} - ${Q}${INSTALL} -t ${U_DESTDIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON} + ${Q}mkdir -p ${UB_DIR} + ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS} + ${Q}mkdir -p ${VB_DIR} + ${Q}${INSTALL} -t ${VB_DIR} ${SIGNING_SCRIPTS_DEV} + ${Q}${INSTALL} -t ${VB_DIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON} +endif # ---------------------------------------------------------------------------- # new Firmware Utility @@ -699,13 +703,11 @@ ${FUTIL_BIN}: ${FUTIL_LDS} ${FUTIL_OBJS} ${Q}${LD} -o $@ ${CFLAGS} $^ ${LDFLAGS} ${LDLIBS} .PHONY: futil_install -futil_install: ${FUTIL_BIN} cgpt_install utils_install signing_install +futil_install: ${FUTIL_BIN} @printf " INSTALL futility\n" - ${Q}mkdir -p ${F_DESTDIR} - ${Q}${INSTALL} -t ${F_DESTDIR} ${FUTIL_BIN} - ${Q}mkdir -p ${O_DESTDIR} - ${Q}for prog in ${FUTIL_OLD}; do \ - ln -sf futility "${F_DESTDIR}/$$prog"; done + ${Q}mkdir -p ${UB_DIR} + ${Q}${INSTALL} -t ${UB_DIR} $^ + # ---------------------------------------------------------------------------- # Mount-encrypted utility for cryptohome @@ -844,10 +846,6 @@ ${BUILD}/utility/dump_kernel_config: ${DUMPKERNELCONFIGLIB} # GBB utility needs C++ linker. TODO: It shouldn't. ${BUILD}/utility/gbb_utility: LD = ${CXX} -# Because we play some clever linker script games to add new commands without -# changing any header files, futility must be linked with ld.bfd, not gold. -${FUTIL_BIN}: LDFLAGS += -fuse-ld=bfd - # Some utilities need external crypto functions ${BUILD}/utility/dumpRSAPublicKey: LDLIBS += ${CRYPTO_LIBS} ${BUILD}/utility/pad_digest_utility: LDLIBS += ${CRYPTO_LIBS} @@ -921,7 +919,7 @@ test_targets:: runcgpttests runmisctests ifeq (${MINIMAL},) # Bitmap utility isn't compiled for minimal variant -test_targets:: runbmptests runfutiltests +test_targets:: runbmptests # Scripts don't work under qemu testing # TODO: convert scripts to makefile so they can be called directly test_targets:: runtestscripts @@ -1010,7 +1008,7 @@ runmisctests: test_setup .PHONY: runfutiltests runfutiltests: DESTDIR := ${TEST_INSTALL_DIR} runfutiltests: test_setup install - futility/tests/run_futility_tests.sh ${DESTDIR} + @echo "$@ passed" # Run long tests, including all permutations of encryption keys (instead of # just the ones we use) and tests of currently-unused code. diff --git a/utility/chromeos-tpm-recovery-test b/utility/chromeos-tpm-recovery-test index e7638109..e633d311 100755 --- a/utility/chromeos-tpm-recovery-test +++ b/utility/chromeos-tpm-recovery-test @@ -30,7 +30,7 @@ if [ "$test_kind" = "fake" ]; then ctr=../chromeos-tpm-recovery tpmc=./tpmc else - ctr=/usr/sbin/chromeos-tpm-recovery + ctr=chromeos-tpm-recovery tpmc=tpmc fi diff --git a/utility/mount-encrypted.c b/utility/mount-encrypted.c index 98e63e74..9dbedc2a 100644 --- a/utility/mount-encrypted.c +++ b/utility/mount-encrypted.c @@ -1063,6 +1063,12 @@ static int shutdown(void) } } + /* + * Force syncs to make sure we don't tickle racey/buggy kernel + * routines that might be causing crosbug.com/p/17610. + */ + sync(); + /* Optionally run fsck on the device after umount. */ if (getenv("MOUNT_ENCRYPTED_FSCK")) { char *cmd; @@ -1081,12 +1087,15 @@ static int shutdown(void) INFO("Removing %s.", dmcrypt_dev); if (!dm_teardown(dmcrypt_dev)) ERROR("dm_teardown(%s)", dmcrypt_dev); + sync(); INFO("Unlooping %s (named %s).", block_path, dmcrypt_name); if (!loop_detach_name(dmcrypt_name)) { ERROR("loop_detach_name(%s)", dmcrypt_name); return EXIT_FAILURE; } + sync(); + return EXIT_SUCCESS; } |