summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-03-07 12:54:29 -0800
committerChromeBot <chrome-bot@google.com>2013-03-11 08:38:46 -0700
commitfeb2518166b1cd181e607c611cbb610f0c7300da (patch)
tree33a22857fad5a1f2246caf064b3b4eec8867e00f /Makefile
parent5fed2a667096341160db8643a4a057e328953a1d (diff)
downloadvboot-feb2518166b1cd181e607c611cbb610f0c7300da.tar.gz
Wrap all vboot utilities with futility.firmware-spring-3833.Bfactory-spring-3842.B
This moves all the old userspace utilities generated by vboot_reference into a subdirectory not in $PATH, and replaces them with symlinks to a single executable named 'futility'. At the moment that utility just execs the original utilities (optionally logging that fact first). Ultimately, the old utilities will be subsumed into a single binary instead of multiple separate executables. There is a matching CL needed to make the recovery image creation work. BUG=chromium-os:37062 BRANCH=none CQ-DEPEND=CL:44864 TEST=auto To test, build everything, test everything. It should work as before in all cases. I have built normal images, test images, factory installers, recovery images; they all seem to work. I've run trybots on daisy-paladin link-paladin lumpy-paladin and alex-paladin. Change-Id: Ie93db676f2ed2a64e4b13b3b5dc6b65a77db0f8c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44871 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile66
1 files changed, 46 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index a7101cc4..cd391143 100644
--- a/Makefile
+++ b/Makefile
@@ -37,22 +37,29 @@
# We should only run pwd once, not every time we refer to ${BUILD}.
SRCDIR := $(shell pwd)
-BUILD ?= $(SRCDIR)/build
+BUILD = $(SRCDIR)/build
export BUILD
# Stuff for 'make install'
-INSTALL ?= install
-DESTDIR ?= /usr/local/bin
-
+INSTALL = install
+DESTDIR = /usr/local/bin
+OLDDIR = old_bins
+
+# Where exactly do the pieces go?
+# FT_DIR = futility target directory - where it will be on the target
+# F_DIR = futility install directory - where it gets put right now
+# UB_DIR = userspace binary directory for futility's exec() targets
+# VB_DIR = target vboot directory - for dev-mode-only helpers, keys, etc.
ifeq (${MINIMAL},)
# Host install just puts everything in one place
-UB_DIR=${DESTDIR}
-SB_DIR=${DESTDIR}
-VB_DIR=${DESTDIR}
+FT_DIR=${DESTDIR}
+F_DIR=${DESTDIR}
+UB_DIR=${DESTDIR}/${OLDDIR}
else
# Target install puts things into DESTDIR subdirectories
-UB_DIR=${DESTDIR}/usr/bin
-SB_DIR=${DESTDIR}/sbin
+FT_DIR=/usr/bin
+F_DIR=${DESTDIR}${FT_DIR}
+UB_DIR=${F_DIR}/${OLDDIR}
VB_DIR=${DESTDIR}/usr/share/vboot/bin
endif
@@ -127,6 +134,10 @@ CC ?= gcc
CFLAGS += -DCHROMEOS_ENVIRONMENT -Wall -Werror # HEY: always want last two?
endif
+ifneq (${OLDDIR},)
+CFLAGS += -DOLDDIR=${OLDDIR}
+endif
+
ifneq (${DEBUG},)
CFLAGS += -DVBOOT_DEBUG
endif
@@ -135,6 +146,10 @@ ifeq (${DISABLE_NDEBUG},)
CFLAGS += -DNDEBUG
endif
+ifneq (${FORCE_LOGGING_ON},)
+CFLAGS += -DFORCE_LOGGING_ON=${FORCE_LOGGING_ON}
+endif
+
# Create / use dependency files
CFLAGS += -MMD -MF $@.d
@@ -429,8 +444,13 @@ 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} ${SIGNING_SCRIPTS_DEV})
+
FUTIL_SRCS = \
- futility/IGNOREME.c
+ futility/futility.c \
+ futility/cmd_foo.c
FUTIL_LDS = futility/futility.lds
@@ -696,13 +716,15 @@ utils_install: ${UTIL_BINS} ${UTIL_SCRIPTS}
# 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 ${UB_DIR}
${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS}
+ ${Q}${INSTALL} -t ${UB_DIR} ${SIGNING_SCRIPTS_DEV}
+ ${Q}${INSTALL} -t ${UB_DIR} -m 'u=rw,go=r,a-s' ${SIGNING_COMMON}
+ifneq (${VB_DIR},)
${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}
+ ${Q}for prog in $(notdir ${SIGNING_SCRIPTS_DEV}); do \
+ ln -sf "${FT_DIR}/futility" "${VB_DIR}/$$prog"; done
endif
# ----------------------------------------------------------------------------
@@ -718,9 +740,10 @@ ${FUTIL_BIN}: ${FUTIL_LDS} ${FUTIL_OBJS}
.PHONY: futil_install
futil_install: ${FUTIL_BIN}
@printf " INSTALL futility\n"
- ${Q}mkdir -p ${UB_DIR}
- ${Q}${INSTALL} -t ${UB_DIR} $^
-
+ ${Q}mkdir -p ${F_DIR}
+ ${Q}${INSTALL} -t ${F_DIR} ${FUTIL_BIN}
+ ${Q}for prog in ${FUTIL_OLD}; do \
+ ln -sf futility "${F_DIR}/$$prog"; done
# ----------------------------------------------------------------------------
# Utility to generate TLCL structure definition header file.
@@ -791,6 +814,10 @@ ${BUILD}/firmware/linktest/main: LIBS = ${FWLIB}
# 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}
@@ -855,7 +882,7 @@ test_targets:: runcgpttests runmisctests
ifeq (${MINIMAL},)
# Bitmap utility isn't compiled for minimal variant
-test_targets:: runbmptests
+test_targets:: runbmptests runfutiltests
# Scripts don't work under qemu testing
# TODO: convert scripts to makefile so they can be called directly
test_targets:: runtestscripts
@@ -938,9 +965,9 @@ runmisctests: test_setup
${RUNTEST} ${BUILD_RUN}/tests/vboot_nvstorage_test
.PHONY: runfutiltests
-runfutiltests: DESTDIR := ${TEST_INSTALL_DIR}
+runfutiltests: override DESTDIR = ${TEST_INSTALL_DIR}
runfutiltests: test_setup install
- @echo "$@ passed"
+ futility/tests/run_futility_tests.sh ${DESTDIR}
# Run long tests, including all permutations of encryption keys (instead of
# just the ones we use) and tests of currently-unused code.
@@ -987,4 +1014,3 @@ coverage:
else
coverage: coverage_init runtests coverage_html
endif
-