Merge changes from topic "sami/834_fiptool_pack_issue_win_v1" into integration
* changes: Update makefile to build fiptool for Windows Fix fiptool packaging issue on windows
This commit is contained in:
commit
7c9499623b
21
Makefile
21
Makefile
|
@ -1157,7 +1157,13 @@ endif
|
||||||
clean:
|
clean:
|
||||||
@echo " CLEAN"
|
@echo " CLEAN"
|
||||||
$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
|
$(call SHELL_REMOVE_DIR,${BUILD_PLAT})
|
||||||
|
ifdef UNIX_MK
|
||||||
${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
|
${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
|
||||||
|
else
|
||||||
|
# Clear the MAKEFLAGS as we do not want
|
||||||
|
# to pass the gnumake flags to nmake.
|
||||||
|
${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) clean
|
||||||
|
endif
|
||||||
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
|
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
|
||||||
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
|
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} clean
|
||||||
${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
|
${Q}${MAKE} --no-print-directory -C ${ROMLIBPATH} clean
|
||||||
|
@ -1166,7 +1172,13 @@ realclean distclean:
|
||||||
@echo " REALCLEAN"
|
@echo " REALCLEAN"
|
||||||
$(call SHELL_REMOVE_DIR,${BUILD_BASE})
|
$(call SHELL_REMOVE_DIR,${BUILD_BASE})
|
||||||
$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
|
$(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*)
|
||||||
|
ifdef UNIX_MK
|
||||||
${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
|
${Q}${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean
|
||||||
|
else
|
||||||
|
# Clear the MAKEFLAGS as we do not want
|
||||||
|
# to pass the gnumake flags to nmake.
|
||||||
|
${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL)) realclean
|
||||||
|
endif
|
||||||
${Q}${MAKE} --no-print-directory -C ${SPTOOLPATH} clean
|
${Q}${MAKE} --no-print-directory -C ${SPTOOLPATH} clean
|
||||||
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
|
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${CRTTOOLPATH} clean
|
||||||
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
|
${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${ENCTOOLPATH} realclean
|
||||||
|
@ -1252,7 +1264,16 @@ fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME}
|
||||||
|
|
||||||
.PHONY: ${FIPTOOL}
|
.PHONY: ${FIPTOOL}
|
||||||
${FIPTOOL}:
|
${FIPTOOL}:
|
||||||
|
@${ECHO_BLANK_LINE}
|
||||||
|
@echo "Building $@"
|
||||||
|
ifdef UNIX_MK
|
||||||
${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} --no-print-directory -C ${FIPTOOLPATH}
|
${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} --no-print-directory -C ${FIPTOOLPATH}
|
||||||
|
else
|
||||||
|
# Clear the MAKEFLAGS as we do not want
|
||||||
|
# to pass the gnumake flags to nmake.
|
||||||
|
${Q}set MAKEFLAGS= && ${MSVC_NMAKE} /nologo /f ${FIPTOOLPATH}/Makefile.msvc FIPTOOLPATH=$(subst /,\,$(FIPTOOLPATH)) FIPTOOL=$(subst /,\,$(FIPTOOL))
|
||||||
|
endif
|
||||||
|
@${ECHO_BLANK_LINE}
|
||||||
|
|
||||||
sptool: ${SPTOOL}
|
sptool: ${SPTOOL}
|
||||||
.PHONY: ${SPTOOL}
|
.PHONY: ${SPTOOL}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
|
# Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
@ -86,3 +86,5 @@ define MAKE_BUILD_STRINGS
|
||||||
$$(CC) $$(TF_CFLAGS) $$(CFLAGS) -x c -c - -o $1
|
$$(CC) $$(TF_CFLAGS) $$(CFLAGS) -x c -c - -o $1
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
MSVC_NMAKE := nmake.exe
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019, Arm Limited. All rights reserved.
|
# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
@ -7,24 +7,31 @@
|
||||||
CC = cl.exe
|
CC = cl.exe
|
||||||
LD = link.exe
|
LD = link.exe
|
||||||
|
|
||||||
FIPTOOL = fiptool.exe
|
# FIPTOOLPATH and FIPTOOL are passed from the main makefile.
|
||||||
OBJECTS = fiptool.obj tbbr_config.obj win_posix.obj
|
|
||||||
|
OBJECTS = $(FIPTOOLPATH)\fiptool.obj \
|
||||||
|
$(FIPTOOLPATH)\tbbr_config.obj \
|
||||||
|
$(FIPTOOLPATH)\win_posix.obj
|
||||||
|
|
||||||
|
INC = -I$(FIPTOOLPATH) -Iinclude\tools_share
|
||||||
|
|
||||||
INC = -I. -I..\..\include\tools_share
|
|
||||||
CFLAGS = $(CFLAGS) /nologo /Za /Zi /c /O2 /MT
|
CFLAGS = $(CFLAGS) /nologo /Za /Zi /c /O2 /MT
|
||||||
|
|
||||||
all: $(FIPTOOL)
|
all: $(FIPTOOL)
|
||||||
|
|
||||||
$(FIPTOOL): $(OBJECTS)
|
$(FIPTOOL): $(OBJECTS)
|
||||||
$(LD) /INCREMENTAL:NO /debug /nodefaultlib:libc.lib /out:$@ $(LIBS) $**
|
$(LD) /nologo /INCREMENTAL:NO /debug /nodefaultlib:libc.lib /out:$@ $(LIBS) $**
|
||||||
|
|
||||||
.PHONY: clean realclean
|
.PHONY: clean realclean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
del /f /q $(OBJECTS) > nul
|
-@del /f /q $(OBJECTS) > nul
|
||||||
|
-@del /f /q $(FIPTOOLPATH)\*.pdb > nul
|
||||||
|
|
||||||
realclean:
|
realclean:
|
||||||
del /f /q $(OBJECTS) $(FIPTOOL) > nul
|
-@del /f /q $(OBJECTS) > nul
|
||||||
|
-@del /f /q $(FIPTOOLPATH)\*.pdb > nul
|
||||||
|
-@del /f /q $(FIPTOOL) > nul
|
||||||
|
|
||||||
.c.obj:
|
.c.obj:
|
||||||
$(CC) -c $(CFLAGS) $(INC) $< -Fo$@
|
$(CC) -c $(CFLAGS) $(INC) $< -Fo$@
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2017 - 2020, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -137,7 +137,8 @@ int getopt(int argc,
|
||||||
* Note that we only match over the shorter length of the pair, to allow
|
* Note that we only match over the shorter length of the pair, to allow
|
||||||
* for abbreviation or say --match=value
|
* for abbreviation or say --match=value
|
||||||
* Long option names may be abbreviated if the abbreviation is unique or an
|
* Long option names may be abbreviated if the abbreviation is unique or an
|
||||||
* exact match for some defined option.
|
* exact match for some defined option. This function does not check that the
|
||||||
|
* abbreviations are unique and should be handled by the caller.
|
||||||
* A long option may take a parameter, of the form --opt=param or --opt param.
|
* A long option may take a parameter, of the form --opt=param or --opt param.
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
|
@ -160,13 +161,44 @@ int getopt_1long(const int argc,
|
||||||
{
|
{
|
||||||
int result = RET_UNKNOWN_OPT;
|
int result = RET_UNKNOWN_OPT;
|
||||||
size_t loptn = 0;
|
size_t loptn = 0;
|
||||||
|
bool match_found = false;
|
||||||
|
|
||||||
while (longopts[loptn].name != 0) {
|
/*
|
||||||
|
* Long option names may be abbreviated if the abbreviation
|
||||||
|
* is unique or an exact match for some defined option.
|
||||||
|
* To handle this:
|
||||||
|
* - First search for an exact match.
|
||||||
|
* - If exact match was not found search for a abbreviated match.
|
||||||
|
* By doing this an incorrect option selection can be avoided.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 1. Search for an exact match. */
|
||||||
|
while (longopts[loptn].name != NULL) {
|
||||||
|
if (strcmp(optname, longopts[loptn].name) == 0) {
|
||||||
|
match_found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++loptn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2. If exact match was not found search for a abbreviated match. */
|
||||||
|
if (!match_found) {
|
||||||
|
loptn = 0;
|
||||||
|
while (longopts[loptn].name != NULL) {
|
||||||
if (optmatch(optname, longopts[loptn].name) == 0) {
|
if (optmatch(optname, longopts[loptn].name) == 0) {
|
||||||
|
match_found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++loptn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match_found) {
|
||||||
/* We found a match. */
|
/* We found a match. */
|
||||||
result = longopts[loptn].val;
|
result = longopts[loptn].val;
|
||||||
if (indexptr != 0)
|
if (indexptr != 0) {
|
||||||
*indexptr = loptn;
|
*indexptr = loptn;
|
||||||
|
}
|
||||||
switch (longopts[loptn].has_arg) {
|
switch (longopts[loptn].has_arg) {
|
||||||
case required_argument:
|
case required_argument:
|
||||||
if ((optind + 1) >= argc) {
|
if ((optind + 1) >= argc) {
|
||||||
|
@ -194,8 +226,7 @@ int getopt_1long(const int argc,
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
++loptn;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* If getopt finds an option character in argv that was not included
|
* If getopt finds an option character in argv that was not included
|
||||||
* in options, ... it returns '?' and sets the external variable
|
* in options, ... it returns '?' and sets the external variable
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2017-2020, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -9,13 +9,15 @@
|
||||||
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
#include <direct.h>
|
#include <stdbool.h>
|
||||||
#include <io.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <direct.h>
|
||||||
|
#include <io.h>
|
||||||
|
|
||||||
#include "uuid.h"
|
#include "uuid.h"
|
||||||
|
|
||||||
/* Derive or provide Windows equivalents of Posix/GCC/Unix stuff. */
|
/* Derive or provide Windows equivalents of Posix/GCC/Unix stuff. */
|
||||||
|
|
Loading…
Reference in New Issue