From 2a6c1a8f9a41d053b58036fbb4478c799c987343 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 8 May 2017 18:29:03 +0900 Subject: [PATCH] fip: move headers shared between TF and fiptool to include/tools_share Some header files need to be shared between TF and host programs. For fiptool, two headers are copied to the tools/fiptool directory, but it looks clumsy. This commit introduces a new directory, include/tools_share, which collects headers that should be shared between TF and host programs. This will clarify the interface exposed to host tools. We should add new headers to this directory only when we really need to do so. For clarification, I inserted a blank line between headers from the include/ directory (#include <...>) and ones from a local directory (#include "..." ). Signed-off-by: Masahiro Yamada --- .gitignore | 4 ---- Makefile | 3 ++- .../firmware_image_package.h | 0 .../{lib/stdlib/sys => tools_share}/uuid.h | 0 tools/fiptool/Makefile | 23 +++---------------- tools/fiptool/fiptool.c | 5 ++-- tools/fiptool/fiptool.h | 6 ++--- tools/fiptool/tbbr_config.c | 5 ++-- tools/fiptool/tbbr_config.h | 4 ++-- 9 files changed, 16 insertions(+), 34 deletions(-) rename include/{common => tools_share}/firmware_image_package.h (100%) rename include/{lib/stdlib/sys => tools_share}/uuid.h (100%) diff --git a/.gitignore b/.gitignore index 2f9c89d38..4ece189ab 100644 --- a/.gitignore +++ b/.gitignore @@ -19,10 +19,6 @@ tools/cert_create/src/**/*.o tools/cert_create/cert_create tools/cert_create/cert_create.exe -# Ignore header files copied. -tools/fiptool/firmware_image_package.h -tools/fiptool/uuid.h - # GNU GLOBAL files GPATH GRTAGS diff --git a/Makefile b/Makefile index b644b2018..83d6b7ea4 100644 --- a/Makefile +++ b/Makefile @@ -176,7 +176,8 @@ INCLUDES += -Iinclude/bl1 \ -Iinclude/plat/common \ -Iinclude/services \ ${PLAT_INCLUDES} \ - ${SPD_INCLUDES} + ${SPD_INCLUDES} \ + -Iinclude/tools_share ################################################################################ diff --git a/include/common/firmware_image_package.h b/include/tools_share/firmware_image_package.h similarity index 100% rename from include/common/firmware_image_package.h rename to include/tools_share/firmware_image_package.h diff --git a/include/lib/stdlib/sys/uuid.h b/include/tools_share/uuid.h similarity index 100% rename from include/lib/stdlib/sys/uuid.h rename to include/tools_share/uuid.h diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile index 0a46ad7c6..29eac2a79 100644 --- a/tools/fiptool/Makefile +++ b/tools/fiptool/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. +# Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -11,7 +11,6 @@ include ${MAKE_HELPERS_DIRECTORY}build_env.mk PROJECT := fiptool${BIN_EXT} OBJECTS := fiptool.o tbbr_config.o V := 0 -COPIED_H_FILES := uuid.h firmware_image_package.h override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 CFLAGS := -Wall -Werror -pedantic -std=c99 @@ -28,8 +27,7 @@ else Q := endif -# Only include from local directory (see comment below). -INCLUDE_PATHS := -I. +INCLUDE_PATHS := -I. -I../../include/tools_share CC := gcc @@ -48,24 +46,9 @@ fip_create: fip_create.sh ${Q}mkdir -p ../fip_create ${Q}install -m 755 fip_create.sh ../fip_create/fip_create -%.o: %.c %.h ${COPIED_H_FILES} Makefile +%.o: %.c %.h Makefile @echo " CC $<" ${Q}${CC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ -# -# Copy required library headers to a local directory so they can be included -# by this project without adding the library directories to the system include -# path. This avoids conflicts with definitions in the compiler standard -# include path. -# -uuid.h : ../../include/lib/stdlib/sys/uuid.h - $(call SHELL_COPY,$<,$@) - -firmware_image_package.h : ../../include/common/firmware_image_package.h - $(call SHELL_COPY,$<,$@) - clean: $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} fip_create) - -distclean: clean - $(call SHELL_DELETE_ALL, ${COPIED_H_FILES}) diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c index 7bfd2720e..4d80f2f16 100644 --- a/tools/fiptool/fiptool.c +++ b/tools/fiptool/fiptool.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -20,8 +20,9 @@ #include +#include + #include "fiptool.h" -#include "firmware_image_package.h" #include "tbbr_config.h" #define OPT_TOC_ENTRY 0 diff --git a/tools/fiptool/fiptool.h b/tools/fiptool/fiptool.h index 81453e0d0..4b5cdd91f 100644 --- a/tools/fiptool/fiptool.h +++ b/tools/fiptool/fiptool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -10,8 +10,8 @@ #include #include -#include "firmware_image_package.h" -#include "uuid.h" +#include +#include #define NELEM(x) (sizeof (x) / sizeof *(x)) diff --git a/tools/fiptool/tbbr_config.c b/tools/fiptool/tbbr_config.c index 466208329..7c6c24be4 100644 --- a/tools/fiptool/tbbr_config.c +++ b/tools/fiptool/tbbr_config.c @@ -1,12 +1,13 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include -#include "firmware_image_package.h" +#include + #include "tbbr_config.h" /* The images used depends on the platform. */ diff --git a/tools/fiptool/tbbr_config.h b/tools/fiptool/tbbr_config.h index a5155c8b1..bad757db5 100644 --- a/tools/fiptool/tbbr_config.h +++ b/tools/fiptool/tbbr_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,7 +9,7 @@ #include -#include "uuid.h" +#include /* TODO: Update this number as required */ #define TOC_HEADER_SERIAL_NUMBER 0x12345678