mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-25 06:19:56 +00:00
Merge "feat(fiptool): add ability to build statically" into integration
This commit is contained in:
commit
7c3ff62d22
2 changed files with 28 additions and 10 deletions
|
@ -13,8 +13,7 @@ FIPTOOL ?= fiptool${BIN_EXT}
|
||||||
PROJECT := $(notdir ${FIPTOOL})
|
PROJECT := $(notdir ${FIPTOOL})
|
||||||
OBJECTS := fiptool.o tbbr_config.o
|
OBJECTS := fiptool.o tbbr_config.o
|
||||||
V ?= 0
|
V ?= 0
|
||||||
OPENSSL_DIR := /usr
|
STATIC ?= 0
|
||||||
|
|
||||||
|
|
||||||
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
|
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
|
||||||
HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
|
HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
|
||||||
|
@ -24,14 +23,22 @@ else
|
||||||
HOSTCCFLAGS += -O2
|
HOSTCCFLAGS += -O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
INCLUDE_PATHS := -I../../include/tools_share
|
||||||
|
|
||||||
|
DEFINES += -DSTATIC=$(STATIC)
|
||||||
|
|
||||||
|
ifeq (${STATIC},1)
|
||||||
|
LDOPTS := -static
|
||||||
|
else
|
||||||
|
OPENSSL_DIR := /usr
|
||||||
|
|
||||||
# Select OpenSSL version flag according to the OpenSSL build selected
|
# Select OpenSSL version flag according to the OpenSSL build selected
|
||||||
# from setting the OPENSSL_DIR path.
|
# from setting the OPENSSL_DIR path.
|
||||||
$(eval $(call SELECT_OPENSSL_API_VERSION))
|
$(eval $(call SELECT_OPENSSL_API_VERSION))
|
||||||
|
|
||||||
HOSTCCFLAGS += ${DEFINES}
|
|
||||||
# USING_OPENSSL3 flag will be added to the HOSTCCFLAGS variable with the proper
|
# USING_OPENSSL3 flag will be added to the HOSTCCFLAGS variable with the proper
|
||||||
# computed value.
|
# computed value.
|
||||||
HOSTCCFLAGS += -DUSING_OPENSSL3=$(USING_OPENSSL3)
|
DEFINES += -DUSING_OPENSSL3=$(USING_OPENSSL3)
|
||||||
|
|
||||||
# Include library directories where OpenSSL library files are located.
|
# Include library directories where OpenSSL library files are located.
|
||||||
# For a normal installation (i.e.: when ${OPENSSL_DIR} = /usr or
|
# For a normal installation (i.e.: when ${OPENSSL_DIR} = /usr or
|
||||||
|
@ -39,7 +46,11 @@ HOSTCCFLAGS += -DUSING_OPENSSL3=$(USING_OPENSSL3)
|
||||||
# directory. However, for a local build of OpenSSL, the built binaries are
|
# directory. However, for a local build of OpenSSL, the built binaries are
|
||||||
# located under the main project directory (i.e.: ${OPENSSL_DIR}, not
|
# located under the main project directory (i.e.: ${OPENSSL_DIR}, not
|
||||||
# ${OPENSSL_DIR}/lib/).
|
# ${OPENSSL_DIR}/lib/).
|
||||||
LDLIBS := -L${OPENSSL_DIR}/lib -L${OPENSSL_DIR} -lcrypto
|
LDOPTS := -L${OPENSSL_DIR}/lib -L${OPENSSL_DIR} -lcrypto
|
||||||
|
INCLUDE_PATHS += -I${OPENSSL_DIR}/include
|
||||||
|
endif # STATIC
|
||||||
|
|
||||||
|
HOSTCCFLAGS += ${DEFINES}
|
||||||
|
|
||||||
ifeq (${V},0)
|
ifeq (${V},0)
|
||||||
Q := @
|
Q := @
|
||||||
|
@ -47,8 +58,6 @@ else
|
||||||
Q :=
|
Q :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
INCLUDE_PATHS := -I../../include/tools_share -I${OPENSSL_DIR}/include
|
|
||||||
|
|
||||||
HOSTCC ?= gcc
|
HOSTCC ?= gcc
|
||||||
|
|
||||||
ifneq (${PLAT},)
|
ifneq (${PLAT},)
|
||||||
|
@ -72,7 +81,7 @@ all: --openssl ${PROJECT}
|
||||||
|
|
||||||
${PROJECT}: ${OBJECTS} Makefile
|
${PROJECT}: ${OBJECTS} Makefile
|
||||||
@echo " HOSTLD $@"
|
@echo " HOSTLD $@"
|
||||||
${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
|
${Q}${HOSTCC} ${OBJECTS} -o $@ $(LDOPTS)
|
||||||
@${ECHO_BLANK_LINE}
|
@${ECHO_BLANK_LINE}
|
||||||
@echo "Built $@ successfully"
|
@echo "Built $@ successfully"
|
||||||
@${ECHO_BLANK_LINE}
|
@${ECHO_BLANK_LINE}
|
||||||
|
@ -84,10 +93,11 @@ ${PROJECT}: ${OBJECTS} Makefile
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
|
||||||
--openssl:
|
--openssl:
|
||||||
|
ifeq ($(STATIC),0)
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
@echo "Selected OpenSSL version: ${OPENSSL_CURRENT_VER}"
|
@echo "Selected OpenSSL version: ${OPENSSL_CURRENT_VER}"
|
||||||
endif
|
endif
|
||||||
|
endif # STATIC
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} $(DEPS))
|
$(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} $(DEPS))
|
||||||
|
|
|
@ -460,6 +460,7 @@ static struct option *fill_common_opts(struct option *opts, size_t *nr_opts,
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !STATIC
|
||||||
static void md_print(const unsigned char *md, size_t len)
|
static void md_print(const unsigned char *md, size_t len)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -467,6 +468,7 @@ static void md_print(const unsigned char *md, size_t len)
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
printf("%02x", md[i]);
|
printf("%02x", md[i]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int info_cmd(int argc, char *argv[])
|
static int info_cmd(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -498,7 +500,13 @@ static int info_cmd(int argc, char *argv[])
|
||||||
(unsigned long long)image->toc_e.offset_address,
|
(unsigned long long)image->toc_e.offset_address,
|
||||||
(unsigned long long)image->toc_e.size,
|
(unsigned long long)image->toc_e.size,
|
||||||
desc->cmdline_name);
|
desc->cmdline_name);
|
||||||
#ifndef _MSC_VER /* We don't have SHA256 for Visual Studio. */
|
|
||||||
|
/*
|
||||||
|
* Omit this informative code portion for:
|
||||||
|
* Visual Studio missing SHA256.
|
||||||
|
* Statically linked builds.
|
||||||
|
*/
|
||||||
|
#if !defined(_MSC_VER) && !STATIC
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
unsigned char md[SHA256_DIGEST_LENGTH];
|
unsigned char md[SHA256_DIGEST_LENGTH];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue