https://bugzilla.tianocore.org/show_bug.cgi?id=1450
In the Multiple thread Genfds feature, build tool generates
GenSec, GenFFS command in Makefile.
The Non-Hii Driver does not generate .offset file for uni string offset,
but the build tool has not knowledge about this in autogen phase. So
in this patch, I add a check in Makefile for GenSec command. If the GenSec
input file does not exist, the GenSec will not be called. And if GenSec
command is not called, its output file, which is also the input file of
GenFfs command, will also not exist.So for GenFfs command,
I add a new command parameter -oi which means
the input file is an optional input file which would not exist. so
that I can generate GenFfs command with "-oi" parameter in Makefile.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
?.dll\r
\r
<OutputFile>\r
?.dll\r
\r
<OutputFile>\r
- $(DEBUG_DIR)(+)$(MODULE_NAME).efi\r
+ $(OUTPUT_DIR)(+)$(MODULE_NAME).efi\r
\r
<Command.MSFT, Command.INTEL, Command.RVCT>\r
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)\r
\r
<Command.MSFT, Command.INTEL, Command.RVCT>\r
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)\r
- $(CP) ${dst} $(OUTPUT_DIR)\r
+ $(CP) ${dst} $(DEBUG_DIR)\r
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi\r
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)\r
-$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) \r
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi\r
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)\r
-$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) \r
-$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug\r
\r
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)\r
-$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug\r
\r
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)\r
- $(CP) ${dst} $(OUTPUT_DIR)\r
+ $(CP) ${dst} $(DEBUG_DIR)\r
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi\r
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)\r
\r
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi\r
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)\r
\r
# create symbol file for GDB debug\r
-$(DSYMUTIL) ${src}\r
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)\r
# create symbol file for GDB debug\r
-$(DSYMUTIL) ${src}\r
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)\r
- $(CP) ${dst} $(OUTPUT_DIR)\r
+ $(CP) ${dst} $(DEBUG_DIR)\r
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi\r
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)\r
\r
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi\r
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)\r
\r
#include <sys/stat.h>\r
#endif\r
\r
#include <sys/stat.h>\r
#endif\r
\r
+#ifdef __GNUC__\r
+#include <unistd.h>\r
+#endif\r
+\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <string.h>\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <string.h>\r
128K,256K,512K,1M,2M,4M,8M,16M\n");\r
fprintf (stdout, " -i SectionFile, --sectionfile SectionFile\n\\r
Section file will be contained in this FFS file.\n");\r
128K,256K,512K,1M,2M,4M,8M,16M\n");\r
fprintf (stdout, " -i SectionFile, --sectionfile SectionFile\n\\r
Section file will be contained in this FFS file.\n");\r
+ fprintf (stdout, " -oi SectionFile, --optionalsectionfile SectionFile\n\\r
+ If the Section file exists, it will be contained in this FFS file, otherwise, it will be ignored.\n");\r
fprintf (stdout, " -n SectionAlign, --sectionalign SectionAlign\n\\r
SectionAlign points to section alignment, which support\n\\r
the alignment scope 0~16M. If SectionAlign is specified\n\\r
fprintf (stdout, " -n SectionAlign, --sectionalign SectionAlign\n\\r
SectionAlign points to section alignment, which support\n\\r
the alignment scope 0~16M. If SectionAlign is specified\n\\r
- if ((stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--sectionfile") == 0)) {\r
+ if ((stricmp (argv[0], "-oi") == 0) || (stricmp (argv[0], "--optionalsectionfile") == 0) || (stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--sectionfile") == 0)) {\r
//\r
// Get Input file name and its alignment\r
//\r
//\r
// Get Input file name and its alignment\r
//\r
Error (NULL, 0, 1003, "Invalid option value", "input section file is missing for -i option");\r
goto Finish;\r
}\r
Error (NULL, 0, 1003, "Invalid option value", "input section file is missing for -i option");\r
goto Finish;\r
}\r
+ if ((stricmp (argv[0], "-oi") == 0) || (stricmp (argv[0], "--optionalsectionfile") == 0) ){\r
+ if (-1 == access(argv[1] , 0)){\r
+ Warning(NULL, 0, 0001, "File is not found.", argv[1]);\r
+ argc -= 2;\r
+ argv += 2;\r
+ continue;\r
+ }\r
+ }\r
//\r
// Allocate Input file name buffer and its alignment buffer.\r
//\r
//\r
// Allocate Input file name buffer and its alignment buffer.\r
//\r
for index, Str in enumerate(FfsCmdList):\r
if '-o' == Str:\r
OutputFile = FfsCmdList[index + 1]\r
for index, Str in enumerate(FfsCmdList):\r
if '-o' == Str:\r
OutputFile = FfsCmdList[index + 1]\r
+ if '-i' == Str or "-oi" == Str:\r
if DepsFileList == []:\r
DepsFileList = [FfsCmdList[index + 1]]\r
else:\r
if DepsFileList == []:\r
DepsFileList = [FfsCmdList[index + 1]]\r
else:\r
from Common.Misc import PathClass\r
from Common.LongFilePathSupport import OpenLongFilePath as open\r
from Common.MultipleWorkspace import MultipleWorkspace as mws\r
from Common.Misc import PathClass\r
from Common.LongFilePathSupport import OpenLongFilePath as open\r
from Common.MultipleWorkspace import MultipleWorkspace as mws\r
+import Common.GlobalData as GlobalData\r
\r
## Global variables\r
#\r
\r
## Global variables\r
#\r
\r
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)\r
if IsMakefile:\r
\r
SaveFileOnChange(CommandFile, ' '.join(Cmd), False)\r
if IsMakefile:\r
+ if GlobalData.gGlobalDefines.get("FAMILY") == "MSFT":\r
+ Cmd = ['if', 'exist', Input[0]] + Cmd\r
+ else:\r
+ Cmd = ['test', '-e', Input[0], "&&"] + Cmd\r
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:\r
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())\r
elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):\r
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:\r
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())\r
elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):\r
\r
Cmd += ("-o", Output)\r
for I in range(0, len(Input)):\r
\r
Cmd += ("-o", Output)\r
for I in range(0, len(Input)):\r
- Cmd += ("-i", Input[I])\r
+ if MakefilePath:\r
+ Cmd += ("-oi", Input[I])\r
+ else:\r
+ Cmd += ("-i", Input[I])\r
if SectionAlign and SectionAlign[I]:\r
Cmd += ("-n", SectionAlign[I])\r
\r
if SectionAlign and SectionAlign[I]:\r
Cmd += ("-n", SectionAlign[I])\r
\r
@property\r
def Arch(self):\r
return self._Arch\r
@property\r
def Arch(self):\r
return self._Arch\r
+ @property\r
+ def Dir(self):\r
+ return self.MetaFile.Dir\r
\r
## Retrieve all information in [Defines] section\r
#\r
\r
## Retrieve all information in [Defines] section\r
#\r
# Add ffs build to makefile\r
CmdListDict = {}\r
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:\r
# Add ffs build to makefile\r
CmdListDict = {}\r
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:\r
- CmdListDict = self._GenFfsCmd()\r
+ CmdListDict = self._GenFfsCmd(Wa.ArchList)\r
\r
for Arch in Wa.ArchList:\r
GlobalData.gGlobalDefines['ARCH'] = Arch\r
\r
for Arch in Wa.ArchList:\r
GlobalData.gGlobalDefines['ARCH'] = Arch\r
# Add ffs build to makefile\r
CmdListDict = None\r
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:\r
# Add ffs build to makefile\r
CmdListDict = None\r
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:\r
- CmdListDict = self._GenFfsCmd()\r
+ CmdListDict = self._GenFfsCmd(Wa.ArchList)\r
self.Progress.Stop("done!")\r
MaList = []\r
ExitFlag = threading.Event()\r
self.Progress.Stop("done!")\r
MaList = []\r
ExitFlag = threading.Event()\r
#\r
self._SaveMapFile (MapBuffer, Wa)\r
\r
#\r
self._SaveMapFile (MapBuffer, Wa)\r
\r
- def _GenFfsCmd(self):\r
+ def _GenFfsCmd(self,ArchList):\r
# convert dictionary of Cmd:(Inf,Arch)\r
# to a new dictionary of (Inf,Arch):Cmd,Cmd,Cmd...\r
CmdSetDict = defaultdict(set)\r
# convert dictionary of Cmd:(Inf,Arch)\r
# to a new dictionary of (Inf,Arch):Cmd,Cmd,Cmd...\r
CmdSetDict = defaultdict(set)\r
- GenFfsDict = GenFds.GenFfsMakefile('', GlobalData.gFdfParser, self, self.ArchList, GlobalData)\r
+ GenFfsDict = GenFds.GenFfsMakefile('', GlobalData.gFdfParser, self, ArchList, GlobalData)\r
for Cmd in GenFfsDict:\r
tmpInf, tmpArch = GenFfsDict[Cmd]\r
CmdSetDict[tmpInf, tmpArch].add(Cmd)\r
for Cmd in GenFfsDict:\r
tmpInf, tmpArch = GenFfsDict[Cmd]\r
CmdSetDict[tmpInf, tmpArch].add(Cmd)\r
# Add ffs build to makefile\r
CmdListDict = None\r
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:\r
# Add ffs build to makefile\r
CmdListDict = None\r
if GlobalData.gEnableGenfdsMultiThread and self.Fdf:\r
- CmdListDict = self._GenFfsCmd()\r
+ CmdListDict = self._GenFfsCmd(Wa.ArchList)\r
\r
# multi-thread exit flag\r
ExitFlag = threading.Event()\r
\r
# multi-thread exit flag\r
ExitFlag = threading.Event()\r