From 7db7a6db8f0719fe0fda8219c7111c7caf0b4546 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Mon, 1 Oct 2018 17:03:42 +0800 Subject: futility: updater: Add '--archive' to read from an archive or directory A firmware update is usually released as a package with multiple images, instructions, signed vblocks and other files. To work with that, a new argument '--archive' is added. The --archive accepts a directory or file, and will determine the correct driver automatically. For resources (for example --image) in relative path, updater should find files from archive. Note in current implementation, only ZIP is supported for file type drivers (and need the system to have libzip already installed). BUG=chromium:875551 TEST=TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I6a91cbe73fb4ee203c5fa4607f6651a39ba854d5 Signed-off-by: Hung-Te Lin Reviewed-on: https://chromium-review.googlesource.com/1253229 Reviewed-by: Randall Spangler --- Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b717c3bd..a3720135 100644 --- a/Makefile +++ b/Makefile @@ -233,6 +233,14 @@ LDFLAGS += -static PKG_CONFIG += --static endif +# Optional Libraries +LIBZIP_VERSION := $(shell ${PKG_CONFIG} --modversion libzip 2>/dev/null) +HAVE_LIBZIP := $(if ${LIBZIP_VERSION},1) +ifneq (${HAVE_LIBZIP},) + CFLAGS += -DHAVE_LIBZIP $(shell ${PKG_CONFIG} --cflags libzip) + LIBZIP_LIBS := $(shell ${PKG_CONFIG} --libs libzip) +endif + # Determine QEMU architecture needed, if any ifeq (${ARCH},${HOST_ARCH}) # Same architecture; no need for QEMU @@ -688,6 +696,7 @@ FUTIL_SRCS = \ futility/misc.c \ futility/ryu_root_header.c \ futility/updater.c \ + futility/updater_archive.c \ futility/updater_quirks.c \ futility/vb1_helper.c \ futility/vb2_helper.c @@ -1120,7 +1129,10 @@ signing_install: ${SIGNING_SCRIPTS} ${SIGNING_SCRIPTS_DEV} ${SIGNING_COMMON} .PHONY: futil futil: ${FUTIL_BIN} -${FUTIL_BIN}: LDLIBS += ${CRYPTO_LIBS} +# FUTIL_LIBS is shared by FUTIL_BIN and TEST_FUTIL_BINS. +FUTIL_LIBS = ${CRYPTO_LIBS} ${LIBZIP_LIBS} + +${FUTIL_BIN}: LDLIBS += ${FUTIL_LIBS} ${FUTIL_BIN}: ${FUTIL_OBJS} ${UTILLIB} ${FWLIB20} ${UTILBDB} @${PRINTF} " LD $(subst ${BUILD}/,,$@)\n" ${Q}${LD} -o $@ ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} @@ -1163,7 +1175,7 @@ ${TEST_BINS}: LIBS = ${TESTLIB} ${UTILLIB} ${TEST_FUTIL_BINS}: ${FUTIL_OBJS} ${UTILLIB} ${UTILBDB} ${TEST_FUTIL_BINS}: INCLUDES += -Ifutility ${TEST_FUTIL_BINS}: OBJS += ${FUTIL_OBJS} ${UTILLIB} ${UTILBDB} -${TEST_FUTIL_BINS}: LDLIBS += ${CRYPTO_LIBS} +${TEST_FUTIL_BINS}: LDLIBS += ${FUTIL_LIBS} ${TEST2X_BINS}: ${FWLIB2X} ${TEST2X_BINS}: LIBS += ${FWLIB2X} -- cgit v1.2.1