diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 66 |
1 files changed, 46 insertions, 20 deletions
@@ -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 - |