summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-12-04 11:29:57 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-06 01:11:42 +0000
commitcfe83a827d40b310003fc6996b9978d8cf301444 (patch)
treecb5f1b9d35c5873d4976c6cd22bb93bc61011f76 /Makefile
parent308d2540929cd95e2a565be95ce0b1d45d2fbed2 (diff)
downloadvboot-cfe83a827d40b310003fc6996b9978d8cf301444.tar.gz
Allow /etc/defaults/vboot_reference to customise some utilities
The dev_debug_vboot program can sometimes interfere with automated firmware testing because it takes too long to read the BIOS flash. Limiting the sections of flash that are read may help, but in some cases skipping this program entirely may be better. This CL does three things: 1. dev_debug_vboot will read only some sections of the BIOS flash, falling back to reading the whole thing only if it fails at that. 2. dev_debug_vboot will source /etc/default/vboot_reference if it exists. Putting DEV_DEBUG_FORCE=1 in that file will prevent dev_debug_vboot from reading the flash at all unless it's invoked with --force option. 3. The Makefile will create the /etc/default/vboot_reference file in the install directory, setting DEV_DEBUG_FORCE to the value in effect at build time. This will let a future CL change the default behavior for each target. BUG=chromium:438854 BRANCH=none TEST=manual Built and tested on Samus. /etc/default/vboot_reference was present, containing "DEV_DEBUG_FORCE=". The dev_debug_vboot script ran normally. Manually changing /etc/default/vboot_reference to contain "DEV_DEBUG_FORCE=1" and rebooting caused dev_debug_vboot to stop before reading the BIOS flash. I also manually forced various flashrom invocations to fail to test each part of the new flow. Change-Id: Ib319dd16b9026162d01f435f15570ec8ba99c512 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/233228 Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 21 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 61c639f5..3ee3abfd 100644
--- a/Makefile
+++ b/Makefile
@@ -45,16 +45,22 @@ export BUILD
INSTALL = install
DESTDIR = /usr/local
+# Default values
+DEV_DEBUG_FORCE=
+
# Where exactly do the pieces go?
# UB_DIR = utility binary directory
+# DF_DIR = utility defaults directory
# VB_DIR = vboot binary directory for dev-mode-only scripts
ifeq (${MINIMAL},)
# Host install just puts everything where it's told
UB_DIR=${DESTDIR}/bin
+DF_DIR=${DESTDIR}/default
VB_DIR=${DESTDIR}/bin
else
# Target install puts things into different places
UB_DIR=${DESTDIR}/usr/bin
+DF_DIR=${DESTDIR}/etc/default
VB_DIR=${DESTDIR}/usr/share/vboot/bin
endif
@@ -473,6 +479,8 @@ CGPT_SRCS = \
CGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o}
ALL_OBJS += ${CGPT_OBJS}
+# Utility defaults
+UTIL_DEFAULTS = ${BUILD}/default/vboot_reference
# Scripts to install directly (not compiled)
UTIL_SCRIPTS = \
@@ -505,7 +513,6 @@ UTIL_NAMES += \
utility/pad_digest_utility \
utility/signature_digest_utility \
utility/verify_data
-
endif
UTIL_BINS_STATIC := $(addprefix ${BUILD}/,${UTIL_NAMES_STATIC})
@@ -939,10 +946,12 @@ utils: ${UTIL_BINS} ${UTIL_SCRIPTS}
${Q}chmod a+rx $(patsubst %,${BUILD}/%,${UTIL_SCRIPTS})
.PHONY: utils_install
-utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS}
+utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS} ${UTIL_DEFAULTS}
@$(PRINTF) " INSTALL UTILS\n"
${Q}mkdir -p ${UB_DIR}
${Q}${INSTALL} -t ${UB_DIR} ${UTIL_BINS} ${UTIL_SCRIPTS}
+ ${Q}mkdir -p ${DF_DIR}
+ ${Q}${INSTALL} -t ${DF_DIR} -m 'u=rw,go=r,a-s' ${UTIL_DEFAULTS}
# And some signing stuff for the target
.PHONY: signing_install
@@ -1057,6 +1066,16 @@ ${BUILD}/%.o: %.cc
# ----------------------------------------------------------------------------
# Here are the special tweaks to the generic rules.
+# Always create the defaults file, since it depends on input variables
+.PHONY: ${UTIL_DEFAULTS}
+${UTIL_DEFAULTS}:
+ @$(PRINTF) " CREATE $(subst ${BUILD}/,,$@)\n"
+ ${Q}rm -f $@
+ ${Q}mkdir -p $(dir $@)
+ ${Q}echo '# Generated file. Do not edit.' > $@.tmp
+ ${Q}echo "DEV_DEBUG_FORCE=${DEV_DEBUG_FORCE}" >> $@.tmp
+ ${Q}mv -f $@.tmp $@
+
# Some utilities need external crypto functions
CRYPTO_LIBS := $(shell ${PKG_CONFIG} --libs libcrypto)