public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
@ 2019-07-01 10:13 Xiaoyu Lu
  2019-07-01 10:17 ` Liming Gao
  2019-07-08  0:43 ` Liming Gao
  0 siblings, 2 replies; 9+ messages in thread
From: Xiaoyu Lu @ 2019-07-01 10:13 UTC (permalink / raw)
  To: devel; +Cc: Xiaoyu Lu, Bob Feng, Liming Gao, Jiewen Yao

From: Jiewen Yao <jiewen.yao@intel.com>

It can be used to indicate a module can be build to run
as OS application and run in OS environment.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
---
 BaseTools/Conf/build_rule.template            |  2 +-
 BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
 BaseTools/Source/Python/AutoGen/GenC.py       | 23 ++++++++++---------
 BaseTools/Source/Python/Common/DataType.py    |  3 ++-
 BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
 .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
 .../Source/Python/Workspace/InfBuildData.py   |  2 +-
 .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
 8 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index 030e74c35a65..db06d3a6b45a 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -321,7 +321,7 @@
         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
 
 
-[Static-Library-File.USER_DEFINED]
+[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
     <InputFile>
         *.lib
 
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index e8e09dc8a366..32b5a5564827 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
                     # the type of build module is USER_DEFINED.
                     # All different DEPEX section tags would be copied into the As Built INF file
                     # and there would be separate DEPEX section tags
-                    if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
+                    if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
                         if (Arch.upper() == self.Arch.upper()) and (ModuleType.upper() != TAB_ARCH_COMMON):
                             DepexList.append({(Arch, ModuleType): DepexExpr})
                     else:
@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
                             DepexList.append({(Arch, ModuleType): DepexExpr})
 
         #the type of build module is USER_DEFINED.
-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
             for Depex in DepexList:
                 for key in Depex:
                     DepexStr += '[Depex.%s.%s]\n' % key
@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
 
         for ModuleType in self.DepexList:
             # Ignore empty [depex] section or [depex] section for SUP_MODULE_USER_DEFINED module
-            if len(self.DepexList[ModuleType]) == 0 or ModuleType == SUP_MODULE_USER_DEFINED:
+            if len(self.DepexList[ModuleType]) == 0 or ModuleType == SUP_MODULE_USER_DEFINED or ModuleType == SUP_MODULE_HOST_APPLICATION:
                 continue
 
             Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index b527295c0253..4cb776206e90 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
     SUP_MODULE_SMM_CORE          :   ["PiDxe.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h", "Library/BaseLib.h", "Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile, "Library/DebugLib.h"]
+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile, "Library/DebugLib.h"],
+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile, "Library/DebugLib.h"]
 }
 
 ## Autogen internal worker macro to define DynamicEx PCD name includes both the TokenSpaceGuidName
@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
             ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
             ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
-        if Info.ModuleType not in [SUP_MODULE_BASE, SUP_MODULE_USER_DEFINED]:
+        if Info.ModuleType not in [SUP_MODULE_BASE, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
             if Lib.ModuleType in SUP_MODULE_SET_PEI:
                 ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
                 ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, AutoGenH):
     if Info.IsLibrary:
         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
     else:
-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_USER_DEFINED]:
+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
             AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
         elif Info.ModuleType in SUP_MODULE_SET_PEI:
             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
             DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
             DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
-        if Info.ModuleType not in [SUP_MODULE_BASE, SUP_MODULE_USER_DEFINED]:
+        if Info.ModuleType not in [SUP_MODULE_BASE, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
             if Lib.ModuleType in SUP_MODULE_SET_PEI:
                 DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
                 DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
     if Info.IsLibrary:
         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
     else:
-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_USER_DEFINED]:
+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
             AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
         elif Info.ModuleType in SUP_MODULE_SET_PEI:
             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file
 #
 def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
-    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]:
+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
         return
     #
     # Module Entry Points
@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file
 #
 def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
-    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE, SUP_MODULE_SEC]:
+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE, SUP_MODULE_SEC]:
         return
     #
     # Unload Image Handlers
@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file
 #
 def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
         GuidType = TAB_GUID
     else:
         GuidType = "EFI_GUID"
@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file
 #
 def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
         GuidType = TAB_GUID
     else:
         GuidType = "EFI_GUID"
@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
 #   @param      AutoGenH    The TemplateString object for header file
 #
 def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
         GuidType = TAB_GUID
     else:
         GuidType = "EFI_GUID"
@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
     # Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found
     if TokenSpaceList:
         AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n")
-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]:
+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
             GuidType = TAB_GUID
         else:
             GuidType = "EFI_GUID"
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py
index 83ec36c2350d..8ae1bd28fabf 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER = 'DXE_SMM_DRIVER'
 SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
 SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
 SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
 SUP_MODULE_SMM_CORE = 'SMM_CORE'
 SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
 SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
 
 SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER, \
                    SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_UEFI_DRIVER, \
-                   SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]
+                   SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]
 SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
 SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE}
 
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index fb5fd85e0a82..9b04a76af8c5 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -3543,7 +3543,7 @@ class FdfParser:
                 SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER,
                 SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
                 SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_UEFI_DRIVER,
-                SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
+                SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION,
                 TAB_DEFAULT, SUP_MODULE_BASE,
                 EDK_COMPONENT_TYPE_SECURITY_CORE,
                 EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index cd3b0f647793..ebb93b14c4ff 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -25,6 +25,7 @@ from . import RuleComplexFile
 from CommonDataClass.FdfClass import FfsInfStatementClassObject
 from Common.MultipleWorkspace import MultipleWorkspace as mws
 from Common.DataType import SUP_MODULE_USER_DEFINED
+from Common.DataType import SUP_MODULE_HOST_APPLICATION
 from Common.StringUtils import *
 from Common.Misc import PathClass
 from Common.Misc import GuidStructureByteArrayToGuidString
@@ -84,12 +85,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1], []).append(File)
 
             # Check if current INF module has DEPEX
-            if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
+            if '.depex' not in self.FinalTargetSuffixMap and self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
                 and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
                 ModuleType = self.InfModule.ModuleType
                 PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
 
-                if ModuleType != SUP_MODULE_USER_DEFINED:
+                if ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION:
                     for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
                         if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
                             self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
@@ -378,7 +379,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         #
         # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED
         #
-        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType != SUP_MODULE_USER_DEFINED:
+        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType != SUP_MODULE_USER_DEFINED and self.ModuleType != SUP_MODULE_HOST_APPLICATION:
             return EfiFile
 
         #
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py
index e66b7c983278..60970cd92836 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \
                                 % self.ModuleType, File=self.MetaFile)
 
-        if len(RecordList) != 0 and self.ModuleType == SUP_MODULE_USER_DEFINED:
+        if len(RecordList) != 0 and (self.ModuleType == SUP_MODULE_USER_DEFINED or self.ModuleType == SUP_MODULE_HOST_APPLICATION):
             for Record in RecordList:
                 if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SMM_DRIVER]:
                     EdkLogger.error('build', FORMAT_INVALID,
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index 0cc83110efd5..41ae684d3ee9 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -8,6 +8,7 @@
 from __future__ import absolute_import
 from collections import OrderedDict, defaultdict
 from Common.DataType import SUP_MODULE_USER_DEFINED
+from Common.DataType import SUP_MODULE_HOST_APPLICATION
 from .BuildClassObject import LibraryClassObject
 import Common.GlobalData as GlobalData
 from Workspace.BuildClassObject import StructurePcd
@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
     # If a module has a MODULE_TYPE of USER_DEFINED,
     # do not link in NULL library class instances from the global [LibraryClasses.*] sections.
     #
-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
         for LibraryClass in Platform.LibraryClasses.GetKeys():
             if LibraryClass.startswith("NULL") and Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
                 Module.LibraryClasses[LibraryClass] = Platform.LibraryClasses[LibraryClass, Module.ModuleType]
@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
                     LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
                 elif LibraryModule.LibraryClass is None \
                      or len(LibraryModule.LibraryClass) == 0 \
-                     or (ModuleType != SUP_MODULE_USER_DEFINED
+                     or (ModuleType != SUP_MODULE_USER_DEFINED and ModuleType != SUP_MODULE_HOST_APPLICATION
                          and ModuleType not in LibraryModule.LibraryClass[0].SupModList):
                     # only USER_DEFINED can link against any library instance despite of its SupModList
                     if FileName:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
  2019-07-01 10:13 [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type Xiaoyu Lu
@ 2019-07-01 10:17 ` Liming Gao
  2019-07-03  8:41   ` Xiaoyu Lu
  2019-07-08  0:43 ` Liming Gao
  1 sibling, 1 reply; 9+ messages in thread
From: Liming Gao @ 2019-07-01 10:17 UTC (permalink / raw)
  To: Lu, XiaoyuX, devel@edk2.groups.io; +Cc: Feng, Bob C, Yao, Jiewen

Xiaoyu:
  This is a new module type. Please submit BZ for INF spec update first. 

  And, also submit BZ for code change. In BZ, please specify this type usage model. 

Thanks
Liming
>-----Original Message-----
>From: Lu, XiaoyuX
>Sent: Monday, July 01, 2019 6:13 PM
>To: devel@edk2.groups.io
>Cc: Lu, XiaoyuX <xiaoyux.lu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>;
>Gao, Liming <liming.gao@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
>Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
>
>From: Jiewen Yao <jiewen.yao@intel.com>
>
>It can be used to indicate a module can be build to run
>as OS application and run in OS environment.
>
>Cc: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Jiewen Yao <jiewen.yao@intel.com>
>Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
>---
> BaseTools/Conf/build_rule.template            |  2 +-
> BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
> BaseTools/Source/Python/AutoGen/GenC.py       | 23 ++++++++++---------
> BaseTools/Source/Python/Common/DataType.py    |  3 ++-
> BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
> .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
> .../Source/Python/Workspace/InfBuildData.py   |  2 +-
> .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
> 8 files changed, 27 insertions(+), 23 deletions(-)
>
>diff --git a/BaseTools/Conf/build_rule.template
>b/BaseTools/Conf/build_rule.template
>index 030e74c35a65..db06d3a6b45a 100755
>--- a/BaseTools/Conf/build_rule.template
>+++ b/BaseTools/Conf/build_rule.template
>@@ -321,7 +321,7 @@
>         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
>
>
>-[Static-Library-File.USER_DEFINED]
>+[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
>     <InputFile>
>         *.lib
>
>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>b/BaseTools/Source/Python/AutoGen/AutoGen.py
>index e8e09dc8a366..32b5a5564827 100644
>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
>                     # the type of build module is USER_DEFINED.
>                     # All different DEPEX section tags would be copied into the As Built
>INF file
>                     # and there would be separate DEPEX section tags
>-                    if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
>+                    if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or
>self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
>                         if (Arch.upper() == self.Arch.upper()) and
>(ModuleType.upper() != TAB_ARCH_COMMON):
>                             DepexList.append({(Arch, ModuleType): DepexExpr})
>                     else:
>@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
>                             DepexList.append({(Arch, ModuleType): DepexExpr})
>
>         #the type of build module is USER_DEFINED.
>-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
>+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or
>self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
>             for Depex in DepexList:
>                 for key in Depex:
>                     DepexStr += '[Depex.%s.%s]\n' % key
>@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
>
>         for ModuleType in self.DepexList:
>             # Ignore empty [depex] section or [depex] section for
>SUP_MODULE_USER_DEFINED module
>-            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
>SUP_MODULE_USER_DEFINED:
>+            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
>SUP_MODULE_USER_DEFINED or ModuleType ==
>SUP_MODULE_HOST_APPLICATION:
>                 continue
>
>             Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType],
>ModuleType, True)
>diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
>b/BaseTools/Source/Python/AutoGen/GenC.py
>index b527295c0253..4cb776206e90 100644
>--- a/BaseTools/Source/Python/AutoGen/GenC.py
>+++ b/BaseTools/Source/Python/AutoGen/GenC.py
>@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
>     SUP_MODULE_SMM_CORE          :   ["PiDxe.h", "Library/BaseLib.h",
>"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
>     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h", "Library/BaseLib.h",
>"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
>     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h", "Library/BaseLib.h",
>"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
>-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
>"Library/DebugLib.h"]
>+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
>"Library/DebugLib.h"],
>+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile,
>"Library/DebugLib.h"]
> }
>
> ## Autogen internal worker macro to define DynamicEx PCD name includes
>both the TokenSpaceGuidName
>@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC,
>AutoGenH):
>         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
>
>ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODUL
>E_BASE].Replace(Dict))
>
>ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].R
>eplace(Dict))
>-        if Info.ModuleType not in [SUP_MODULE_BASE,
>SUP_MODULE_USER_DEFINED]:
>+        if Info.ModuleType not in [SUP_MODULE_BASE,
>SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>             if Lib.ModuleType in SUP_MODULE_SET_PEI:
>
>ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace
>(Dict))
>
>ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
>@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC,
>AutoGenH):
>     if Info.IsLibrary:
>         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
>     else:
>-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_USER_DEFINED]:
>+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>             AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
>         elif Info.ModuleType in SUP_MODULE_SET_PEI:
>             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
>@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
>AutoGenH):
>         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
>
>DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE
>_BASE].Replace(Dict))
>
>DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Re
>place(Dict))
>-        if Info.ModuleType not in [SUP_MODULE_BASE,
>SUP_MODULE_USER_DEFINED]:
>+        if Info.ModuleType not in [SUP_MODULE_BASE,
>SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>             if Lib.ModuleType in SUP_MODULE_SET_PEI:
>
>DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(
>Dict))
>
>DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
>@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
>AutoGenH):
>     if Info.IsLibrary:
>         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
>     else:
>-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_USER_DEFINED]:
>+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>             AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
>         elif Info.ModuleType in SUP_MODULE_SET_PEI:
>             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
>@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
>AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
>-    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_SEC]:
>+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
>         return
>     #
>     # Module Entry Points
>@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC,
>AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
>-    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE, SUP_MODULE_SEC]:
>+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE,
>SUP_MODULE_SEC]:
>         return
>     #
>     # Unload Image Handlers
>@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info,
>AutoGenC, AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
>-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE]:
>+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>         GuidType = TAB_GUID
>     else:
>         GuidType = "EFI_GUID"
>@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC,
>AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
>-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE]:
>+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>         GuidType = TAB_GUID
>     else:
>         GuidType = "EFI_GUID"
>@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC,
>AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
>-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE]:
>+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>         GuidType = TAB_GUID
>     else:
>         GuidType = "EFI_GUID"
>@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
>     # Add extern declarations to AutoGen.h if one or more Token Space GUIDs
>were found
>     if TokenSpaceList:
>         AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in
>this module\n\n")
>-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE]:
>+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>             GuidType = TAB_GUID
>         else:
>             GuidType = "EFI_GUID"
>diff --git a/BaseTools/Source/Python/Common/DataType.py
>b/BaseTools/Source/Python/Common/DataType.py
>index 83ec36c2350d..8ae1bd28fabf 100644
>--- a/BaseTools/Source/Python/Common/DataType.py
>+++ b/BaseTools/Source/Python/Common/DataType.py
>@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER =
>'DXE_SMM_DRIVER'
> SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
> SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
> SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
>+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
> SUP_MODULE_SMM_CORE = 'SMM_CORE'
> SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
> SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
>
> SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE,
>SUP_MODULE_DXE_DRIVER, \
>                    SUP_MODULE_DXE_RUNTIME_DRIVER,
>SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
>SUP_MODULE_UEFI_DRIVER, \
>-                   SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
>SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
>SUP_MODULE_MM_CORE_STANDALONE]
>+                   SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE,
>SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]
> SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
> SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE}
>
>diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
>b/BaseTools/Source/Python/GenFds/FdfParser.py
>index fb5fd85e0a82..9b04a76af8c5 100644
>--- a/BaseTools/Source/Python/GenFds/FdfParser.py
>+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
>@@ -3543,7 +3543,7 @@ class FdfParser:
>                 SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER,
>                 SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
>                 SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_UEFI_DRIVER,
>-                SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
>+                SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION,
>                 TAB_DEFAULT, SUP_MODULE_BASE,
>                 EDK_COMPONENT_TYPE_SECURITY_CORE,
>                 EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
>diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>index cd3b0f647793..ebb93b14c4ff 100644
>--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>@@ -25,6 +25,7 @@ from . import RuleComplexFile
> from CommonDataClass.FdfClass import FfsInfStatementClassObject
> from Common.MultipleWorkspace import MultipleWorkspace as mws
> from Common.DataType import SUP_MODULE_USER_DEFINED
>+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> from Common.StringUtils import *
> from Common.Misc import PathClass
> from Common.Misc import GuidStructureByteArrayToGuidString
>@@ -84,12 +85,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
>                 self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1],
>[]).append(File)
>
>             # Check if current INF module has DEPEX
>-            if '.depex' not in self.FinalTargetSuffixMap and
>self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
>+            if '.depex' not in self.FinalTargetSuffixMap and
>self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and
>self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
>                 and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
>                 ModuleType = self.InfModule.ModuleType
>                 PlatformDataBase =
>GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActiveP
>latform, self.CurrentArch, GenFdsGlobalVariable.TargetName,
>GenFdsGlobalVariable.ToolChainTag]
>
>-                if ModuleType != SUP_MODULE_USER_DEFINED:
>+                if ModuleType != SUP_MODULE_USER_DEFINED and ModuleType !=
>SUP_MODULE_HOST_APPLICATION:
>                     for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
>                         if LibraryClass.startswith("NULL") and
>PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
>                             self.InfModule.LibraryClasses[LibraryClass] =
>PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
>@@ -378,7 +379,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
>         #
>         # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED
>         #
>-        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
>SUP_MODULE_USER_DEFINED:
>+        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
>SUP_MODULE_USER_DEFINED and self.ModuleType !=
>SUP_MODULE_HOST_APPLICATION:
>             return EfiFile
>
>         #
>diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
>b/BaseTools/Source/Python/Workspace/InfBuildData.py
>index e66b7c983278..60970cd92836 100644
>--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
>@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
>                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex]
>section or no valid expression in [Depex] section for [%s] module" \
>                                 % self.ModuleType, File=self.MetaFile)
>
>-        if len(RecordList) != 0 and self.ModuleType ==
>SUP_MODULE_USER_DEFINED:
>+        if len(RecordList) != 0 and (self.ModuleType ==
>SUP_MODULE_USER_DEFINED or self.ModuleType ==
>SUP_MODULE_HOST_APPLICATION):
>             for Record in RecordList:
>                 if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_DRIVER,
>SUP_MODULE_DXE_SMM_DRIVER]:
>                     EdkLogger.error('build', FORMAT_INVALID,
>diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>index 0cc83110efd5..41ae684d3ee9 100644
>--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>@@ -8,6 +8,7 @@
> from __future__ import absolute_import
> from collections import OrderedDict, defaultdict
> from Common.DataType import SUP_MODULE_USER_DEFINED
>+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> from .BuildClassObject import LibraryClassObject
> import Common.GlobalData as GlobalData
> from Workspace.BuildClassObject import StructurePcd
>@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform,
>BuildDatabase, Arch, Target, Toolcha
>     # If a module has a MODULE_TYPE of USER_DEFINED,
>     # do not link in NULL library class instances from the global [LibraryClasses.*]
>sections.
>     #
>-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
>+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and
>Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
>         for LibraryClass in Platform.LibraryClasses.GetKeys():
>             if LibraryClass.startswith("NULL") and
>Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
>                 Module.LibraryClasses[LibraryClass] =
>Platform.LibraryClasses[LibraryClass, Module.ModuleType]
>@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform,
>BuildDatabase, Arch, Target, Toolcha
>
>LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName,
>[ModuleType]))
>                 elif LibraryModule.LibraryClass is None \
>                      or len(LibraryModule.LibraryClass) == 0 \
>-                     or (ModuleType != SUP_MODULE_USER_DEFINED
>+                     or (ModuleType != SUP_MODULE_USER_DEFINED and
>ModuleType != SUP_MODULE_HOST_APPLICATION
>                          and ModuleType not in
>LibraryModule.LibraryClass[0].SupModList):
>                     # only USER_DEFINED can link against any library instance despite of
>its SupModList
>                     if FileName:
>--
>2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
  2019-07-01 10:17 ` Liming Gao
@ 2019-07-03  8:41   ` Xiaoyu Lu
  0 siblings, 0 replies; 9+ messages in thread
From: Xiaoyu Lu @ 2019-07-03  8:41 UTC (permalink / raw)
  To: Gao, Liming, devel@edk2.groups.io; +Cc: Feng, Bob C, Yao, Jiewen

Liming,

I filed two BZ, One for this, and another one for INF/BUILD spec.
https://bugzilla.tianocore.org/show_bug.cgi?id=1956
https://bugzilla.tianocore.org/show_bug.cgi?id=1952

Thanks,
Xiaoyu

> -----Original Message-----
> From: Gao, Liming
> Sent: Monday, July 1, 2019 6:18 PM
> To: Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
> 
> Xiaoyu:
>   This is a new module type. Please submit BZ for INF spec update first.
> 
>   And, also submit BZ for code change. In BZ, please specify this type usage
> model.
> 
> Thanks
> Liming
> >-----Original Message-----
> >From: Lu, XiaoyuX
> >Sent: Monday, July 01, 2019 6:13 PM
> >To: devel@edk2.groups.io
> >Cc: Lu, XiaoyuX <xiaoyux.lu@intel.com>; Feng, Bob C
> <bob.c.feng@intel.com>;
> >Gao, Liming <liming.gao@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> >Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
> >
> >From: Jiewen Yao <jiewen.yao@intel.com>
> >
> >It can be used to indicate a module can be build to run
> >as OS application and run in OS environment.
> >
> >Cc: Bob Feng <bob.c.feng@intel.com>
> >Cc: Liming Gao <liming.gao@intel.com>
> >Cc: Jiewen Yao <jiewen.yao@intel.com>
> >Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
> >---
> > BaseTools/Conf/build_rule.template            |  2 +-
> > BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
> > BaseTools/Source/Python/AutoGen/GenC.py       | 23 ++++++++++---------
> > BaseTools/Source/Python/Common/DataType.py    |  3 ++-
> > BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
> > .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
> > .../Source/Python/Workspace/InfBuildData.py   |  2 +-
> > .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
> > 8 files changed, 27 insertions(+), 23 deletions(-)
> >
> >diff --git a/BaseTools/Conf/build_rule.template
> >b/BaseTools/Conf/build_rule.template
> >index 030e74c35a65..db06d3a6b45a 100755
> >--- a/BaseTools/Conf/build_rule.template
> >+++ b/BaseTools/Conf/build_rule.template
> >@@ -321,7 +321,7 @@
> >         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
> >
> >
> >-[Static-Library-File.USER_DEFINED]
> >+[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
> >     <InputFile>
> >         *.lib
> >
> >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> >b/BaseTools/Source/Python/AutoGen/AutoGen.py
> >index e8e09dc8a366..32b5a5564827 100644
> >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> >@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
> >                     # the type of build module is USER_DEFINED.
> >                     # All different DEPEX section tags would be copied into the As
> Built
> >INF file
> >                     # and there would be separate DEPEX section tags
> >-                    if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
> >+                    if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or
> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> >                         if (Arch.upper() == self.Arch.upper()) and
> >(ModuleType.upper() != TAB_ARCH_COMMON):
> >                             DepexList.append({(Arch, ModuleType): DepexExpr})
> >                     else:
> >@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
> >                             DepexList.append({(Arch, ModuleType): DepexExpr})
> >
> >         #the type of build module is USER_DEFINED.
> >-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
> >+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or
> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> >             for Depex in DepexList:
> >                 for key in Depex:
> >                     DepexStr += '[Depex.%s.%s]\n' % key
> >@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
> >
> >         for ModuleType in self.DepexList:
> >             # Ignore empty [depex] section or [depex] section for
> >SUP_MODULE_USER_DEFINED module
> >-            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
> >SUP_MODULE_USER_DEFINED:
> >+            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
> >SUP_MODULE_USER_DEFINED or ModuleType ==
> >SUP_MODULE_HOST_APPLICATION:
> >                 continue
> >
> >             Dpx =
> GenDepex.DependencyExpression(self.DepexList[ModuleType],
> >ModuleType, True)
> >diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
> >b/BaseTools/Source/Python/AutoGen/GenC.py
> >index b527295c0253..4cb776206e90 100644
> >--- a/BaseTools/Source/Python/AutoGen/GenC.py
> >+++ b/BaseTools/Source/Python/AutoGen/GenC.py
> >@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
> >     SUP_MODULE_SMM_CORE          :   ["PiDxe.h", "Library/BaseLib.h",
> >"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
> >     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h", "Library/BaseLib.h",
> >"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
> >     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h",
> "Library/BaseLib.h",
> >"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
> >-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> >"Library/DebugLib.h"]
> >+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> >"Library/DebugLib.h"],
> >+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile,
> >"Library/DebugLib.h"]
> > }
> >
> > ## Autogen internal worker macro to define DynamicEx PCD name includes
> >both the TokenSpaceGuidName
> >@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info,
> AutoGenC,
> >AutoGenH):
> >         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
> >
> >ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MOD
> UL
> >E_BASE].Replace(Dict))
> >
> >ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE]
> .R
> >eplace(Dict))
> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> >SUP_MODULE_USER_DEFINED]:
> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> >
> >ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Repla
> ce
> >(Dict))
> >
> >ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
> >@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info,
> AutoGenC,
> >AutoGenH):
> >     if Info.IsLibrary:
> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
> >     else:
> >-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >SUP_MODULE_USER_DEFINED]:
> >+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >
> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> >@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
> >AutoGenH):
> >         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
> >
> >DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODU
> LE
> >_BASE].Replace(Dict))
> >
> >DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].
> Re
> >place(Dict))
> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> >SUP_MODULE_USER_DEFINED]:
> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> >
> >DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replac
> e(
> >Dict))
> >
> >DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
> >@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
> >AutoGenH):
> >     if Info.IsLibrary:
> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
> >     else:
> >-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >SUP_MODULE_USER_DEFINED]:
> >+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >
> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> >@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
> >AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header file
> > #
> > def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
> >-    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_SEC]:
> >+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
> >         return
> >     #
> >     # Module Entry Points
> >@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info,
> AutoGenC,
> >AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header file
> > #
> > def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
> >-    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE, SUP_MODULE_SEC]:
> >+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE,
> >SUP_MODULE_SEC]:
> >         return
> >     #
> >     # Unload Image Handlers
> >@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info,
> >AutoGenC, AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header file
> > #
> > def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE]:
> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >         GuidType = TAB_GUID
> >     else:
> >         GuidType = "EFI_GUID"
> >@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC,
> >AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header file
> > #
> > def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE]:
> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >         GuidType = TAB_GUID
> >     else:
> >         GuidType = "EFI_GUID"
> >@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info,
> AutoGenC,
> >AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header file
> > #
> > def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE]:
> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >         GuidType = TAB_GUID
> >     else:
> >         GuidType = "EFI_GUID"
> >@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
> >     # Add extern declarations to AutoGen.h if one or more Token Space
> GUIDs
> >were found
> >     if TokenSpaceList:
> >         AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in
> >this module\n\n")
> >-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE]:
> >+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >             GuidType = TAB_GUID
> >         else:
> >             GuidType = "EFI_GUID"
> >diff --git a/BaseTools/Source/Python/Common/DataType.py
> >b/BaseTools/Source/Python/Common/DataType.py
> >index 83ec36c2350d..8ae1bd28fabf 100644
> >--- a/BaseTools/Source/Python/Common/DataType.py
> >+++ b/BaseTools/Source/Python/Common/DataType.py
> >@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER =
> >'DXE_SMM_DRIVER'
> > SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
> > SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
> > SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
> >+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
> > SUP_MODULE_SMM_CORE = 'SMM_CORE'
> > SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
> > SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
> >
> > SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE,
> >SUP_MODULE_DXE_DRIVER, \
> >                    SUP_MODULE_DXE_RUNTIME_DRIVER,
> >SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
> >SUP_MODULE_UEFI_DRIVER, \
> >-                   SUP_MODULE_UEFI_APPLICATION,
> SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
> >SUP_MODULE_MM_CORE_STANDALONE]
> >+                   SUP_MODULE_UEFI_APPLICATION,
> SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE,
> >SUP_MODULE_MM_STANDALONE,
> SUP_MODULE_MM_CORE_STANDALONE]
> > SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
> > SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE}
> >
> >diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> >b/BaseTools/Source/Python/GenFds/FdfParser.py
> >index fb5fd85e0a82..9b04a76af8c5 100644
> >--- a/BaseTools/Source/Python/GenFds/FdfParser.py
> >+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> >@@ -3543,7 +3543,7 @@ class FdfParser:
> >                 SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER,
> >                 SUP_MODULE_DXE_SAL_DRIVER,
> SUP_MODULE_DXE_SMM_DRIVER,
> >                 SUP_MODULE_DXE_RUNTIME_DRIVER,
> SUP_MODULE_UEFI_DRIVER,
> >-                SUP_MODULE_UEFI_APPLICATION,
> SUP_MODULE_USER_DEFINED,
> >+                SUP_MODULE_UEFI_APPLICATION,
> SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION,
> >                 TAB_DEFAULT, SUP_MODULE_BASE,
> >                 EDK_COMPONENT_TYPE_SECURITY_CORE,
> >                 EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
> >diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >index cd3b0f647793..ebb93b14c4ff 100644
> >--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >@@ -25,6 +25,7 @@ from . import RuleComplexFile
> > from CommonDataClass.FdfClass import FfsInfStatementClassObject
> > from Common.MultipleWorkspace import MultipleWorkspace as mws
> > from Common.DataType import SUP_MODULE_USER_DEFINED
> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> > from Common.StringUtils import *
> > from Common.Misc import PathClass
> > from Common.Misc import GuidStructureByteArrayToGuidString
> >@@ -84,12 +85,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
> >                 self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1],
> >[]).append(File)
> >
> >             # Check if current INF module has DEPEX
> >-            if '.depex' not in self.FinalTargetSuffixMap and
> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
> >+            if '.depex' not in self.FinalTargetSuffixMap and
> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and
> >self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
> >                 and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
> >                 ModuleType = self.InfModule.ModuleType
> >                 PlatformDataBase =
> >GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.Activ
> eP
> >latform, self.CurrentArch, GenFdsGlobalVariable.TargetName,
> >GenFdsGlobalVariable.ToolChainTag]
> >
> >-                if ModuleType != SUP_MODULE_USER_DEFINED:
> >+                if ModuleType != SUP_MODULE_USER_DEFINED and
> ModuleType !=
> >SUP_MODULE_HOST_APPLICATION:
> >                     for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
> >                         if LibraryClass.startswith("NULL") and
> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
> >                             self.InfModule.LibraryClasses[LibraryClass] =
> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
> >@@ -378,7 +379,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
> >         #
> >         # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED
> >         #
> >-        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
> >SUP_MODULE_USER_DEFINED:
> >+        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
> >SUP_MODULE_USER_DEFINED and self.ModuleType !=
> >SUP_MODULE_HOST_APPLICATION:
> >             return EfiFile
> >
> >         #
> >diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
> >b/BaseTools/Source/Python/Workspace/InfBuildData.py
> >index e66b7c983278..60970cd92836 100644
> >--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
> >+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
> >@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
> >                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex]
> >section or no valid expression in [Depex] section for [%s] module" \
> >                                 % self.ModuleType, File=self.MetaFile)
> >
> >-        if len(RecordList) != 0 and self.ModuleType ==
> >SUP_MODULE_USER_DEFINED:
> >+        if len(RecordList) != 0 and (self.ModuleType ==
> >SUP_MODULE_USER_DEFINED or self.ModuleType ==
> >SUP_MODULE_HOST_APPLICATION):
> >             for Record in RecordList:
> >                 if Record[4] not in [SUP_MODULE_PEIM,
> SUP_MODULE_DXE_DRIVER,
> >SUP_MODULE_DXE_SMM_DRIVER]:
> >                     EdkLogger.error('build', FORMAT_INVALID,
> >diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >index 0cc83110efd5..41ae684d3ee9 100644
> >--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >@@ -8,6 +8,7 @@
> > from __future__ import absolute_import
> > from collections import OrderedDict, defaultdict
> > from Common.DataType import SUP_MODULE_USER_DEFINED
> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> > from .BuildClassObject import LibraryClassObject
> > import Common.GlobalData as GlobalData
> > from Workspace.BuildClassObject import StructurePcd
> >@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform,
> >BuildDatabase, Arch, Target, Toolcha
> >     # If a module has a MODULE_TYPE of USER_DEFINED,
> >     # do not link in NULL library class instances from the global
> [LibraryClasses.*]
> >sections.
> >     #
> >-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
> >+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and
> >Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
> >         for LibraryClass in Platform.LibraryClasses.GetKeys():
> >             if LibraryClass.startswith("NULL") and
> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
> >                 Module.LibraryClasses[LibraryClass] =
> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]
> >@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform,
> >BuildDatabase, Arch, Target, Toolcha
> >
> >LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName,
> >[ModuleType]))
> >                 elif LibraryModule.LibraryClass is None \
> >                      or len(LibraryModule.LibraryClass) == 0 \
> >-                     or (ModuleType != SUP_MODULE_USER_DEFINED
> >+                     or (ModuleType != SUP_MODULE_USER_DEFINED and
> >ModuleType != SUP_MODULE_HOST_APPLICATION
> >                          and ModuleType not in
> >LibraryModule.LibraryClass[0].SupModList):
> >                     # only USER_DEFINED can link against any library instance despite
> of
> >its SupModList
> >                     if FileName:
> >--
> >2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
  2019-07-01 10:13 [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type Xiaoyu Lu
  2019-07-01 10:17 ` Liming Gao
@ 2019-07-08  0:43 ` Liming Gao
  2019-07-08  0:53   ` Yao, Jiewen
  1 sibling, 1 reply; 9+ messages in thread
From: Liming Gao @ 2019-07-08  0:43 UTC (permalink / raw)
  To: Lu, XiaoyuX, devel@edk2.groups.io; +Cc: Feng, Bob C, Yao, Jiewen

Xiaoyu:
  I want to confirm what output for HOST_APPLICATION module will be used. Xxx.dll or xxx.efi? 

Thanks
Liming
>-----Original Message-----
>From: Lu, XiaoyuX
>Sent: Monday, July 01, 2019 6:13 PM
>To: devel@edk2.groups.io
>Cc: Lu, XiaoyuX <xiaoyux.lu@intel.com>; Feng, Bob C <bob.c.feng@intel.com>;
>Gao, Liming <liming.gao@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
>Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
>
>From: Jiewen Yao <jiewen.yao@intel.com>
>
>It can be used to indicate a module can be build to run
>as OS application and run in OS environment.
>
>Cc: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Jiewen Yao <jiewen.yao@intel.com>
>Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
>---
> BaseTools/Conf/build_rule.template            |  2 +-
> BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
> BaseTools/Source/Python/AutoGen/GenC.py       | 23 ++++++++++---------
> BaseTools/Source/Python/Common/DataType.py    |  3 ++-
> BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
> .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
> .../Source/Python/Workspace/InfBuildData.py   |  2 +-
> .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
> 8 files changed, 27 insertions(+), 23 deletions(-)
>
>diff --git a/BaseTools/Conf/build_rule.template
>b/BaseTools/Conf/build_rule.template
>index 030e74c35a65..db06d3a6b45a 100755
>--- a/BaseTools/Conf/build_rule.template
>+++ b/BaseTools/Conf/build_rule.template
>@@ -321,7 +321,7 @@
>         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
>
>
>-[Static-Library-File.USER_DEFINED]
>+[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
>     <InputFile>
>         *.lib
>
>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>b/BaseTools/Source/Python/AutoGen/AutoGen.py
>index e8e09dc8a366..32b5a5564827 100644
>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
>                     # the type of build module is USER_DEFINED.
>                     # All different DEPEX section tags would be copied into the As Built
>INF file
>                     # and there would be separate DEPEX section tags
>-                    if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
>+                    if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or
>self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
>                         if (Arch.upper() == self.Arch.upper()) and
>(ModuleType.upper() != TAB_ARCH_COMMON):
>                             DepexList.append({(Arch, ModuleType): DepexExpr})
>                     else:
>@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
>                             DepexList.append({(Arch, ModuleType): DepexExpr})
>
>         #the type of build module is USER_DEFINED.
>-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
>+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or
>self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
>             for Depex in DepexList:
>                 for key in Depex:
>                     DepexStr += '[Depex.%s.%s]\n' % key
>@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
>
>         for ModuleType in self.DepexList:
>             # Ignore empty [depex] section or [depex] section for
>SUP_MODULE_USER_DEFINED module
>-            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
>SUP_MODULE_USER_DEFINED:
>+            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
>SUP_MODULE_USER_DEFINED or ModuleType ==
>SUP_MODULE_HOST_APPLICATION:
>                 continue
>
>             Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType],
>ModuleType, True)
>diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
>b/BaseTools/Source/Python/AutoGen/GenC.py
>index b527295c0253..4cb776206e90 100644
>--- a/BaseTools/Source/Python/AutoGen/GenC.py
>+++ b/BaseTools/Source/Python/AutoGen/GenC.py
>@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
>     SUP_MODULE_SMM_CORE          :   ["PiDxe.h", "Library/BaseLib.h",
>"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
>     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h", "Library/BaseLib.h",
>"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
>     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h", "Library/BaseLib.h",
>"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
>-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
>"Library/DebugLib.h"]
>+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
>"Library/DebugLib.h"],
>+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile,
>"Library/DebugLib.h"]
> }
>
> ## Autogen internal worker macro to define DynamicEx PCD name includes
>both the TokenSpaceGuidName
>@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC,
>AutoGenH):
>         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
>
>ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODUL
>E_BASE].Replace(Dict))
>
>ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].R
>eplace(Dict))
>-        if Info.ModuleType not in [SUP_MODULE_BASE,
>SUP_MODULE_USER_DEFINED]:
>+        if Info.ModuleType not in [SUP_MODULE_BASE,
>SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>             if Lib.ModuleType in SUP_MODULE_SET_PEI:
>
>ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace
>(Dict))
>
>ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
>@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC,
>AutoGenH):
>     if Info.IsLibrary:
>         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
>     else:
>-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_USER_DEFINED]:
>+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>             AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
>         elif Info.ModuleType in SUP_MODULE_SET_PEI:
>             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
>@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
>AutoGenH):
>         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
>
>DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE
>_BASE].Replace(Dict))
>
>DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Re
>place(Dict))
>-        if Info.ModuleType not in [SUP_MODULE_BASE,
>SUP_MODULE_USER_DEFINED]:
>+        if Info.ModuleType not in [SUP_MODULE_BASE,
>SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>             if Lib.ModuleType in SUP_MODULE_SET_PEI:
>
>DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(
>Dict))
>
>DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
>@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
>AutoGenH):
>     if Info.IsLibrary:
>         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
>     else:
>-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_USER_DEFINED]:
>+        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>             AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
>         elif Info.ModuleType in SUP_MODULE_SET_PEI:
>             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
>@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC,
>AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
>-    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_SEC]:
>+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
>         return
>     #
>     # Module Entry Points
>@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC,
>AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
>-    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE, SUP_MODULE_SEC]:
>+    if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE,
>SUP_MODULE_SEC]:
>         return
>     #
>     # Unload Image Handlers
>@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info,
>AutoGenC, AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
>-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE]:
>+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>         GuidType = TAB_GUID
>     else:
>         GuidType = "EFI_GUID"
>@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC,
>AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
>-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE]:
>+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>         GuidType = TAB_GUID
>     else:
>         GuidType = "EFI_GUID"
>@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC,
>AutoGenH):
> #   @param      AutoGenH    The TemplateString object for header file
> #
> def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
>-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE]:
>+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>         GuidType = TAB_GUID
>     else:
>         GuidType = "EFI_GUID"
>@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
>     # Add extern declarations to AutoGen.h if one or more Token Space GUIDs
>were found
>     if TokenSpaceList:
>         AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in
>this module\n\n")
>-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_BASE]:
>+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>             GuidType = TAB_GUID
>         else:
>             GuidType = "EFI_GUID"
>diff --git a/BaseTools/Source/Python/Common/DataType.py
>b/BaseTools/Source/Python/Common/DataType.py
>index 83ec36c2350d..8ae1bd28fabf 100644
>--- a/BaseTools/Source/Python/Common/DataType.py
>+++ b/BaseTools/Source/Python/Common/DataType.py
>@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER =
>'DXE_SMM_DRIVER'
> SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
> SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
> SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
>+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
> SUP_MODULE_SMM_CORE = 'SMM_CORE'
> SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
> SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
>
> SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC,
>SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE,
>SUP_MODULE_DXE_DRIVER, \
>                    SUP_MODULE_DXE_RUNTIME_DRIVER,
>SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
>SUP_MODULE_UEFI_DRIVER, \
>-                   SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
>SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
>SUP_MODULE_MM_CORE_STANDALONE]
>+                   SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE,
>SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE]
> SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
> SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE}
>
>diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
>b/BaseTools/Source/Python/GenFds/FdfParser.py
>index fb5fd85e0a82..9b04a76af8c5 100644
>--- a/BaseTools/Source/Python/GenFds/FdfParser.py
>+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
>@@ -3543,7 +3543,7 @@ class FdfParser:
>                 SUP_MODULE_DXE_CORE, SUP_MODULE_DXE_DRIVER,
>                 SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
>                 SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_UEFI_DRIVER,
>-                SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
>+                SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED,
>SUP_MODULE_HOST_APPLICATION,
>                 TAB_DEFAULT, SUP_MODULE_BASE,
>                 EDK_COMPONENT_TYPE_SECURITY_CORE,
>                 EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
>diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>index cd3b0f647793..ebb93b14c4ff 100644
>--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>@@ -25,6 +25,7 @@ from . import RuleComplexFile
> from CommonDataClass.FdfClass import FfsInfStatementClassObject
> from Common.MultipleWorkspace import MultipleWorkspace as mws
> from Common.DataType import SUP_MODULE_USER_DEFINED
>+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> from Common.StringUtils import *
> from Common.Misc import PathClass
> from Common.Misc import GuidStructureByteArrayToGuidString
>@@ -84,12 +85,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
>                 self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1],
>[]).append(File)
>
>             # Check if current INF module has DEPEX
>-            if '.depex' not in self.FinalTargetSuffixMap and
>self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
>+            if '.depex' not in self.FinalTargetSuffixMap and
>self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and
>self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
>                 and not self.InfModule.DxsFile and not self.InfModule.LibraryClass:
>                 ModuleType = self.InfModule.ModuleType
>                 PlatformDataBase =
>GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActiveP
>latform, self.CurrentArch, GenFdsGlobalVariable.TargetName,
>GenFdsGlobalVariable.ToolChainTag]
>
>-                if ModuleType != SUP_MODULE_USER_DEFINED:
>+                if ModuleType != SUP_MODULE_USER_DEFINED and ModuleType !=
>SUP_MODULE_HOST_APPLICATION:
>                     for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
>                         if LibraryClass.startswith("NULL") and
>PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
>                             self.InfModule.LibraryClasses[LibraryClass] =
>PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
>@@ -378,7 +379,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
>         #
>         # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED
>         #
>-        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
>SUP_MODULE_USER_DEFINED:
>+        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
>SUP_MODULE_USER_DEFINED and self.ModuleType !=
>SUP_MODULE_HOST_APPLICATION:
>             return EfiFile
>
>         #
>diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
>b/BaseTools/Source/Python/Workspace/InfBuildData.py
>index e66b7c983278..60970cd92836 100644
>--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
>+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
>@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
>                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [Depex]
>section or no valid expression in [Depex] section for [%s] module" \
>                                 % self.ModuleType, File=self.MetaFile)
>
>-        if len(RecordList) != 0 and self.ModuleType ==
>SUP_MODULE_USER_DEFINED:
>+        if len(RecordList) != 0 and (self.ModuleType ==
>SUP_MODULE_USER_DEFINED or self.ModuleType ==
>SUP_MODULE_HOST_APPLICATION):
>             for Record in RecordList:
>                 if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_DRIVER,
>SUP_MODULE_DXE_SMM_DRIVER]:
>                     EdkLogger.error('build', FORMAT_INVALID,
>diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>index 0cc83110efd5..41ae684d3ee9 100644
>--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>@@ -8,6 +8,7 @@
> from __future__ import absolute_import
> from collections import OrderedDict, defaultdict
> from Common.DataType import SUP_MODULE_USER_DEFINED
>+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> from .BuildClassObject import LibraryClassObject
> import Common.GlobalData as GlobalData
> from Workspace.BuildClassObject import StructurePcd
>@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform,
>BuildDatabase, Arch, Target, Toolcha
>     # If a module has a MODULE_TYPE of USER_DEFINED,
>     # do not link in NULL library class instances from the global [LibraryClasses.*]
>sections.
>     #
>-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
>+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and
>Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
>         for LibraryClass in Platform.LibraryClasses.GetKeys():
>             if LibraryClass.startswith("NULL") and
>Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
>                 Module.LibraryClasses[LibraryClass] =
>Platform.LibraryClasses[LibraryClass, Module.ModuleType]
>@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform,
>BuildDatabase, Arch, Target, Toolcha
>
>LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName,
>[ModuleType]))
>                 elif LibraryModule.LibraryClass is None \
>                      or len(LibraryModule.LibraryClass) == 0 \
>-                     or (ModuleType != SUP_MODULE_USER_DEFINED
>+                     or (ModuleType != SUP_MODULE_USER_DEFINED and
>ModuleType != SUP_MODULE_HOST_APPLICATION
>                          and ModuleType not in
>LibraryModule.LibraryClass[0].SupModList):
>                     # only USER_DEFINED can link against any library instance despite of
>its SupModList
>                     if FileName:
>--
>2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
  2019-07-08  0:43 ` Liming Gao
@ 2019-07-08  0:53   ` Yao, Jiewen
  2019-07-08  1:14     ` Liming Gao
  0 siblings, 1 reply; 9+ messages in thread
From: Yao, Jiewen @ 2019-07-08  0:53 UTC (permalink / raw)
  To: Gao, Liming, Lu, XiaoyuX, devel@edk2.groups.io; +Cc: Feng, Bob C

Currently, it is xxx.efi.

Thank you
Yao Jiewen

> -----Original Message-----
> From: Gao, Liming
> Sent: Monday, July 8, 2019 8:43 AM
> To: Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> type.
> 
> Xiaoyu:
>   I want to confirm what output for HOST_APPLICATION module will be
> used. Xxx.dll or xxx.efi?
> 
> Thanks
> Liming
> >-----Original Message-----
> >From: Lu, XiaoyuX
> >Sent: Monday, July 01, 2019 6:13 PM
> >To: devel@edk2.groups.io
> >Cc: Lu, XiaoyuX <xiaoyux.lu@intel.com>; Feng, Bob C
> <bob.c.feng@intel.com>;
> >Gao, Liming <liming.gao@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>
> >Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
> >
> >From: Jiewen Yao <jiewen.yao@intel.com>
> >
> >It can be used to indicate a module can be build to run
> >as OS application and run in OS environment.
> >
> >Cc: Bob Feng <bob.c.feng@intel.com>
> >Cc: Liming Gao <liming.gao@intel.com>
> >Cc: Jiewen Yao <jiewen.yao@intel.com>
> >Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
> >---
> > BaseTools/Conf/build_rule.template            |  2 +-
> > BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
> > BaseTools/Source/Python/AutoGen/GenC.py       | 23
> ++++++++++---------
> > BaseTools/Source/Python/Common/DataType.py    |  3 ++-
> > BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
> > .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
> > .../Source/Python/Workspace/InfBuildData.py   |  2 +-
> > .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
> > 8 files changed, 27 insertions(+), 23 deletions(-)
> >
> >diff --git a/BaseTools/Conf/build_rule.template
> >b/BaseTools/Conf/build_rule.template
> >index 030e74c35a65..db06d3a6b45a 100755
> >--- a/BaseTools/Conf/build_rule.template
> >+++ b/BaseTools/Conf/build_rule.template
> >@@ -321,7 +321,7 @@
> >         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
> >
> >
> >-[Static-Library-File.USER_DEFINED]
> >+[Static-Library-File.USER_DEFINED,
> Static-Library-File.HOST_APPLICATION]
> >     <InputFile>
> >         *.lib
> >
> >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> >b/BaseTools/Source/Python/AutoGen/AutoGen.py
> >index e8e09dc8a366..32b5a5564827 100644
> >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> >@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
> >                     # the type of build module is USER_DEFINED.
> >                     # All different DEPEX section tags would be
> copied into the As Built
> >INF file
> >                     # and there would be separate DEPEX section
> tags
> >-                    if self.ModuleType.upper() ==
> SUP_MODULE_USER_DEFINED:
> >+                    if self.ModuleType.upper() ==
> SUP_MODULE_USER_DEFINED or
> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> >                         if (Arch.upper() == self.Arch.upper()) and
> >(ModuleType.upper() != TAB_ARCH_COMMON):
> >                             DepexList.append({(Arch, ModuleType):
> DepexExpr})
> >                     else:
> >@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
> >                             DepexList.append({(Arch, ModuleType):
> DepexExpr})
> >
> >         #the type of build module is USER_DEFINED.
> >-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
> >+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or
> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> >             for Depex in DepexList:
> >                 for key in Depex:
> >                     DepexStr += '[Depex.%s.%s]\n' % key
> >@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
> >
> >         for ModuleType in self.DepexList:
> >             # Ignore empty [depex] section or [depex] section for
> >SUP_MODULE_USER_DEFINED module
> >-            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
> >SUP_MODULE_USER_DEFINED:
> >+            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
> >SUP_MODULE_USER_DEFINED or ModuleType ==
> >SUP_MODULE_HOST_APPLICATION:
> >                 continue
> >
> >             Dpx =
> GenDepex.DependencyExpression(self.DepexList[ModuleType],
> >ModuleType, True)
> >diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
> >b/BaseTools/Source/Python/AutoGen/GenC.py
> >index b527295c0253..4cb776206e90 100644
> >--- a/BaseTools/Source/Python/AutoGen/GenC.py
> >+++ b/BaseTools/Source/Python/AutoGen/GenC.py
> >@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
> >     SUP_MODULE_SMM_CORE          :   ["PiDxe.h",
> "Library/BaseLib.h",
> >"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
> >     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h",
> "Library/BaseLib.h",
> >"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
> >     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h",
> "Library/BaseLib.h",
> >"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
> >-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> >"Library/DebugLib.h"]
> >+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> >"Library/DebugLib.h"],
> >+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile,
> >"Library/DebugLib.h"]
> > }
> >
> > ## Autogen internal worker macro to define DynamicEx PCD name includes
> >both the TokenSpaceGuidName
> >@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info,
> AutoGenC,
> >AutoGenH):
> >         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
> >
> >ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODU
> L
> >E_BASE].Replace(Dict))
> >
> >ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE]
> .R
> >eplace(Dict))
> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> >SUP_MODULE_USER_DEFINED]:
> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> >
> >ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Repla
> ce
> >(Dict))
> >
> >ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
> >@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info,
> AutoGenC,
> >AutoGenH):
> >     if Info.IsLibrary:
> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
> Dict)
> >     else:
> >-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >SUP_MODULE_USER_DEFINED]:
> >+        if Info.ModuleType in [SUP_MODULE_BASE,
> SUP_MODULE_SEC,
> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >
> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> >@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info,
> AutoGenC,
> >AutoGenH):
> >         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
> >
> >DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODUL
> E
> >_BASE].Replace(Dict))
> >
> >DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].
> Re
> >place(Dict))
> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> >SUP_MODULE_USER_DEFINED]:
> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> >
> >DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replac
> e(
> >Dict))
> >
> >DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
> >@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info,
> AutoGenC,
> >AutoGenH):
> >     if Info.IsLibrary:
> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
> Dict)
> >     else:
> >-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >SUP_MODULE_USER_DEFINED]:
> >+        if Info.ModuleType in [SUP_MODULE_BASE,
> SUP_MODULE_SEC,
> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >
> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> >@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info,
> AutoGenC,
> >AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header
> file
> > #
> > def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
> >-    if Info.IsLibrary or Info.ModuleType in
> [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_SEC]:
> >+    if Info.IsLibrary or Info.ModuleType in
> [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
> >         return
> >     #
> >     # Module Entry Points
> >@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info,
> AutoGenC,
> >AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header
> file
> > #
> > def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
> >-    if Info.IsLibrary or Info.ModuleType in
> [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE, SUP_MODULE_SEC]:
> >+    if Info.IsLibrary or Info.ModuleType in
> [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE,
> >SUP_MODULE_SEC]:
> >         return
> >     #
> >     # Unload Image Handlers
> >@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info,
> >AutoGenC, AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header
> file
> > #
> > def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE]:
> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >         GuidType = TAB_GUID
> >     else:
> >         GuidType = "EFI_GUID"
> >@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC,
> >AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header
> file
> > #
> > def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE]:
> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >         GuidType = TAB_GUID
> >     else:
> >         GuidType = "EFI_GUID"
> >@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info,
> AutoGenC,
> >AutoGenH):
> > #   @param      AutoGenH    The TemplateString object for header
> file
> > #
> > def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE]:
> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >         GuidType = TAB_GUID
> >     else:
> >         GuidType = "EFI_GUID"
> >@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
> >     # Add extern declarations to AutoGen.h if one or more Token Space
> GUIDs
> >were found
> >     if TokenSpaceList:
> >         AutoGenH.Append("\n// Definition of PCD Token Space GUIDs
> used in
> >this module\n\n")
> >-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_BASE]:
> >+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >             GuidType = TAB_GUID
> >         else:
> >             GuidType = "EFI_GUID"
> >diff --git a/BaseTools/Source/Python/Common/DataType.py
> >b/BaseTools/Source/Python/Common/DataType.py
> >index 83ec36c2350d..8ae1bd28fabf 100644
> >--- a/BaseTools/Source/Python/Common/DataType.py
> >+++ b/BaseTools/Source/Python/Common/DataType.py
> >@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER =
> >'DXE_SMM_DRIVER'
> > SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
> > SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
> > SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
> >+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
> > SUP_MODULE_SMM_CORE = 'SMM_CORE'
> > SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
> > SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
> >
> > SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,
> SUP_MODULE_DXE_CORE,
> >SUP_MODULE_DXE_DRIVER, \
> >                    SUP_MODULE_DXE_RUNTIME_DRIVER,
> >SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
> >SUP_MODULE_UEFI_DRIVER, \
> >-                   SUP_MODULE_UEFI_APPLICATION,
> SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
> >SUP_MODULE_MM_CORE_STANDALONE]
> >+                   SUP_MODULE_UEFI_APPLICATION,
> SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE,
> >SUP_MODULE_MM_STANDALONE,
> SUP_MODULE_MM_CORE_STANDALONE]
> > SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
> > SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM,
> SUP_MODULE_PEI_CORE}
> >
> >diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> >b/BaseTools/Source/Python/GenFds/FdfParser.py
> >index fb5fd85e0a82..9b04a76af8c5 100644
> >--- a/BaseTools/Source/Python/GenFds/FdfParser.py
> >+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> >@@ -3543,7 +3543,7 @@ class FdfParser:
> >                 SUP_MODULE_DXE_CORE,
> SUP_MODULE_DXE_DRIVER,
> >                 SUP_MODULE_DXE_SAL_DRIVER,
> SUP_MODULE_DXE_SMM_DRIVER,
> >                 SUP_MODULE_DXE_RUNTIME_DRIVER,
> SUP_MODULE_UEFI_DRIVER,
> >-                SUP_MODULE_UEFI_APPLICATION,
> SUP_MODULE_USER_DEFINED,
> >+                SUP_MODULE_UEFI_APPLICATION,
> SUP_MODULE_USER_DEFINED,
> >SUP_MODULE_HOST_APPLICATION,
> >                 TAB_DEFAULT, SUP_MODULE_BASE,
> >                 EDK_COMPONENT_TYPE_SECURITY_CORE,
> >                 EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
> >diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >index cd3b0f647793..ebb93b14c4ff 100644
> >--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >@@ -25,6 +25,7 @@ from . import RuleComplexFile
> > from CommonDataClass.FdfClass import FfsInfStatementClassObject
> > from Common.MultipleWorkspace import MultipleWorkspace as mws
> > from Common.DataType import SUP_MODULE_USER_DEFINED
> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> > from Common.StringUtils import *
> > from Common.Misc import PathClass
> > from Common.Misc import GuidStructureByteArrayToGuidString
> >@@ -84,12 +85,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
> >
> self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1],
> >[]).append(File)
> >
> >             # Check if current INF module has DEPEX
> >-            if '.depex' not in self.FinalTargetSuffixMap and
> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
> >+            if '.depex' not in self.FinalTargetSuffixMap and
> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and
> >self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
> >                 and not self.InfModule.DxsFile and not
> self.InfModule.LibraryClass:
> >                 ModuleType = self.InfModule.ModuleType
> >                 PlatformDataBase =
> >GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.Activ
> eP
> >latform, self.CurrentArch, GenFdsGlobalVariable.TargetName,
> >GenFdsGlobalVariable.ToolChainTag]
> >
> >-                if ModuleType != SUP_MODULE_USER_DEFINED:
> >+                if ModuleType != SUP_MODULE_USER_DEFINED and
> ModuleType !=
> >SUP_MODULE_HOST_APPLICATION:
> >                     for LibraryClass in
> PlatformDataBase.LibraryClasses.GetKeys():
> >                         if LibraryClass.startswith("NULL") and
> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
> >
> self.InfModule.LibraryClasses[LibraryClass] =
> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
> >@@ -378,7 +379,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
> >         #
> >         # Only patch file if FileType is PE32 or ModuleType is
> USER_DEFINED
> >         #
> >-        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
> >SUP_MODULE_USER_DEFINED:
> >+        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
> >SUP_MODULE_USER_DEFINED and self.ModuleType !=
> >SUP_MODULE_HOST_APPLICATION:
> >             return EfiFile
> >
> >         #
> >diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
> >b/BaseTools/Source/Python/Workspace/InfBuildData.py
> >index e66b7c983278..60970cd92836 100644
> >--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
> >+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
> >@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
> >                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
> "No [Depex]
> >section or no valid expression in [Depex] section for [%s] module" \
> >                                 % self.ModuleType,
> File=self.MetaFile)
> >
> >-        if len(RecordList) != 0 and self.ModuleType ==
> >SUP_MODULE_USER_DEFINED:
> >+        if len(RecordList) != 0 and (self.ModuleType ==
> >SUP_MODULE_USER_DEFINED or self.ModuleType ==
> >SUP_MODULE_HOST_APPLICATION):
> >             for Record in RecordList:
> >                 if Record[4] not in [SUP_MODULE_PEIM,
> SUP_MODULE_DXE_DRIVER,
> >SUP_MODULE_DXE_SMM_DRIVER]:
> >                     EdkLogger.error('build', FORMAT_INVALID,
> >diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >index 0cc83110efd5..41ae684d3ee9 100644
> >--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >@@ -8,6 +8,7 @@
> > from __future__ import absolute_import
> > from collections import OrderedDict, defaultdict
> > from Common.DataType import SUP_MODULE_USER_DEFINED
> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> > from .BuildClassObject import LibraryClassObject
> > import Common.GlobalData as GlobalData
> > from Workspace.BuildClassObject import StructurePcd
> >@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform,
> >BuildDatabase, Arch, Target, Toolcha
> >     # If a module has a MODULE_TYPE of USER_DEFINED,
> >     # do not link in NULL library class instances from the global
> [LibraryClasses.*]
> >sections.
> >     #
> >-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
> >+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and
> >Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
> >         for LibraryClass in Platform.LibraryClasses.GetKeys():
> >             if LibraryClass.startswith("NULL") and
> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
> >                 Module.LibraryClasses[LibraryClass] =
> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]
> >@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform,
> >BuildDatabase, Arch, Target, Toolcha
> >
> >LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName,
> >[ModuleType]))
> >                 elif LibraryModule.LibraryClass is None \
> >                      or len(LibraryModule.LibraryClass) == 0 \
> >-                     or (ModuleType !=
> SUP_MODULE_USER_DEFINED
> >+                     or (ModuleType !=
> SUP_MODULE_USER_DEFINED and
> >ModuleType != SUP_MODULE_HOST_APPLICATION
> >                          and ModuleType not in
> >LibraryModule.LibraryClass[0].SupModList):
> >                     # only USER_DEFINED can link against any library
> instance despite of
> >its SupModList
> >                     if FileName:
> >--
> >2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
  2019-07-08  0:53   ` Yao, Jiewen
@ 2019-07-08  1:14     ` Liming Gao
  2019-07-08  2:09       ` Yao, Jiewen
  0 siblings, 1 reply; 9+ messages in thread
From: Liming Gao @ 2019-07-08  1:14 UTC (permalink / raw)
  To: Yao, Jiewen, Lu, XiaoyuX, devel@edk2.groups.io; +Cc: Feng, Bob C

I see the change in build_rule.txt. I understand its output file is decided by this rule. Right? 

[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
    <InputFile>
        *.lib

    <ExtraDependency>
        $(MAKE_FILE)

    <OutputFile>
        $(DEBUG_DIR)(+)$(MODULE_NAME)

    <Command.MSFT, Command.INTEL>
        "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)

    <Command.GCC>
        "$(DLINK)" $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)

    <Command.RVCT>
        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)

    <Command.RVCTCYGWIN>
        #$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
        "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)

    <Command.XCODE>
        "$(DLINK)" -o ${dst} $(DLINK_FLAGS)  $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)
     

Thanks
Liming
>-----Original Message-----
>From: Yao, Jiewen
>Sent: Monday, July 08, 2019 8:53 AM
>To: Gao, Liming <liming.gao@intel.com>; Lu, XiaoyuX <xiaoyux.lu@intel.com>;
>devel@edk2.groups.io
>Cc: Feng, Bob C <bob.c.feng@intel.com>
>Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
>
>Currently, it is xxx.efi.
>
>Thank you
>Yao Jiewen
>
>> -----Original Message-----
>> From: Gao, Liming
>> Sent: Monday, July 8, 2019 8:43 AM
>> To: Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
>> Cc: Feng, Bob C <bob.c.feng@intel.com>; Yao, Jiewen
>> <jiewen.yao@intel.com>
>> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
>> type.
>>
>> Xiaoyu:
>>   I want to confirm what output for HOST_APPLICATION module will be
>> used. Xxx.dll or xxx.efi?
>>
>> Thanks
>> Liming
>> >-----Original Message-----
>> >From: Lu, XiaoyuX
>> >Sent: Monday, July 01, 2019 6:13 PM
>> >To: devel@edk2.groups.io
>> >Cc: Lu, XiaoyuX <xiaoyux.lu@intel.com>; Feng, Bob C
>> <bob.c.feng@intel.com>;
>> >Gao, Liming <liming.gao@intel.com>; Yao, Jiewen
>> <jiewen.yao@intel.com>
>> >Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
>> >
>> >From: Jiewen Yao <jiewen.yao@intel.com>
>> >
>> >It can be used to indicate a module can be build to run
>> >as OS application and run in OS environment.
>> >
>> >Cc: Bob Feng <bob.c.feng@intel.com>
>> >Cc: Liming Gao <liming.gao@intel.com>
>> >Cc: Jiewen Yao <jiewen.yao@intel.com>
>> >Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
>> >---
>> > BaseTools/Conf/build_rule.template            |  2 +-
>> > BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
>> > BaseTools/Source/Python/AutoGen/GenC.py       | 23
>> ++++++++++---------
>> > BaseTools/Source/Python/Common/DataType.py    |  3 ++-
>> > BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
>> > .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
>> > .../Source/Python/Workspace/InfBuildData.py   |  2 +-
>> > .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
>> > 8 files changed, 27 insertions(+), 23 deletions(-)
>> >
>> >diff --git a/BaseTools/Conf/build_rule.template
>> >b/BaseTools/Conf/build_rule.template
>> >index 030e74c35a65..db06d3a6b45a 100755
>> >--- a/BaseTools/Conf/build_rule.template
>> >+++ b/BaseTools/Conf/build_rule.template
>> >@@ -321,7 +321,7 @@
>> >         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
>> >
>> >
>> >-[Static-Library-File.USER_DEFINED]
>> >+[Static-Library-File.USER_DEFINED,
>> Static-Library-File.HOST_APPLICATION]
>> >     <InputFile>
>> >         *.lib
>> >
>> >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>> >b/BaseTools/Source/Python/AutoGen/AutoGen.py
>> >index e8e09dc8a366..32b5a5564827 100644
>> >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>> >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>> >@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
>> >                     # the type of build module is USER_DEFINED.
>> >                     # All different DEPEX section tags would be
>> copied into the As Built
>> >INF file
>> >                     # and there would be separate DEPEX section
>> tags
>> >-                    if self.ModuleType.upper() ==
>> SUP_MODULE_USER_DEFINED:
>> >+                    if self.ModuleType.upper() ==
>> SUP_MODULE_USER_DEFINED or
>> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
>> >                         if (Arch.upper() == self.Arch.upper()) and
>> >(ModuleType.upper() != TAB_ARCH_COMMON):
>> >                             DepexList.append({(Arch, ModuleType):
>> DepexExpr})
>> >                     else:
>> >@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
>> >                             DepexList.append({(Arch, ModuleType):
>> DepexExpr})
>> >
>> >         #the type of build module is USER_DEFINED.
>> >-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
>> >+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED or
>> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
>> >             for Depex in DepexList:
>> >                 for key in Depex:
>> >                     DepexStr += '[Depex.%s.%s]\n' % key
>> >@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
>> >
>> >         for ModuleType in self.DepexList:
>> >             # Ignore empty [depex] section or [depex] section for
>> >SUP_MODULE_USER_DEFINED module
>> >-            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
>> >SUP_MODULE_USER_DEFINED:
>> >+            if len(self.DepexList[ModuleType]) == 0 or ModuleType ==
>> >SUP_MODULE_USER_DEFINED or ModuleType ==
>> >SUP_MODULE_HOST_APPLICATION:
>> >                 continue
>> >
>> >             Dpx =
>> GenDepex.DependencyExpression(self.DepexList[ModuleType],
>> >ModuleType, True)
>> >diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
>> >b/BaseTools/Source/Python/AutoGen/GenC.py
>> >index b527295c0253..4cb776206e90 100644
>> >--- a/BaseTools/Source/Python/AutoGen/GenC.py
>> >+++ b/BaseTools/Source/Python/AutoGen/GenC.py
>> >@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
>> >     SUP_MODULE_SMM_CORE          :   ["PiDxe.h",
>> "Library/BaseLib.h",
>> >"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
>> >     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h",
>> "Library/BaseLib.h",
>> >"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
>> >     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h",
>> "Library/BaseLib.h",
>> >"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
>> >-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
>> >"Library/DebugLib.h"]
>> >+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
>> >"Library/DebugLib.h"],
>> >+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile,
>> >"Library/DebugLib.h"]
>> > }
>> >
>> > ## Autogen internal worker macro to define DynamicEx PCD name
>includes
>> >both the TokenSpaceGuidName
>> >@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info,
>> AutoGenC,
>> >AutoGenH):
>> >         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
>> >
>> >ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MOD
>U
>> L
>> >E_BASE].Replace(Dict))
>> >
>> >ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE]
>> .R
>> >eplace(Dict))
>> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
>> >SUP_MODULE_USER_DEFINED]:
>> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
>> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
>> >
>> >ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Repl
>a
>> ce
>> >(Dict))
>> >
>> >ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
>> >@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info,
>> AutoGenC,
>> >AutoGenH):
>> >     if Info.IsLibrary:
>> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
>> Dict)
>> >     else:
>> >-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>> >SUP_MODULE_USER_DEFINED]:
>> >+        if Info.ModuleType in [SUP_MODULE_BASE,
>> SUP_MODULE_SEC,
>> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>> >
>> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
>> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
>> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
>> >@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info,
>> AutoGenC,
>> >AutoGenH):
>> >         if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
>> >
>> >DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MOD
>UL
>> E
>> >_BASE].Replace(Dict))
>> >
>> >DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].
>> Re
>> >place(Dict))
>> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
>> >SUP_MODULE_USER_DEFINED]:
>> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
>> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
>> >
>> >DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Repla
>c
>> e(
>> >Dict))
>> >
>> >DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
>> >@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info,
>> AutoGenC,
>> >AutoGenH):
>> >     if Info.IsLibrary:
>> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
>> Dict)
>> >     else:
>> >-        if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC,
>> >SUP_MODULE_USER_DEFINED]:
>> >+        if Info.ModuleType in [SUP_MODULE_BASE,
>> SUP_MODULE_SEC,
>> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
>> >
>> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
>> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
>> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
>> >@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info,
>> AutoGenC,
>> >AutoGenH):
>> > #   @param      AutoGenH    The TemplateString object for header
>> file
>> > #
>> > def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
>> >-    if Info.IsLibrary or Info.ModuleType in
>> [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_SEC]:
>> >+    if Info.IsLibrary or Info.ModuleType in
>> [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
>> >         return
>> >     #
>> >     # Module Entry Points
>> >@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info,
>> AutoGenC,
>> >AutoGenH):
>> > #   @param      AutoGenH    The TemplateString object for header
>> file
>> > #
>> > def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
>> >-    if Info.IsLibrary or Info.ModuleType in
>> [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_BASE, SUP_MODULE_SEC]:
>> >+    if Info.IsLibrary or Info.ModuleType in
>> [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE,
>> >SUP_MODULE_SEC]:
>> >         return
>> >     #
>> >     # Unload Image Handlers
>> >@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info,
>> >AutoGenC, AutoGenH):
>> > #   @param      AutoGenH    The TemplateString object for header
>> file
>> > #
>> > def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
>> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_BASE]:
>> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>> >         GuidType = TAB_GUID
>> >     else:
>> >         GuidType = "EFI_GUID"
>> >@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC,
>> >AutoGenH):
>> > #   @param      AutoGenH    The TemplateString object for header
>> file
>> > #
>> > def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
>> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_BASE]:
>> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>> >         GuidType = TAB_GUID
>> >     else:
>> >         GuidType = "EFI_GUID"
>> >@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info,
>> AutoGenC,
>> >AutoGenH):
>> > #   @param      AutoGenH    The TemplateString object for header
>> file
>> > #
>> > def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
>> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_BASE]:
>> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>> >         GuidType = TAB_GUID
>> >     else:
>> >         GuidType = "EFI_GUID"
>> >@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH):
>> >     # Add extern declarations to AutoGen.h if one or more Token Space
>> GUIDs
>> >were found
>> >     if TokenSpaceList:
>> >         AutoGenH.Append("\n// Definition of PCD Token Space GUIDs
>> used in
>> >this module\n\n")
>> >-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_BASE]:
>> >+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
>> >             GuidType = TAB_GUID
>> >         else:
>> >             GuidType = "EFI_GUID"
>> >diff --git a/BaseTools/Source/Python/Common/DataType.py
>> >b/BaseTools/Source/Python/Common/DataType.py
>> >index 83ec36c2350d..8ae1bd28fabf 100644
>> >--- a/BaseTools/Source/Python/Common/DataType.py
>> >+++ b/BaseTools/Source/Python/Common/DataType.py
>> >@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER =
>> >'DXE_SMM_DRIVER'
>> > SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
>> > SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
>> > SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
>> >+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
>> > SUP_MODULE_SMM_CORE = 'SMM_CORE'
>> > SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
>> > SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
>> >
>> > SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC,
>> >SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,
>> SUP_MODULE_DXE_CORE,
>> >SUP_MODULE_DXE_DRIVER, \
>> >                    SUP_MODULE_DXE_RUNTIME_DRIVER,
>> >SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
>> >SUP_MODULE_UEFI_DRIVER, \
>> >-                   SUP_MODULE_UEFI_APPLICATION,
>> SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
>> >SUP_MODULE_MM_CORE_STANDALONE]
>> >+                   SUP_MODULE_UEFI_APPLICATION,
>> SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE,
>> >SUP_MODULE_MM_STANDALONE,
>> SUP_MODULE_MM_CORE_STANDALONE]
>> > SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
>> > SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM,
>> SUP_MODULE_PEI_CORE}
>> >
>> >diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
>> >b/BaseTools/Source/Python/GenFds/FdfParser.py
>> >index fb5fd85e0a82..9b04a76af8c5 100644
>> >--- a/BaseTools/Source/Python/GenFds/FdfParser.py
>> >+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
>> >@@ -3543,7 +3543,7 @@ class FdfParser:
>> >                 SUP_MODULE_DXE_CORE,
>> SUP_MODULE_DXE_DRIVER,
>> >                 SUP_MODULE_DXE_SAL_DRIVER,
>> SUP_MODULE_DXE_SMM_DRIVER,
>> >                 SUP_MODULE_DXE_RUNTIME_DRIVER,
>> SUP_MODULE_UEFI_DRIVER,
>> >-                SUP_MODULE_UEFI_APPLICATION,
>> SUP_MODULE_USER_DEFINED,
>> >+                SUP_MODULE_UEFI_APPLICATION,
>> SUP_MODULE_USER_DEFINED,
>> >SUP_MODULE_HOST_APPLICATION,
>> >                 TAB_DEFAULT, SUP_MODULE_BASE,
>> >                 EDK_COMPONENT_TYPE_SECURITY_CORE,
>> >                 EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
>> >diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>> >b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>> >index cd3b0f647793..ebb93b14c4ff 100644
>> >--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>> >+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
>> >@@ -25,6 +25,7 @@ from . import RuleComplexFile
>> > from CommonDataClass.FdfClass import FfsInfStatementClassObject
>> > from Common.MultipleWorkspace import MultipleWorkspace as mws
>> > from Common.DataType import SUP_MODULE_USER_DEFINED
>> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
>> > from Common.StringUtils import *
>> > from Common.Misc import PathClass
>> > from Common.Misc import GuidStructureByteArrayToGuidString
>> >@@ -84,12 +85,12 @@ class FfsInfStatement(FfsInfStatementClassObject):
>> >
>> self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1],
>> >[]).append(File)
>> >
>> >             # Check if current INF module has DEPEX
>> >-            if '.depex' not in self.FinalTargetSuffixMap and
>> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
>> >+            if '.depex' not in self.FinalTargetSuffixMap and
>> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and
>> >self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
>> >                 and not self.InfModule.DxsFile and not
>> self.InfModule.LibraryClass:
>> >                 ModuleType = self.InfModule.ModuleType
>> >                 PlatformDataBase =
>> >GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.Acti
>v
>> eP
>> >latform, self.CurrentArch, GenFdsGlobalVariable.TargetName,
>> >GenFdsGlobalVariable.ToolChainTag]
>> >
>> >-                if ModuleType != SUP_MODULE_USER_DEFINED:
>> >+                if ModuleType != SUP_MODULE_USER_DEFINED and
>> ModuleType !=
>> >SUP_MODULE_HOST_APPLICATION:
>> >                     for LibraryClass in
>> PlatformDataBase.LibraryClasses.GetKeys():
>> >                         if LibraryClass.startswith("NULL") and
>> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
>> >
>> self.InfModule.LibraryClasses[LibraryClass] =
>> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
>> >@@ -378,7 +379,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
>> >         #
>> >         # Only patch file if FileType is PE32 or ModuleType is
>> USER_DEFINED
>> >         #
>> >-        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
>> >SUP_MODULE_USER_DEFINED:
>> >+        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType !=
>> >SUP_MODULE_USER_DEFINED and self.ModuleType !=
>> >SUP_MODULE_HOST_APPLICATION:
>> >             return EfiFile
>> >
>> >         #
>> >diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
>> >b/BaseTools/Source/Python/Workspace/InfBuildData.py
>> >index e66b7c983278..60970cd92836 100644
>> >--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
>> >+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
>> >@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
>> >                 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE,
>> "No [Depex]
>> >section or no valid expression in [Depex] section for [%s] module" \
>> >                                 % self.ModuleType,
>> File=self.MetaFile)
>> >
>> >-        if len(RecordList) != 0 and self.ModuleType ==
>> >SUP_MODULE_USER_DEFINED:
>> >+        if len(RecordList) != 0 and (self.ModuleType ==
>> >SUP_MODULE_USER_DEFINED or self.ModuleType ==
>> >SUP_MODULE_HOST_APPLICATION):
>> >             for Record in RecordList:
>> >                 if Record[4] not in [SUP_MODULE_PEIM,
>> SUP_MODULE_DXE_DRIVER,
>> >SUP_MODULE_DXE_SMM_DRIVER]:
>> >                     EdkLogger.error('build', FORMAT_INVALID,
>> >diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>> >b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>> >index 0cc83110efd5..41ae684d3ee9 100644
>> >--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>> >+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
>> >@@ -8,6 +8,7 @@
>> > from __future__ import absolute_import
>> > from collections import OrderedDict, defaultdict
>> > from Common.DataType import SUP_MODULE_USER_DEFINED
>> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
>> > from .BuildClassObject import LibraryClassObject
>> > import Common.GlobalData as GlobalData
>> > from Workspace.BuildClassObject import StructurePcd
>> >@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform,
>> >BuildDatabase, Arch, Target, Toolcha
>> >     # If a module has a MODULE_TYPE of USER_DEFINED,
>> >     # do not link in NULL library class instances from the global
>> [LibraryClasses.*]
>> >sections.
>> >     #
>> >-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
>> >+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and
>> >Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
>> >         for LibraryClass in Platform.LibraryClasses.GetKeys():
>> >             if LibraryClass.startswith("NULL") and
>> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
>> >                 Module.LibraryClasses[LibraryClass] =
>> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]
>> >@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform,
>> >BuildDatabase, Arch, Target, Toolcha
>> >
>> >LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName,
>> >[ModuleType]))
>> >                 elif LibraryModule.LibraryClass is None \
>> >                      or len(LibraryModule.LibraryClass) == 0 \
>> >-                     or (ModuleType !=
>> SUP_MODULE_USER_DEFINED
>> >+                     or (ModuleType !=
>> SUP_MODULE_USER_DEFINED and
>> >ModuleType != SUP_MODULE_HOST_APPLICATION
>> >                          and ModuleType not in
>> >LibraryModule.LibraryClass[0].SupModList):
>> >                     # only USER_DEFINED can link against any library
>> instance despite of
>> >its SupModList
>> >                     if FileName:
>> >--
>> >2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
  2019-07-08  1:14     ` Liming Gao
@ 2019-07-08  2:09       ` Yao, Jiewen
  2019-07-09  6:26         ` Liming Gao
       [not found]         ` <15AFA92770BB0C26.21445@groups.io>
  0 siblings, 2 replies; 9+ messages in thread
From: Yao, Jiewen @ 2019-07-08  2:09 UTC (permalink / raw)
  To: Gao, Liming, Lu, XiaoyuX, devel@edk2.groups.io; +Cc: Feng, Bob C

Right. So far we just duplicate what USER_DEFINED does.

With more and more example, we will see if and how we enhance that.
But it is good enough now.

Thank you
Yao Jiewen

> -----Original Message-----
> From: Gao, Liming
> Sent: Monday, July 8, 2019 9:15 AM
> To: Yao, Jiewen <jiewen.yao@intel.com>; Lu, XiaoyuX
> <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> type.
> 
> I see the change in build_rule.txt. I understand its output file is decided by
> this rule. Right?
> 
> [Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
>     <InputFile>
>         *.lib
> 
>     <ExtraDependency>
>         $(MAKE_FILE)
> 
>     <OutputFile>
>         $(DEBUG_DIR)(+)$(MODULE_NAME)
> 
>     <Command.MSFT, Command.INTEL>
>         "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH)
> @$(STATIC_LIBRARY_FILES_LIST)
> 
>     <Command.GCC>
>         "$(DLINK)" $(DLINK_FLAGS)
> -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group
> $(DLINK2_FLAGS)
> 
>     <Command.RVCT>
>         "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via
> $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
> 
>     <Command.RVCTCYGWIN>
>         #$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
>         "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH)
> $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
> 
>     <Command.XCODE>
>         "$(DLINK)" -o ${dst} $(DLINK_FLAGS)  $(DLINK_SPATH) -filelist
> $(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)
> 
> 
> Thanks
> Liming
> >-----Original Message-----
> >From: Yao, Jiewen
> >Sent: Monday, July 08, 2019 8:53 AM
> >To: Gao, Liming <liming.gao@intel.com>; Lu, XiaoyuX
> <xiaoyux.lu@intel.com>;
> >devel@edk2.groups.io
> >Cc: Feng, Bob C <bob.c.feng@intel.com>
> >Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> type.
> >
> >Currently, it is xxx.efi.
> >
> >Thank you
> >Yao Jiewen
> >
> >> -----Original Message-----
> >> From: Gao, Liming
> >> Sent: Monday, July 8, 2019 8:43 AM
> >> To: Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> >> Cc: Feng, Bob C <bob.c.feng@intel.com>; Yao, Jiewen
> >> <jiewen.yao@intel.com>
> >> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> >> type.
> >>
> >> Xiaoyu:
> >>   I want to confirm what output for HOST_APPLICATION module will be
> >> used. Xxx.dll or xxx.efi?
> >>
> >> Thanks
> >> Liming
> >> >-----Original Message-----
> >> >From: Lu, XiaoyuX
> >> >Sent: Monday, July 01, 2019 6:13 PM
> >> >To: devel@edk2.groups.io
> >> >Cc: Lu, XiaoyuX <xiaoyux.lu@intel.com>; Feng, Bob C
> >> <bob.c.feng@intel.com>;
> >> >Gao, Liming <liming.gao@intel.com>; Yao, Jiewen
> >> <jiewen.yao@intel.com>
> >> >Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> type.
> >> >
> >> >From: Jiewen Yao <jiewen.yao@intel.com>
> >> >
> >> >It can be used to indicate a module can be build to run
> >> >as OS application and run in OS environment.
> >> >
> >> >Cc: Bob Feng <bob.c.feng@intel.com>
> >> >Cc: Liming Gao <liming.gao@intel.com>
> >> >Cc: Jiewen Yao <jiewen.yao@intel.com>
> >> >Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
> >> >---
> >> > BaseTools/Conf/build_rule.template            |  2 +-
> >> > BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
> >> > BaseTools/Source/Python/AutoGen/GenC.py       | 23
> >> ++++++++++---------
> >> > BaseTools/Source/Python/Common/DataType.py    |  3 ++-
> >> > BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
> >> > .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
> >> > .../Source/Python/Workspace/InfBuildData.py   |  2 +-
> >> > .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
> >> > 8 files changed, 27 insertions(+), 23 deletions(-)
> >> >
> >> >diff --git a/BaseTools/Conf/build_rule.template
> >> >b/BaseTools/Conf/build_rule.template
> >> >index 030e74c35a65..db06d3a6b45a 100755
> >> >--- a/BaseTools/Conf/build_rule.template
> >> >+++ b/BaseTools/Conf/build_rule.template
> >> >@@ -321,7 +321,7 @@
> >> >         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
> >> >
> >> >
> >> >-[Static-Library-File.USER_DEFINED]
> >> >+[Static-Library-File.USER_DEFINED,
> >> Static-Library-File.HOST_APPLICATION]
> >> >     <InputFile>
> >> >         *.lib
> >> >
> >> >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> >> >b/BaseTools/Source/Python/AutoGen/AutoGen.py
> >> >index e8e09dc8a366..32b5a5564827 100644
> >> >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> >> >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> >> >@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
> >> >                     # the type of build module is USER_DEFINED.
> >> >                     # All different DEPEX section tags would be
> >> copied into the As Built
> >> >INF file
> >> >                     # and there would be separate DEPEX section
> >> tags
> >> >-                    if self.ModuleType.upper() ==
> >> SUP_MODULE_USER_DEFINED:
> >> >+                    if self.ModuleType.upper() ==
> >> SUP_MODULE_USER_DEFINED or
> >> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> >> >                         if (Arch.upper() == self.Arch.upper()) and
> >> >(ModuleType.upper() != TAB_ARCH_COMMON):
> >> >                             DepexList.append({(Arch,
> ModuleType):
> >> DepexExpr})
> >> >                     else:
> >> >@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
> >> >                             DepexList.append({(Arch,
> ModuleType):
> >> DepexExpr})
> >> >
> >> >         #the type of build module is USER_DEFINED.
> >> >-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
> >> >+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED
> or
> >> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> >> >             for Depex in DepexList:
> >> >                 for key in Depex:
> >> >                     DepexStr += '[Depex.%s.%s]\n' % key
> >> >@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
> >> >
> >> >         for ModuleType in self.DepexList:
> >> >             # Ignore empty [depex] section or [depex] section for
> >> >SUP_MODULE_USER_DEFINED module
> >> >-            if len(self.DepexList[ModuleType]) == 0 or ModuleType
> ==
> >> >SUP_MODULE_USER_DEFINED:
> >> >+            if len(self.DepexList[ModuleType]) == 0 or ModuleType
> ==
> >> >SUP_MODULE_USER_DEFINED or ModuleType ==
> >> >SUP_MODULE_HOST_APPLICATION:
> >> >                 continue
> >> >
> >> >             Dpx =
> >> GenDepex.DependencyExpression(self.DepexList[ModuleType],
> >> >ModuleType, True)
> >> >diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
> >> >b/BaseTools/Source/Python/AutoGen/GenC.py
> >> >index b527295c0253..4cb776206e90 100644
> >> >--- a/BaseTools/Source/Python/AutoGen/GenC.py
> >> >+++ b/BaseTools/Source/Python/AutoGen/GenC.py
> >> >@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
> >> >     SUP_MODULE_SMM_CORE          :   ["PiDxe.h",
> >> "Library/BaseLib.h",
> >> >"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
> >> >     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h",
> >> "Library/BaseLib.h",
> >> >"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
> >> >     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h",
> >> "Library/BaseLib.h",
> >> >"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
> >> >-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> >> >"Library/DebugLib.h"]
> >> >+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> >> >"Library/DebugLib.h"],
> >> >+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile,
> >> >"Library/DebugLib.h"]
> >> > }
> >> >
> >> > ## Autogen internal worker macro to define DynamicEx PCD name
> >includes
> >> >both the TokenSpaceGuidName
> >> >@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info,
> >> AutoGenC,
> >> >AutoGenH):
> >> >         if Lib.ModuleType in [SUP_MODULE_BASE,
> SUP_MODULE_SEC]:
> >> >
> >> >ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MO
> D
> >U
> >> L
> >> >E_BASE].Replace(Dict))
> >> >
> >> >ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BA
> SE]
> >> .R
> >> >eplace(Dict))
> >> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> >> >SUP_MODULE_USER_DEFINED]:
> >> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> >> >
> >> >ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Re
> pl
> >a
> >> ce
> >> >(Dict))
> >> >
> >> >ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict
> ))
> >> >@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info,
> >> AutoGenC,
> >> >AutoGenH):
> >> >     if Info.IsLibrary:
> >> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
> >> Dict)
> >> >     else:
> >> >-        if Info.ModuleType in [SUP_MODULE_BASE,
> SUP_MODULE_SEC,
> >> >SUP_MODULE_USER_DEFINED]:
> >> >+        if Info.ModuleType in [SUP_MODULE_BASE,
> >> SUP_MODULE_SEC,
> >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >> >
> >> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> >> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> >> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> >> >@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info,
> >> AutoGenC,
> >> >AutoGenH):
> >> >         if Lib.ModuleType in [SUP_MODULE_BASE,
> SUP_MODULE_SEC]:
> >> >
> >> >DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MO
> D
> >UL
> >> E
> >> >_BASE].Replace(Dict))
> >> >
> >> >DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BAS
> E].
> >> Re
> >> >place(Dict))
> >> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> >> >SUP_MODULE_USER_DEFINED]:
> >> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> >> >
> >> >DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Repl
> a
> >c
> >> e(
> >> >Dict))
> >> >
> >> >DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
> >> >@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info,
> >> AutoGenC,
> >> >AutoGenH):
> >> >     if Info.IsLibrary:
> >> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
> >> Dict)
> >> >     else:
> >> >-        if Info.ModuleType in [SUP_MODULE_BASE,
> SUP_MODULE_SEC,
> >> >SUP_MODULE_USER_DEFINED]:
> >> >+        if Info.ModuleType in [SUP_MODULE_BASE,
> >> SUP_MODULE_SEC,
> >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> >> >
> >> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> >> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> >> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> >> >@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info,
> >> AutoGenC,
> >> >AutoGenH):
> >> > #   @param      AutoGenH    The TemplateString object for
> header
> >> file
> >> > #
> >> > def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
> >> >-    if Info.IsLibrary or Info.ModuleType in
> >> [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_SEC]:
> >> >+    if Info.IsLibrary or Info.ModuleType in
> >> [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
> >> >         return
> >> >     #
> >> >     # Module Entry Points
> >> >@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info,
> >> AutoGenC,
> >> >AutoGenH):
> >> > #   @param      AutoGenH    The TemplateString object for
> header
> >> file
> >> > #
> >> > def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
> >> >-    if Info.IsLibrary or Info.ModuleType in
> >> [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_BASE, SUP_MODULE_SEC]:
> >> >+    if Info.IsLibrary or Info.ModuleType in
> >> [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE,
> >> >SUP_MODULE_SEC]:
> >> >         return
> >> >     #
> >> >     # Unload Image Handlers
> >> >@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info,
> >> >AutoGenC, AutoGenH):
> >> > #   @param      AutoGenH    The TemplateString object for
> header
> >> file
> >> > #
> >> > def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
> >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_BASE]:
> >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >> >         GuidType = TAB_GUID
> >> >     else:
> >> >         GuidType = "EFI_GUID"
> >> >@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info,
> AutoGenC,
> >> >AutoGenH):
> >> > #   @param      AutoGenH    The TemplateString object for
> header
> >> file
> >> > #
> >> > def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
> >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_BASE]:
> >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >> >         GuidType = TAB_GUID
> >> >     else:
> >> >         GuidType = "EFI_GUID"
> >> >@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info,
> >> AutoGenC,
> >> >AutoGenH):
> >> > #   @param      AutoGenH    The TemplateString object for
> header
> >> file
> >> > #
> >> > def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
> >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_BASE]:
> >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >> >         GuidType = TAB_GUID
> >> >     else:
> >> >         GuidType = "EFI_GUID"
> >> >@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC,
> AutoGenH):
> >> >     # Add extern declarations to AutoGen.h if one or more Token
> Space
> >> GUIDs
> >> >were found
> >> >     if TokenSpaceList:
> >> >         AutoGenH.Append("\n// Definition of PCD Token Space
> GUIDs
> >> used in
> >> >this module\n\n")
> >> >-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_BASE]:
> >> >+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> >> >             GuidType = TAB_GUID
> >> >         else:
> >> >             GuidType = "EFI_GUID"
> >> >diff --git a/BaseTools/Source/Python/Common/DataType.py
> >> >b/BaseTools/Source/Python/Common/DataType.py
> >> >index 83ec36c2350d..8ae1bd28fabf 100644
> >> >--- a/BaseTools/Source/Python/Common/DataType.py
> >> >+++ b/BaseTools/Source/Python/Common/DataType.py
> >> >@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER =
> >> >'DXE_SMM_DRIVER'
> >> > SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
> >> > SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
> >> > SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
> >> >+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
> >> > SUP_MODULE_SMM_CORE = 'SMM_CORE'
> >> > SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
> >> > SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
> >> >
> >> > SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC,
> >> >SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,
> >> SUP_MODULE_DXE_CORE,
> >> >SUP_MODULE_DXE_DRIVER, \
> >> >                    SUP_MODULE_DXE_RUNTIME_DRIVER,
> >> >SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
> >> >SUP_MODULE_UEFI_DRIVER, \
> >> >-                   SUP_MODULE_UEFI_APPLICATION,
> >> SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
> >> >SUP_MODULE_MM_CORE_STANDALONE]
> >> >+                   SUP_MODULE_UEFI_APPLICATION,
> >> SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE,
> >> >SUP_MODULE_MM_STANDALONE,
> >> SUP_MODULE_MM_CORE_STANDALONE]
> >> > SUP_MODULE_LIST_STRING =
> TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
> >> > SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM,
> >> SUP_MODULE_PEI_CORE}
> >> >
> >> >diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> >> >b/BaseTools/Source/Python/GenFds/FdfParser.py
> >> >index fb5fd85e0a82..9b04a76af8c5 100644
> >> >--- a/BaseTools/Source/Python/GenFds/FdfParser.py
> >> >+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> >> >@@ -3543,7 +3543,7 @@ class FdfParser:
> >> >                 SUP_MODULE_DXE_CORE,
> >> SUP_MODULE_DXE_DRIVER,
> >> >                 SUP_MODULE_DXE_SAL_DRIVER,
> >> SUP_MODULE_DXE_SMM_DRIVER,
> >> >                 SUP_MODULE_DXE_RUNTIME_DRIVER,
> >> SUP_MODULE_UEFI_DRIVER,
> >> >-                SUP_MODULE_UEFI_APPLICATION,
> >> SUP_MODULE_USER_DEFINED,
> >> >+                SUP_MODULE_UEFI_APPLICATION,
> >> SUP_MODULE_USER_DEFINED,
> >> >SUP_MODULE_HOST_APPLICATION,
> >> >                 TAB_DEFAULT, SUP_MODULE_BASE,
> >> >                 EDK_COMPONENT_TYPE_SECURITY_CORE,
> >> >
> EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
> >> >diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >> >b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >> >index cd3b0f647793..ebb93b14c4ff 100644
> >> >--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >> >+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> >> >@@ -25,6 +25,7 @@ from . import RuleComplexFile
> >> > from CommonDataClass.FdfClass import FfsInfStatementClassObject
> >> > from Common.MultipleWorkspace import MultipleWorkspace as mws
> >> > from Common.DataType import SUP_MODULE_USER_DEFINED
> >> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> >> > from Common.StringUtils import *
> >> > from Common.Misc import PathClass
> >> > from Common.Misc import GuidStructureByteArrayToGuidString
> >> >@@ -84,12 +85,12 @@ class
> FfsInfStatement(FfsInfStatementClassObject):
> >> >
> >> self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1],
> >> >[]).append(File)
> >> >
> >> >             # Check if current INF module has DEPEX
> >> >-            if '.depex' not in self.FinalTargetSuffixMap and
> >> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
> >> >+            if '.depex' not in self.FinalTargetSuffixMap and
> >> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and
> >> >self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
> >> >                 and not self.InfModule.DxsFile and not
> >> self.InfModule.LibraryClass:
> >> >                 ModuleType = self.InfModule.ModuleType
> >> >                 PlatformDataBase =
> >> >GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.Ac
> ti
> >v
> >> eP
> >> >latform, self.CurrentArch, GenFdsGlobalVariable.TargetName,
> >> >GenFdsGlobalVariable.ToolChainTag]
> >> >
> >> >-                if ModuleType != SUP_MODULE_USER_DEFINED:
> >> >+                if ModuleType != SUP_MODULE_USER_DEFINED
> and
> >> ModuleType !=
> >> >SUP_MODULE_HOST_APPLICATION:
> >> >                     for LibraryClass in
> >> PlatformDataBase.LibraryClasses.GetKeys():
> >> >                         if LibraryClass.startswith("NULL") and
> >> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
> >> >
> >> self.InfModule.LibraryClasses[LibraryClass] =
> >> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
> >> >@@ -378,7 +379,7 @@ class
> FfsInfStatement(FfsInfStatementClassObject):
> >> >         #
> >> >         # Only patch file if FileType is PE32 or ModuleType is
> >> USER_DEFINED
> >> >         #
> >> >-        if FileType != BINARY_FILE_TYPE_PE32 and
> self.ModuleType !=
> >> >SUP_MODULE_USER_DEFINED:
> >> >+        if FileType != BINARY_FILE_TYPE_PE32 and
> self.ModuleType !=
> >> >SUP_MODULE_USER_DEFINED and self.ModuleType !=
> >> >SUP_MODULE_HOST_APPLICATION:
> >> >             return EfiFile
> >> >
> >> >         #
> >> >diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
> >> >b/BaseTools/Source/Python/Workspace/InfBuildData.py
> >> >index e66b7c983278..60970cd92836 100644
> >> >--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
> >> >+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
> >> >@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
> >> >                 EdkLogger.error('build',
> RESOURCE_NOT_AVAILABLE,
> >> "No [Depex]
> >> >section or no valid expression in [Depex] section for [%s] module" \
> >> >                                 % self.ModuleType,
> >> File=self.MetaFile)
> >> >
> >> >-        if len(RecordList) != 0 and self.ModuleType ==
> >> >SUP_MODULE_USER_DEFINED:
> >> >+        if len(RecordList) != 0 and (self.ModuleType ==
> >> >SUP_MODULE_USER_DEFINED or self.ModuleType ==
> >> >SUP_MODULE_HOST_APPLICATION):
> >> >             for Record in RecordList:
> >> >                 if Record[4] not in [SUP_MODULE_PEIM,
> >> SUP_MODULE_DXE_DRIVER,
> >> >SUP_MODULE_DXE_SMM_DRIVER]:
> >> >                     EdkLogger.error('build', FORMAT_INVALID,
> >> >diff --git
> a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >> >b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >> >index 0cc83110efd5..41ae684d3ee9 100644
> >> >--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >> >+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> >> >@@ -8,6 +8,7 @@
> >> > from __future__ import absolute_import
> >> > from collections import OrderedDict, defaultdict
> >> > from Common.DataType import SUP_MODULE_USER_DEFINED
> >> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> >> > from .BuildClassObject import LibraryClassObject
> >> > import Common.GlobalData as GlobalData
> >> > from Workspace.BuildClassObject import StructurePcd
> >> >@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform,
> >> >BuildDatabase, Arch, Target, Toolcha
> >> >     # If a module has a MODULE_TYPE of USER_DEFINED,
> >> >     # do not link in NULL library class instances from the global
> >> [LibraryClasses.*]
> >> >sections.
> >> >     #
> >> >-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
> >> >+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and
> >> >Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
> >> >         for LibraryClass in Platform.LibraryClasses.GetKeys():
> >> >             if LibraryClass.startswith("NULL") and
> >> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
> >> >                 Module.LibraryClasses[LibraryClass] =
> >> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]
> >> >@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform,
> >> >BuildDatabase, Arch, Target, Toolcha
> >> >
> >> >LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassNam
> e,
> >> >[ModuleType]))
> >> >                 elif LibraryModule.LibraryClass is None \
> >> >                      or len(LibraryModule.LibraryClass) == 0 \
> >> >-                     or (ModuleType !=
> >> SUP_MODULE_USER_DEFINED
> >> >+                     or (ModuleType !=
> >> SUP_MODULE_USER_DEFINED and
> >> >ModuleType != SUP_MODULE_HOST_APPLICATION
> >> >                          and ModuleType not in
> >> >LibraryModule.LibraryClass[0].SupModList):
> >> >                     # only USER_DEFINED can link against any
> library
> >> instance despite of
> >> >its SupModList
> >> >                     if FileName:
> >> >--
> >> >2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
  2019-07-08  2:09       ` Yao, Jiewen
@ 2019-07-09  6:26         ` Liming Gao
       [not found]         ` <15AFA92770BB0C26.21445@groups.io>
  1 sibling, 0 replies; 9+ messages in thread
From: Liming Gao @ 2019-07-09  6:26 UTC (permalink / raw)
  To: Yao, Jiewen, Lu, XiaoyuX, devel@edk2.groups.io; +Cc: Feng, Bob C

OK. I have no other comments. Reviewed-by: Liming Gao <liming.gao@intel.com>

Thanks
Liming
> -----Original Message-----
> From: Yao, Jiewen
> Sent: Monday, July 8, 2019 10:10 AM
> To: Gao, Liming <liming.gao@intel.com>; Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>
> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
> 
> Right. So far we just duplicate what USER_DEFINED does.
> 
> With more and more example, we will see if and how we enhance that.
> But it is good enough now.
> 
> Thank you
> Yao Jiewen
> 
> > -----Original Message-----
> > From: Gao, Liming
> > Sent: Monday, July 8, 2019 9:15 AM
> > To: Yao, Jiewen <jiewen.yao@intel.com>; Lu, XiaoyuX
> > <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> > Cc: Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> > type.
> >
> > I see the change in build_rule.txt. I understand its output file is decided by
> > this rule. Right?
> >
> > [Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
> >     <InputFile>
> >         *.lib
> >
> >     <ExtraDependency>
> >         $(MAKE_FILE)
> >
> >     <OutputFile>
> >         $(DEBUG_DIR)(+)$(MODULE_NAME)
> >
> >     <Command.MSFT, Command.INTEL>
> >         "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH)
> > @$(STATIC_LIBRARY_FILES_LIST)
> >
> >     <Command.GCC>
> >         "$(DLINK)" $(DLINK_FLAGS)
> > -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group
> > $(DLINK2_FLAGS)
> >
> >     <Command.RVCT>
> >         "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via
> > $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
> >
> >     <Command.RVCTCYGWIN>
> >         #$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
> >         "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH)
> > $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
> >
> >     <Command.XCODE>
> >         "$(DLINK)" -o ${dst} $(DLINK_FLAGS)  $(DLINK_SPATH) -filelist
> > $(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)
> >
> >
> > Thanks
> > Liming
> > >-----Original Message-----
> > >From: Yao, Jiewen
> > >Sent: Monday, July 08, 2019 8:53 AM
> > >To: Gao, Liming <liming.gao@intel.com>; Lu, XiaoyuX
> > <xiaoyux.lu@intel.com>;
> > >devel@edk2.groups.io
> > >Cc: Feng, Bob C <bob.c.feng@intel.com>
> > >Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> > type.
> > >
> > >Currently, it is xxx.efi.
> > >
> > >Thank you
> > >Yao Jiewen
> > >
> > >> -----Original Message-----
> > >> From: Gao, Liming
> > >> Sent: Monday, July 8, 2019 8:43 AM
> > >> To: Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> > >> Cc: Feng, Bob C <bob.c.feng@intel.com>; Yao, Jiewen
> > >> <jiewen.yao@intel.com>
> > >> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> > >> type.
> > >>
> > >> Xiaoyu:
> > >>   I want to confirm what output for HOST_APPLICATION module will be
> > >> used. Xxx.dll or xxx.efi?
> > >>
> > >> Thanks
> > >> Liming
> > >> >-----Original Message-----
> > >> >From: Lu, XiaoyuX
> > >> >Sent: Monday, July 01, 2019 6:13 PM
> > >> >To: devel@edk2.groups.io
> > >> >Cc: Lu, XiaoyuX <xiaoyux.lu@intel.com>; Feng, Bob C
> > >> <bob.c.feng@intel.com>;
> > >> >Gao, Liming <liming.gao@intel.com>; Yao, Jiewen
> > >> <jiewen.yao@intel.com>
> > >> >Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> > type.
> > >> >
> > >> >From: Jiewen Yao <jiewen.yao@intel.com>
> > >> >
> > >> >It can be used to indicate a module can be build to run
> > >> >as OS application and run in OS environment.
> > >> >
> > >> >Cc: Bob Feng <bob.c.feng@intel.com>
> > >> >Cc: Liming Gao <liming.gao@intel.com>
> > >> >Cc: Jiewen Yao <jiewen.yao@intel.com>
> > >> >Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
> > >> >---
> > >> > BaseTools/Conf/build_rule.template            |  2 +-
> > >> > BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
> > >> > BaseTools/Source/Python/AutoGen/GenC.py       | 23
> > >> ++++++++++---------
> > >> > BaseTools/Source/Python/Common/DataType.py    |  3 ++-
> > >> > BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
> > >> > .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
> > >> > .../Source/Python/Workspace/InfBuildData.py   |  2 +-
> > >> > .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
> > >> > 8 files changed, 27 insertions(+), 23 deletions(-)
> > >> >
> > >> >diff --git a/BaseTools/Conf/build_rule.template
> > >> >b/BaseTools/Conf/build_rule.template
> > >> >index 030e74c35a65..db06d3a6b45a 100755
> > >> >--- a/BaseTools/Conf/build_rule.template
> > >> >+++ b/BaseTools/Conf/build_rule.template
> > >> >@@ -321,7 +321,7 @@
> > >> >         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
> > >> >
> > >> >
> > >> >-[Static-Library-File.USER_DEFINED]
> > >> >+[Static-Library-File.USER_DEFINED,
> > >> Static-Library-File.HOST_APPLICATION]
> > >> >     <InputFile>
> > >> >         *.lib
> > >> >
> > >> >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > >> >b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > >> >index e8e09dc8a366..32b5a5564827 100644
> > >> >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > >> >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > >> >@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
> > >> >                     # the type of build module is USER_DEFINED.
> > >> >                     # All different DEPEX section tags would be
> > >> copied into the As Built
> > >> >INF file
> > >> >                     # and there would be separate DEPEX section
> > >> tags
> > >> >-                    if self.ModuleType.upper() ==
> > >> SUP_MODULE_USER_DEFINED:
> > >> >+                    if self.ModuleType.upper() ==
> > >> SUP_MODULE_USER_DEFINED or
> > >> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> > >> >                         if (Arch.upper() == self.Arch.upper()) and
> > >> >(ModuleType.upper() != TAB_ARCH_COMMON):
> > >> >                             DepexList.append({(Arch,
> > ModuleType):
> > >> DepexExpr})
> > >> >                     else:
> > >> >@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
> > >> >                             DepexList.append({(Arch,
> > ModuleType):
> > >> DepexExpr})
> > >> >
> > >> >         #the type of build module is USER_DEFINED.
> > >> >-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
> > >> >+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED
> > or
> > >> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> > >> >             for Depex in DepexList:
> > >> >                 for key in Depex:
> > >> >                     DepexStr += '[Depex.%s.%s]\n' % key
> > >> >@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
> > >> >
> > >> >         for ModuleType in self.DepexList:
> > >> >             # Ignore empty [depex] section or [depex] section for
> > >> >SUP_MODULE_USER_DEFINED module
> > >> >-            if len(self.DepexList[ModuleType]) == 0 or ModuleType
> > ==
> > >> >SUP_MODULE_USER_DEFINED:
> > >> >+            if len(self.DepexList[ModuleType]) == 0 or ModuleType
> > ==
> > >> >SUP_MODULE_USER_DEFINED or ModuleType ==
> > >> >SUP_MODULE_HOST_APPLICATION:
> > >> >                 continue
> > >> >
> > >> >             Dpx =
> > >> GenDepex.DependencyExpression(self.DepexList[ModuleType],
> > >> >ModuleType, True)
> > >> >diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
> > >> >b/BaseTools/Source/Python/AutoGen/GenC.py
> > >> >index b527295c0253..4cb776206e90 100644
> > >> >--- a/BaseTools/Source/Python/AutoGen/GenC.py
> > >> >+++ b/BaseTools/Source/Python/AutoGen/GenC.py
> > >> >@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
> > >> >     SUP_MODULE_SMM_CORE          :   ["PiDxe.h",
> > >> "Library/BaseLib.h",
> > >> >"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
> > >> >     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h",
> > >> "Library/BaseLib.h",
> > >> >"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
> > >> >     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h",
> > >> "Library/BaseLib.h",
> > >> >"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
> > >> >-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> > >> >"Library/DebugLib.h"]
> > >> >+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> > >> >"Library/DebugLib.h"],
> > >> >+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile,
> > >> >"Library/DebugLib.h"]
> > >> > }
> > >> >
> > >> > ## Autogen internal worker macro to define DynamicEx PCD name
> > >includes
> > >> >both the TokenSpaceGuidName
> > >> >@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info,
> > >> AutoGenC,
> > >> >AutoGenH):
> > >> >         if Lib.ModuleType in [SUP_MODULE_BASE,
> > SUP_MODULE_SEC]:
> > >> >
> > >> >ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MO
> > D
> > >U
> > >> L
> > >> >E_BASE].Replace(Dict))
> > >> >
> > >> >ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BA
> > SE]
> > >> .R
> > >> >eplace(Dict))
> > >> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> > >> >SUP_MODULE_USER_DEFINED]:
> > >> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> > >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> > >> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> > >> >
> > >> >ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Re
> > pl
> > >a
> > >> ce
> > >> >(Dict))
> > >> >
> > >> >ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict
> > ))
> > >> >@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info,
> > >> AutoGenC,
> > >> >AutoGenH):
> > >> >     if Info.IsLibrary:
> > >> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
> > >> Dict)
> > >> >     else:
> > >> >-        if Info.ModuleType in [SUP_MODULE_BASE,
> > SUP_MODULE_SEC,
> > >> >SUP_MODULE_USER_DEFINED]:
> > >> >+        if Info.ModuleType in [SUP_MODULE_BASE,
> > >> SUP_MODULE_SEC,
> > >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> > >> >
> > >> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> > >> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> > >> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> > >> >@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info,
> > >> AutoGenC,
> > >> >AutoGenH):
> > >> >         if Lib.ModuleType in [SUP_MODULE_BASE,
> > SUP_MODULE_SEC]:
> > >> >
> > >> >DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MO
> > D
> > >UL
> > >> E
> > >> >_BASE].Replace(Dict))
> > >> >
> > >> >DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BAS
> > E].
> > >> Re
> > >> >place(Dict))
> > >> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> > >> >SUP_MODULE_USER_DEFINED]:
> > >> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> > >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> > >> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> > >> >
> > >> >DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Repl
> > a
> > >c
> > >> e(
> > >> >Dict))
> > >> >
> > >> >DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
> > >> >@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info,
> > >> AutoGenC,
> > >> >AutoGenH):
> > >> >     if Info.IsLibrary:
> > >> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
> > >> Dict)
> > >> >     else:
> > >> >-        if Info.ModuleType in [SUP_MODULE_BASE,
> > SUP_MODULE_SEC,
> > >> >SUP_MODULE_USER_DEFINED]:
> > >> >+        if Info.ModuleType in [SUP_MODULE_BASE,
> > >> SUP_MODULE_SEC,
> > >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> > >> >
> > >> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> > >> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> > >> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> > >> >@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info,
> > >> AutoGenC,
> > >> >AutoGenH):
> > >> > #   @param      AutoGenH    The TemplateString object for
> > header
> > >> file
> > >> > #
> > >> > def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
> > >> >-    if Info.IsLibrary or Info.ModuleType in
> > >> [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_SEC]:
> > >> >+    if Info.IsLibrary or Info.ModuleType in
> > >> [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
> > >> >         return
> > >> >     #
> > >> >     # Module Entry Points
> > >> >@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info,
> > >> AutoGenC,
> > >> >AutoGenH):
> > >> > #   @param      AutoGenH    The TemplateString object for
> > header
> > >> file
> > >> > #
> > >> > def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
> > >> >-    if Info.IsLibrary or Info.ModuleType in
> > >> [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_BASE, SUP_MODULE_SEC]:
> > >> >+    if Info.IsLibrary or Info.ModuleType in
> > >> [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE,
> > >> >SUP_MODULE_SEC]:
> > >> >         return
> > >> >     #
> > >> >     # Unload Image Handlers
> > >> >@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info,
> > >> >AutoGenC, AutoGenH):
> > >> > #   @param      AutoGenH    The TemplateString object for
> > header
> > >> file
> > >> > #
> > >> > def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
> > >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_BASE]:
> > >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> > >> >         GuidType = TAB_GUID
> > >> >     else:
> > >> >         GuidType = "EFI_GUID"
> > >> >@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info,
> > AutoGenC,
> > >> >AutoGenH):
> > >> > #   @param      AutoGenH    The TemplateString object for
> > header
> > >> file
> > >> > #
> > >> > def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
> > >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_BASE]:
> > >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> > >> >         GuidType = TAB_GUID
> > >> >     else:
> > >> >         GuidType = "EFI_GUID"
> > >> >@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info,
> > >> AutoGenC,
> > >> >AutoGenH):
> > >> > #   @param      AutoGenH    The TemplateString object for
> > header
> > >> file
> > >> > #
> > >> > def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
> > >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_BASE]:
> > >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> > >> >         GuidType = TAB_GUID
> > >> >     else:
> > >> >         GuidType = "EFI_GUID"
> > >> >@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC,
> > AutoGenH):
> > >> >     # Add extern declarations to AutoGen.h if one or more Token
> > Space
> > >> GUIDs
> > >> >were found
> > >> >     if TokenSpaceList:
> > >> >         AutoGenH.Append("\n// Definition of PCD Token Space
> > GUIDs
> > >> used in
> > >> >this module\n\n")
> > >> >-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_BASE]:
> > >> >+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> > >> >             GuidType = TAB_GUID
> > >> >         else:
> > >> >             GuidType = "EFI_GUID"
> > >> >diff --git a/BaseTools/Source/Python/Common/DataType.py
> > >> >b/BaseTools/Source/Python/Common/DataType.py
> > >> >index 83ec36c2350d..8ae1bd28fabf 100644
> > >> >--- a/BaseTools/Source/Python/Common/DataType.py
> > >> >+++ b/BaseTools/Source/Python/Common/DataType.py
> > >> >@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER =
> > >> >'DXE_SMM_DRIVER'
> > >> > SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
> > >> > SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
> > >> > SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
> > >> >+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
> > >> > SUP_MODULE_SMM_CORE = 'SMM_CORE'
> > >> > SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
> > >> > SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
> > >> >
> > >> > SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC,
> > >> >SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,
> > >> SUP_MODULE_DXE_CORE,
> > >> >SUP_MODULE_DXE_DRIVER, \
> > >> >                    SUP_MODULE_DXE_RUNTIME_DRIVER,
> > >> >SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
> > >> >SUP_MODULE_UEFI_DRIVER, \
> > >> >-                   SUP_MODULE_UEFI_APPLICATION,
> > >> SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
> > >> >SUP_MODULE_MM_CORE_STANDALONE]
> > >> >+                   SUP_MODULE_UEFI_APPLICATION,
> > >> SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE,
> > >> >SUP_MODULE_MM_STANDALONE,
> > >> SUP_MODULE_MM_CORE_STANDALONE]
> > >> > SUP_MODULE_LIST_STRING =
> > TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
> > >> > SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM,
> > >> SUP_MODULE_PEI_CORE}
> > >> >
> > >> >diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> > >> >b/BaseTools/Source/Python/GenFds/FdfParser.py
> > >> >index fb5fd85e0a82..9b04a76af8c5 100644
> > >> >--- a/BaseTools/Source/Python/GenFds/FdfParser.py
> > >> >+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> > >> >@@ -3543,7 +3543,7 @@ class FdfParser:
> > >> >                 SUP_MODULE_DXE_CORE,
> > >> SUP_MODULE_DXE_DRIVER,
> > >> >                 SUP_MODULE_DXE_SAL_DRIVER,
> > >> SUP_MODULE_DXE_SMM_DRIVER,
> > >> >                 SUP_MODULE_DXE_RUNTIME_DRIVER,
> > >> SUP_MODULE_UEFI_DRIVER,
> > >> >-                SUP_MODULE_UEFI_APPLICATION,
> > >> SUP_MODULE_USER_DEFINED,
> > >> >+                SUP_MODULE_UEFI_APPLICATION,
> > >> SUP_MODULE_USER_DEFINED,
> > >> >SUP_MODULE_HOST_APPLICATION,
> > >> >                 TAB_DEFAULT, SUP_MODULE_BASE,
> > >> >                 EDK_COMPONENT_TYPE_SECURITY_CORE,
> > >> >
> > EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
> > >> >diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> > >> >b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> > >> >index cd3b0f647793..ebb93b14c4ff 100644
> > >> >--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> > >> >+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> > >> >@@ -25,6 +25,7 @@ from . import RuleComplexFile
> > >> > from CommonDataClass.FdfClass import FfsInfStatementClassObject
> > >> > from Common.MultipleWorkspace import MultipleWorkspace as mws
> > >> > from Common.DataType import SUP_MODULE_USER_DEFINED
> > >> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> > >> > from Common.StringUtils import *
> > >> > from Common.Misc import PathClass
> > >> > from Common.Misc import GuidStructureByteArrayToGuidString
> > >> >@@ -84,12 +85,12 @@ class
> > FfsInfStatement(FfsInfStatementClassObject):
> > >> >
> > >> self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1],
> > >> >[]).append(File)
> > >> >
> > >> >             # Check if current INF module has DEPEX
> > >> >-            if '.depex' not in self.FinalTargetSuffixMap and
> > >> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
> > >> >+            if '.depex' not in self.FinalTargetSuffixMap and
> > >> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and
> > >> >self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
> > >> >                 and not self.InfModule.DxsFile and not
> > >> self.InfModule.LibraryClass:
> > >> >                 ModuleType = self.InfModule.ModuleType
> > >> >                 PlatformDataBase =
> > >> >GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.Ac
> > ti
> > >v
> > >> eP
> > >> >latform, self.CurrentArch, GenFdsGlobalVariable.TargetName,
> > >> >GenFdsGlobalVariable.ToolChainTag]
> > >> >
> > >> >-                if ModuleType != SUP_MODULE_USER_DEFINED:
> > >> >+                if ModuleType != SUP_MODULE_USER_DEFINED
> > and
> > >> ModuleType !=
> > >> >SUP_MODULE_HOST_APPLICATION:
> > >> >                     for LibraryClass in
> > >> PlatformDataBase.LibraryClasses.GetKeys():
> > >> >                         if LibraryClass.startswith("NULL") and
> > >> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
> > >> >
> > >> self.InfModule.LibraryClasses[LibraryClass] =
> > >> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
> > >> >@@ -378,7 +379,7 @@ class
> > FfsInfStatement(FfsInfStatementClassObject):
> > >> >         #
> > >> >         # Only patch file if FileType is PE32 or ModuleType is
> > >> USER_DEFINED
> > >> >         #
> > >> >-        if FileType != BINARY_FILE_TYPE_PE32 and
> > self.ModuleType !=
> > >> >SUP_MODULE_USER_DEFINED:
> > >> >+        if FileType != BINARY_FILE_TYPE_PE32 and
> > self.ModuleType !=
> > >> >SUP_MODULE_USER_DEFINED and self.ModuleType !=
> > >> >SUP_MODULE_HOST_APPLICATION:
> > >> >             return EfiFile
> > >> >
> > >> >         #
> > >> >diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
> > >> >b/BaseTools/Source/Python/Workspace/InfBuildData.py
> > >> >index e66b7c983278..60970cd92836 100644
> > >> >--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
> > >> >+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
> > >> >@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
> > >> >                 EdkLogger.error('build',
> > RESOURCE_NOT_AVAILABLE,
> > >> "No [Depex]
> > >> >section or no valid expression in [Depex] section for [%s] module" \
> > >> >                                 % self.ModuleType,
> > >> File=self.MetaFile)
> > >> >
> > >> >-        if len(RecordList) != 0 and self.ModuleType ==
> > >> >SUP_MODULE_USER_DEFINED:
> > >> >+        if len(RecordList) != 0 and (self.ModuleType ==
> > >> >SUP_MODULE_USER_DEFINED or self.ModuleType ==
> > >> >SUP_MODULE_HOST_APPLICATION):
> > >> >             for Record in RecordList:
> > >> >                 if Record[4] not in [SUP_MODULE_PEIM,
> > >> SUP_MODULE_DXE_DRIVER,
> > >> >SUP_MODULE_DXE_SMM_DRIVER]:
> > >> >                     EdkLogger.error('build', FORMAT_INVALID,
> > >> >diff --git
> > a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> > >> >b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> > >> >index 0cc83110efd5..41ae684d3ee9 100644
> > >> >--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> > >> >+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> > >> >@@ -8,6 +8,7 @@
> > >> > from __future__ import absolute_import
> > >> > from collections import OrderedDict, defaultdict
> > >> > from Common.DataType import SUP_MODULE_USER_DEFINED
> > >> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> > >> > from .BuildClassObject import LibraryClassObject
> > >> > import Common.GlobalData as GlobalData
> > >> > from Workspace.BuildClassObject import StructurePcd
> > >> >@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform,
> > >> >BuildDatabase, Arch, Target, Toolcha
> > >> >     # If a module has a MODULE_TYPE of USER_DEFINED,
> > >> >     # do not link in NULL library class instances from the global
> > >> [LibraryClasses.*]
> > >> >sections.
> > >> >     #
> > >> >-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
> > >> >+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and
> > >> >Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
> > >> >         for LibraryClass in Platform.LibraryClasses.GetKeys():
> > >> >             if LibraryClass.startswith("NULL") and
> > >> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
> > >> >                 Module.LibraryClasses[LibraryClass] =
> > >> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]
> > >> >@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform,
> > >> >BuildDatabase, Arch, Target, Toolcha
> > >> >
> > >> >LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassNam
> > e,
> > >> >[ModuleType]))
> > >> >                 elif LibraryModule.LibraryClass is None \
> > >> >                      or len(LibraryModule.LibraryClass) == 0 \
> > >> >-                     or (ModuleType !=
> > >> SUP_MODULE_USER_DEFINED
> > >> >+                     or (ModuleType !=
> > >> SUP_MODULE_USER_DEFINED and
> > >> >ModuleType != SUP_MODULE_HOST_APPLICATION
> > >> >                          and ModuleType not in
> > >> >LibraryModule.LibraryClass[0].SupModList):
> > >> >                     # only USER_DEFINED can link against any
> > library
> > >> instance despite of
> > >> >its SupModList
> > >> >                     if FileName:
> > >> >--
> > >> >2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
       [not found]         ` <15AFA92770BB0C26.21445@groups.io>
@ 2019-07-12 13:13           ` Liming Gao
  0 siblings, 0 replies; 9+ messages in thread
From: Liming Gao @ 2019-07-12 13:13 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, Yao, Jiewen, Lu, XiaoyuX; +Cc: Feng, Bob C

Push @a79841a0244ab2afd1efc3b9d4cc91e27fa90d71

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Liming Gao
> Sent: Tuesday, July 9, 2019 2:26 PM
> To: Yao, Jiewen <jiewen.yao@intel.com>; Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> Cc: Feng, Bob C <bob.c.feng@intel.com>
> Subject: Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
> 
> OK. I have no other comments. Reviewed-by: Liming Gao <liming.gao@intel.com>
> 
> Thanks
> Liming
> > -----Original Message-----
> > From: Yao, Jiewen
> > Sent: Monday, July 8, 2019 10:10 AM
> > To: Gao, Liming <liming.gao@intel.com>; Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> > Cc: Feng, Bob C <bob.c.feng@intel.com>
> > Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type.
> >
> > Right. So far we just duplicate what USER_DEFINED does.
> >
> > With more and more example, we will see if and how we enhance that.
> > But it is good enough now.
> >
> > Thank you
> > Yao Jiewen
> >
> > > -----Original Message-----
> > > From: Gao, Liming
> > > Sent: Monday, July 8, 2019 9:15 AM
> > > To: Yao, Jiewen <jiewen.yao@intel.com>; Lu, XiaoyuX
> > > <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> > > Cc: Feng, Bob C <bob.c.feng@intel.com>
> > > Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> > > type.
> > >
> > > I see the change in build_rule.txt. I understand its output file is decided by
> > > this rule. Right?
> > >
> > > [Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
> > >     <InputFile>
> > >         *.lib
> > >
> > >     <ExtraDependency>
> > >         $(MAKE_FILE)
> > >
> > >     <OutputFile>
> > >         $(DEBUG_DIR)(+)$(MODULE_NAME)
> > >
> > >     <Command.MSFT, Command.INTEL>
> > >         "$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH)
> > > @$(STATIC_LIBRARY_FILES_LIST)
> > >
> > >     <Command.GCC>
> > >         "$(DLINK)" $(DLINK_FLAGS)
> > > -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group
> > > $(DLINK2_FLAGS)
> > >
> > >     <Command.RVCT>
> > >         "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via
> > > $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
> > >
> > >     <Command.RVCTCYGWIN>
> > >         #$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
> > >         "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH)
> > > $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
> > >
> > >     <Command.XCODE>
> > >         "$(DLINK)" -o ${dst} $(DLINK_FLAGS)  $(DLINK_SPATH) -filelist
> > > $(STATIC_LIBRARY_FILES_LIST)  $(DLINK2_FLAGS)
> > >
> > >
> > > Thanks
> > > Liming
> > > >-----Original Message-----
> > > >From: Yao, Jiewen
> > > >Sent: Monday, July 08, 2019 8:53 AM
> > > >To: Gao, Liming <liming.gao@intel.com>; Lu, XiaoyuX
> > > <xiaoyux.lu@intel.com>;
> > > >devel@edk2.groups.io
> > > >Cc: Feng, Bob C <bob.c.feng@intel.com>
> > > >Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> > > type.
> > > >
> > > >Currently, it is xxx.efi.
> > > >
> > > >Thank you
> > > >Yao Jiewen
> > > >
> > > >> -----Original Message-----
> > > >> From: Gao, Liming
> > > >> Sent: Monday, July 8, 2019 8:43 AM
> > > >> To: Lu, XiaoyuX <xiaoyux.lu@intel.com>; devel@edk2.groups.io
> > > >> Cc: Feng, Bob C <bob.c.feng@intel.com>; Yao, Jiewen
> > > >> <jiewen.yao@intel.com>
> > > >> Subject: RE: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> > > >> type.
> > > >>
> > > >> Xiaoyu:
> > > >>   I want to confirm what output for HOST_APPLICATION module will be
> > > >> used. Xxx.dll or xxx.efi?
> > > >>
> > > >> Thanks
> > > >> Liming
> > > >> >-----Original Message-----
> > > >> >From: Lu, XiaoyuX
> > > >> >Sent: Monday, July 01, 2019 6:13 PM
> > > >> >To: devel@edk2.groups.io
> > > >> >Cc: Lu, XiaoyuX <xiaoyux.lu@intel.com>; Feng, Bob C
> > > >> <bob.c.feng@intel.com>;
> > > >> >Gao, Liming <liming.gao@intel.com>; Yao, Jiewen
> > > >> <jiewen.yao@intel.com>
> > > >> >Subject: [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module
> > > type.
> > > >> >
> > > >> >From: Jiewen Yao <jiewen.yao@intel.com>
> > > >> >
> > > >> >It can be used to indicate a module can be build to run
> > > >> >as OS application and run in OS environment.
> > > >> >
> > > >> >Cc: Bob Feng <bob.c.feng@intel.com>
> > > >> >Cc: Liming Gao <liming.gao@intel.com>
> > > >> >Cc: Jiewen Yao <jiewen.yao@intel.com>
> > > >> >Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com>
> > > >> >---
> > > >> > BaseTools/Conf/build_rule.template            |  2 +-
> > > >> > BaseTools/Source/Python/AutoGen/AutoGen.py    |  6 ++---
> > > >> > BaseTools/Source/Python/AutoGen/GenC.py       | 23
> > > >> ++++++++++---------
> > > >> > BaseTools/Source/Python/Common/DataType.py    |  3 ++-
> > > >> > BaseTools/Source/Python/GenFds/FdfParser.py   |  2 +-
> > > >> > .../Source/Python/GenFds/FfsInfStatement.py   |  7 +++---
> > > >> > .../Source/Python/Workspace/InfBuildData.py   |  2 +-
> > > >> > .../Python/Workspace/WorkspaceCommon.py       |  5 ++--
> > > >> > 8 files changed, 27 insertions(+), 23 deletions(-)
> > > >> >
> > > >> >diff --git a/BaseTools/Conf/build_rule.template
> > > >> >b/BaseTools/Conf/build_rule.template
> > > >> >index 030e74c35a65..db06d3a6b45a 100755
> > > >> >--- a/BaseTools/Conf/build_rule.template
> > > >> >+++ b/BaseTools/Conf/build_rule.template
> > > >> >@@ -321,7 +321,7 @@
> > > >> >         "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
> > > >> >
> > > >> >
> > > >> >-[Static-Library-File.USER_DEFINED]
> > > >> >+[Static-Library-File.USER_DEFINED,
> > > >> Static-Library-File.HOST_APPLICATION]
> > > >> >     <InputFile>
> > > >> >         *.lib
> > > >> >
> > > >> >diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > > >> >b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > > >> >index e8e09dc8a366..32b5a5564827 100644
> > > >> >--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > > >> >+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > > >> >@@ -2831,7 +2831,7 @@ class ModuleAutoGen(AutoGen):
> > > >> >                     # the type of build module is USER_DEFINED.
> > > >> >                     # All different DEPEX section tags would be
> > > >> copied into the As Built
> > > >> >INF file
> > > >> >                     # and there would be separate DEPEX section
> > > >> tags
> > > >> >-                    if self.ModuleType.upper() ==
> > > >> SUP_MODULE_USER_DEFINED:
> > > >> >+                    if self.ModuleType.upper() ==
> > > >> SUP_MODULE_USER_DEFINED or
> > > >> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> > > >> >                         if (Arch.upper() == self.Arch.upper()) and
> > > >> >(ModuleType.upper() != TAB_ARCH_COMMON):
> > > >> >                             DepexList.append({(Arch,
> > > ModuleType):
> > > >> DepexExpr})
> > > >> >                     else:
> > > >> >@@ -2841,7 +2841,7 @@ class ModuleAutoGen(AutoGen):
> > > >> >                             DepexList.append({(Arch,
> > > ModuleType):
> > > >> DepexExpr})
> > > >> >
> > > >> >         #the type of build module is USER_DEFINED.
> > > >> >-        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED:
> > > >> >+        if self.ModuleType.upper() == SUP_MODULE_USER_DEFINED
> > > or
> > > >> >self.ModuleType.upper() == SUP_MODULE_HOST_APPLICATION:
> > > >> >             for Depex in DepexList:
> > > >> >                 for key in Depex:
> > > >> >                     DepexStr += '[Depex.%s.%s]\n' % key
> > > >> >@@ -4082,7 +4082,7 @@ class ModuleAutoGen(AutoGen):
> > > >> >
> > > >> >         for ModuleType in self.DepexList:
> > > >> >             # Ignore empty [depex] section or [depex] section for
> > > >> >SUP_MODULE_USER_DEFINED module
> > > >> >-            if len(self.DepexList[ModuleType]) == 0 or ModuleType
> > > ==
> > > >> >SUP_MODULE_USER_DEFINED:
> > > >> >+            if len(self.DepexList[ModuleType]) == 0 or ModuleType
> > > ==
> > > >> >SUP_MODULE_USER_DEFINED or ModuleType ==
> > > >> >SUP_MODULE_HOST_APPLICATION:
> > > >> >                 continue
> > > >> >
> > > >> >             Dpx =
> > > >> GenDepex.DependencyExpression(self.DepexList[ModuleType],
> > > >> >ModuleType, True)
> > > >> >diff --git a/BaseTools/Source/Python/AutoGen/GenC.py
> > > >> >b/BaseTools/Source/Python/AutoGen/GenC.py
> > > >> >index b527295c0253..4cb776206e90 100644
> > > >> >--- a/BaseTools/Source/Python/AutoGen/GenC.py
> > > >> >+++ b/BaseTools/Source/Python/AutoGen/GenC.py
> > > >> >@@ -776,7 +776,8 @@ gModuleTypeHeaderFile = {
> > > >> >     SUP_MODULE_SMM_CORE          :   ["PiDxe.h",
> > > >> "Library/BaseLib.h",
> > > >> >"Library/DebugLib.h", "Library/UefiDriverEntryPoint.h"],
> > > >> >     SUP_MODULE_MM_STANDALONE     :   ["PiMm.h",
> > > >> "Library/BaseLib.h",
> > > >> >"Library/DebugLib.h", "Library/StandaloneMmDriverEntryPoint.h"],
> > > >> >     SUP_MODULE_MM_CORE_STANDALONE :  ["PiMm.h",
> > > >> "Library/BaseLib.h",
> > > >> >"Library/DebugLib.h", "Library/StandaloneMmCoreEntryPoint.h"],
> > > >> >-    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> > > >> >"Library/DebugLib.h"]
> > > >> >+    SUP_MODULE_USER_DEFINED      :   [gBasicHeaderFile,
> > > >> >"Library/DebugLib.h"],
> > > >> >+    SUP_MODULE_HOST_APPLICATION  :   [gBasicHeaderFile,
> > > >> >"Library/DebugLib.h"]
> > > >> > }
> > > >> >
> > > >> > ## Autogen internal worker macro to define DynamicEx PCD name
> > > >includes
> > > >> >both the TokenSpaceGuidName
> > > >> >@@ -1339,7 +1340,7 @@ def CreateLibraryConstructorCode(Info,
> > > >> AutoGenC,
> > > >> >AutoGenH):
> > > >> >         if Lib.ModuleType in [SUP_MODULE_BASE,
> > > SUP_MODULE_SEC]:
> > > >> >
> > > >> >ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MO
> > > D
> > > >U
> > > >> L
> > > >> >E_BASE].Replace(Dict))
> > > >> >
> > > >> >ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BA
> > > SE]
> > > >> .R
> > > >> >eplace(Dict))
> > > >> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> > > >> >SUP_MODULE_USER_DEFINED]:
> > > >> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> > > >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> > > >> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> > > >> >
> > > >> >ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Re
> > > pl
> > > >a
> > > >> ce
> > > >> >(Dict))
> > > >> >
> > > >> >ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict
> > > ))
> > > >> >@@ -1368,7 +1369,7 @@ def CreateLibraryConstructorCode(Info,
> > > >> AutoGenC,
> > > >> >AutoGenH):
> > > >> >     if Info.IsLibrary:
> > > >> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
> > > >> Dict)
> > > >> >     else:
> > > >> >-        if Info.ModuleType in [SUP_MODULE_BASE,
> > > SUP_MODULE_SEC,
> > > >> >SUP_MODULE_USER_DEFINED]:
> > > >> >+        if Info.ModuleType in [SUP_MODULE_BASE,
> > > >> SUP_MODULE_SEC,
> > > >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> > > >> >
> > > >> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> > > >> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> > > >> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> > > >> >@@ -1402,7 +1403,7 @@ def CreateLibraryDestructorCode(Info,
> > > >> AutoGenC,
> > > >> >AutoGenH):
> > > >> >         if Lib.ModuleType in [SUP_MODULE_BASE,
> > > SUP_MODULE_SEC]:
> > > >> >
> > > >> >DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MO
> > > D
> > > >UL
> > > >> E
> > > >> >_BASE].Replace(Dict))
> > > >> >
> > > >> >DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BAS
> > > E].
> > > >> Re
> > > >> >place(Dict))
> > > >> >-        if Info.ModuleType not in [SUP_MODULE_BASE,
> > > >> >SUP_MODULE_USER_DEFINED]:
> > > >> >+        if Info.ModuleType not in [SUP_MODULE_BASE,
> > > >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> > > >> >             if Lib.ModuleType in SUP_MODULE_SET_PEI:
> > > >> >
> > > >> >DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Repl
> > > a
> > > >c
> > > >> e(
> > > >> >Dict))
> > > >> >
> > > >> >DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
> > > >> >@@ -1431,7 +1432,7 @@ def CreateLibraryDestructorCode(Info,
> > > >> AutoGenC,
> > > >> >AutoGenH):
> > > >> >     if Info.IsLibrary:
> > > >> >         AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}",
> > > >> Dict)
> > > >> >     else:
> > > >> >-        if Info.ModuleType in [SUP_MODULE_BASE,
> > > SUP_MODULE_SEC,
> > > >> >SUP_MODULE_USER_DEFINED]:
> > > >> >+        if Info.ModuleType in [SUP_MODULE_BASE,
> > > >> SUP_MODULE_SEC,
> > > >> >SUP_MODULE_USER_DEFINED, SUP_MODULE_HOST_APPLICATION]:
> > > >> >
> > > >> AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
> > > >> >         elif Info.ModuleType in SUP_MODULE_SET_PEI:
> > > >> >             AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
> > > >> >@@ -1449,7 +1450,7 @@ def CreateLibraryDestructorCode(Info,
> > > >> AutoGenC,
> > > >> >AutoGenH):
> > > >> > #   @param      AutoGenH    The TemplateString object for
> > > header
> > > >> file
> > > >> > #
> > > >> > def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
> > > >> >-    if Info.IsLibrary or Info.ModuleType in
> > > >> [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_SEC]:
> > > >> >+    if Info.IsLibrary or Info.ModuleType in
> > > >> [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SEC]:
> > > >> >         return
> > > >> >     #
> > > >> >     # Module Entry Points
> > > >> >@@ -1529,7 +1530,7 @@ def CreateModuleEntryPointCode(Info,
> > > >> AutoGenC,
> > > >> >AutoGenH):
> > > >> > #   @param      AutoGenH    The TemplateString object for
> > > header
> > > >> file
> > > >> > #
> > > >> > def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
> > > >> >-    if Info.IsLibrary or Info.ModuleType in
> > > >> [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_BASE, SUP_MODULE_SEC]:
> > > >> >+    if Info.IsLibrary or Info.ModuleType in
> > > >> [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE,
> > > >> >SUP_MODULE_SEC]:
> > > >> >         return
> > > >> >     #
> > > >> >     # Unload Image Handlers
> > > >> >@@ -1549,7 +1550,7 @@ def CreateModuleUnloadImageCode(Info,
> > > >> >AutoGenC, AutoGenH):
> > > >> > #   @param      AutoGenH    The TemplateString object for
> > > header
> > > >> file
> > > >> > #
> > > >> > def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
> > > >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_BASE]:
> > > >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> > > >> >         GuidType = TAB_GUID
> > > >> >     else:
> > > >> >         GuidType = "EFI_GUID"
> > > >> >@@ -1573,7 +1574,7 @@ def CreateGuidDefinitionCode(Info,
> > > AutoGenC,
> > > >> >AutoGenH):
> > > >> > #   @param      AutoGenH    The TemplateString object for
> > > header
> > > >> file
> > > >> > #
> > > >> > def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
> > > >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_BASE]:
> > > >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> > > >> >         GuidType = TAB_GUID
> > > >> >     else:
> > > >> >         GuidType = "EFI_GUID"
> > > >> >@@ -1597,7 +1598,7 @@ def CreateProtocolDefinitionCode(Info,
> > > >> AutoGenC,
> > > >> >AutoGenH):
> > > >> > #   @param      AutoGenH    The TemplateString object for
> > > header
> > > >> file
> > > >> > #
> > > >> > def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
> > > >> >-    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_BASE]:
> > > >> >+    if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> > > >> >         GuidType = TAB_GUID
> > > >> >     else:
> > > >> >         GuidType = "EFI_GUID"
> > > >> >@@ -1634,7 +1635,7 @@ def CreatePcdCode(Info, AutoGenC,
> > > AutoGenH):
> > > >> >     # Add extern declarations to AutoGen.h if one or more Token
> > > Space
> > > >> GUIDs
> > > >> >were found
> > > >> >     if TokenSpaceList:
> > > >> >         AutoGenH.Append("\n// Definition of PCD Token Space
> > > GUIDs
> > > >> used in
> > > >> >this module\n\n")
> > > >> >-        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_BASE]:
> > > >> >+        if Info.ModuleType in [SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_BASE]:
> > > >> >             GuidType = TAB_GUID
> > > >> >         else:
> > > >> >             GuidType = "EFI_GUID"
> > > >> >diff --git a/BaseTools/Source/Python/Common/DataType.py
> > > >> >b/BaseTools/Source/Python/Common/DataType.py
> > > >> >index 83ec36c2350d..8ae1bd28fabf 100644
> > > >> >--- a/BaseTools/Source/Python/Common/DataType.py
> > > >> >+++ b/BaseTools/Source/Python/Common/DataType.py
> > > >> >@@ -66,13 +66,14 @@ SUP_MODULE_DXE_SMM_DRIVER =
> > > >> >'DXE_SMM_DRIVER'
> > > >> > SUP_MODULE_UEFI_DRIVER = 'UEFI_DRIVER'
> > > >> > SUP_MODULE_UEFI_APPLICATION = 'UEFI_APPLICATION'
> > > >> > SUP_MODULE_USER_DEFINED = 'USER_DEFINED'
> > > >> >+SUP_MODULE_HOST_APPLICATION = 'HOST_APPLICATION'
> > > >> > SUP_MODULE_SMM_CORE = 'SMM_CORE'
> > > >> > SUP_MODULE_MM_STANDALONE = 'MM_STANDALONE'
> > > >> > SUP_MODULE_MM_CORE_STANDALONE = 'MM_CORE_STANDALONE'
> > > >> >
> > > >> > SUP_MODULE_LIST = [SUP_MODULE_BASE, SUP_MODULE_SEC,
> > > >> >SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM,
> > > >> SUP_MODULE_DXE_CORE,
> > > >> >SUP_MODULE_DXE_DRIVER, \
> > > >> >                    SUP_MODULE_DXE_RUNTIME_DRIVER,
> > > >> >SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DXE_SMM_DRIVER,
> > > >> >SUP_MODULE_UEFI_DRIVER, \
> > > >> >-                   SUP_MODULE_UEFI_APPLICATION,
> > > >> SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE,
> > > >> >SUP_MODULE_MM_CORE_STANDALONE]
> > > >> >+                   SUP_MODULE_UEFI_APPLICATION,
> > > >> SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_HOST_APPLICATION, SUP_MODULE_SMM_CORE,
> > > >> >SUP_MODULE_MM_STANDALONE,
> > > >> SUP_MODULE_MM_CORE_STANDALONE]
> > > >> > SUP_MODULE_LIST_STRING =
> > > TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
> > > >> > SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM,
> > > >> SUP_MODULE_PEI_CORE}
> > > >> >
> > > >> >diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> > > >> >b/BaseTools/Source/Python/GenFds/FdfParser.py
> > > >> >index fb5fd85e0a82..9b04a76af8c5 100644
> > > >> >--- a/BaseTools/Source/Python/GenFds/FdfParser.py
> > > >> >+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> > > >> >@@ -3543,7 +3543,7 @@ class FdfParser:
> > > >> >                 SUP_MODULE_DXE_CORE,
> > > >> SUP_MODULE_DXE_DRIVER,
> > > >> >                 SUP_MODULE_DXE_SAL_DRIVER,
> > > >> SUP_MODULE_DXE_SMM_DRIVER,
> > > >> >                 SUP_MODULE_DXE_RUNTIME_DRIVER,
> > > >> SUP_MODULE_UEFI_DRIVER,
> > > >> >-                SUP_MODULE_UEFI_APPLICATION,
> > > >> SUP_MODULE_USER_DEFINED,
> > > >> >+                SUP_MODULE_UEFI_APPLICATION,
> > > >> SUP_MODULE_USER_DEFINED,
> > > >> >SUP_MODULE_HOST_APPLICATION,
> > > >> >                 TAB_DEFAULT, SUP_MODULE_BASE,
> > > >> >                 EDK_COMPONENT_TYPE_SECURITY_CORE,
> > > >> >
> > > EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER,
> > > >> >diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> > > >> >b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> > > >> >index cd3b0f647793..ebb93b14c4ff 100644
> > > >> >--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> > > >> >+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
> > > >> >@@ -25,6 +25,7 @@ from . import RuleComplexFile
> > > >> > from CommonDataClass.FdfClass import FfsInfStatementClassObject
> > > >> > from Common.MultipleWorkspace import MultipleWorkspace as mws
> > > >> > from Common.DataType import SUP_MODULE_USER_DEFINED
> > > >> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> > > >> > from Common.StringUtils import *
> > > >> > from Common.Misc import PathClass
> > > >> > from Common.Misc import GuidStructureByteArrayToGuidString
> > > >> >@@ -84,12 +85,12 @@ class
> > > FfsInfStatement(FfsInfStatementClassObject):
> > > >> >
> > > >> self.FinalTargetSuffixMap.setdefault(os.path.splitext(File)[1],
> > > >> >[]).append(File)
> > > >> >
> > > >> >             # Check if current INF module has DEPEX
> > > >> >-            if '.depex' not in self.FinalTargetSuffixMap and
> > > >> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED \
> > > >> >+            if '.depex' not in self.FinalTargetSuffixMap and
> > > >> >self.InfModule.ModuleType != SUP_MODULE_USER_DEFINED and
> > > >> >self.InfModule.ModuleType != SUP_MODULE_HOST_APPLICATION \
> > > >> >                 and not self.InfModule.DxsFile and not
> > > >> self.InfModule.LibraryClass:
> > > >> >                 ModuleType = self.InfModule.ModuleType
> > > >> >                 PlatformDataBase =
> > > >> >GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.Ac
> > > ti
> > > >v
> > > >> eP
> > > >> >latform, self.CurrentArch, GenFdsGlobalVariable.TargetName,
> > > >> >GenFdsGlobalVariable.ToolChainTag]
> > > >> >
> > > >> >-                if ModuleType != SUP_MODULE_USER_DEFINED:
> > > >> >+                if ModuleType != SUP_MODULE_USER_DEFINED
> > > and
> > > >> ModuleType !=
> > > >> >SUP_MODULE_HOST_APPLICATION:
> > > >> >                     for LibraryClass in
> > > >> PlatformDataBase.LibraryClasses.GetKeys():
> > > >> >                         if LibraryClass.startswith("NULL") and
> > > >> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
> > > >> >
> > > >> self.InfModule.LibraryClasses[LibraryClass] =
> > > >> >PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]
> > > >> >@@ -378,7 +379,7 @@ class
> > > FfsInfStatement(FfsInfStatementClassObject):
> > > >> >         #
> > > >> >         # Only patch file if FileType is PE32 or ModuleType is
> > > >> USER_DEFINED
> > > >> >         #
> > > >> >-        if FileType != BINARY_FILE_TYPE_PE32 and
> > > self.ModuleType !=
> > > >> >SUP_MODULE_USER_DEFINED:
> > > >> >+        if FileType != BINARY_FILE_TYPE_PE32 and
> > > self.ModuleType !=
> > > >> >SUP_MODULE_USER_DEFINED and self.ModuleType !=
> > > >> >SUP_MODULE_HOST_APPLICATION:
> > > >> >             return EfiFile
> > > >> >
> > > >> >         #
> > > >> >diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py
> > > >> >b/BaseTools/Source/Python/Workspace/InfBuildData.py
> > > >> >index e66b7c983278..60970cd92836 100644
> > > >> >--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
> > > >> >+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
> > > >> >@@ -748,7 +748,7 @@ class InfBuildData(ModuleBuildClassObject):
> > > >> >                 EdkLogger.error('build',
> > > RESOURCE_NOT_AVAILABLE,
> > > >> "No [Depex]
> > > >> >section or no valid expression in [Depex] section for [%s] module" \
> > > >> >                                 % self.ModuleType,
> > > >> File=self.MetaFile)
> > > >> >
> > > >> >-        if len(RecordList) != 0 and self.ModuleType ==
> > > >> >SUP_MODULE_USER_DEFINED:
> > > >> >+        if len(RecordList) != 0 and (self.ModuleType ==
> > > >> >SUP_MODULE_USER_DEFINED or self.ModuleType ==
> > > >> >SUP_MODULE_HOST_APPLICATION):
> > > >> >             for Record in RecordList:
> > > >> >                 if Record[4] not in [SUP_MODULE_PEIM,
> > > >> SUP_MODULE_DXE_DRIVER,
> > > >> >SUP_MODULE_DXE_SMM_DRIVER]:
> > > >> >                     EdkLogger.error('build', FORMAT_INVALID,
> > > >> >diff --git
> > > a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> > > >> >b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> > > >> >index 0cc83110efd5..41ae684d3ee9 100644
> > > >> >--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> > > >> >+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
> > > >> >@@ -8,6 +8,7 @@
> > > >> > from __future__ import absolute_import
> > > >> > from collections import OrderedDict, defaultdict
> > > >> > from Common.DataType import SUP_MODULE_USER_DEFINED
> > > >> >+from Common.DataType import SUP_MODULE_HOST_APPLICATION
> > > >> > from .BuildClassObject import LibraryClassObject
> > > >> > import Common.GlobalData as GlobalData
> > > >> > from Workspace.BuildClassObject import StructurePcd
> > > >> >@@ -94,7 +95,7 @@ def GetModuleLibInstances(Module, Platform,
> > > >> >BuildDatabase, Arch, Target, Toolcha
> > > >> >     # If a module has a MODULE_TYPE of USER_DEFINED,
> > > >> >     # do not link in NULL library class instances from the global
> > > >> [LibraryClasses.*]
> > > >> >sections.
> > > >> >     #
> > > >> >-    if Module.ModuleType != SUP_MODULE_USER_DEFINED:
> > > >> >+    if Module.ModuleType != SUP_MODULE_USER_DEFINED and
> > > >> >Module.ModuleType != SUP_MODULE_HOST_APPLICATION:
> > > >> >         for LibraryClass in Platform.LibraryClasses.GetKeys():
> > > >> >             if LibraryClass.startswith("NULL") and
> > > >> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
> > > >> >                 Module.LibraryClasses[LibraryClass] =
> > > >> >Platform.LibraryClasses[LibraryClass, Module.ModuleType]
> > > >> >@@ -137,7 +138,7 @@ def GetModuleLibInstances(Module, Platform,
> > > >> >BuildDatabase, Arch, Target, Toolcha
> > > >> >
> > > >> >LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassNam
> > > e,
> > > >> >[ModuleType]))
> > > >> >                 elif LibraryModule.LibraryClass is None \
> > > >> >                      or len(LibraryModule.LibraryClass) == 0 \
> > > >> >-                     or (ModuleType !=
> > > >> SUP_MODULE_USER_DEFINED
> > > >> >+                     or (ModuleType !=
> > > >> SUP_MODULE_USER_DEFINED and
> > > >> >ModuleType != SUP_MODULE_HOST_APPLICATION
> > > >> >                          and ModuleType not in
> > > >> >LibraryModule.LibraryClass[0].SupModList):
> > > >> >                     # only USER_DEFINED can link against any
> > > library
> > > >> instance despite of
> > > >> >its SupModList
> > > >> >                     if FileName:
> > > >> >--
> > > >> >2.17.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-07-12 13:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-01 10:13 [PATCH v1 1/1] BaseTools: Add HOST_APPLICATION module type Xiaoyu Lu
2019-07-01 10:17 ` Liming Gao
2019-07-03  8:41   ` Xiaoyu Lu
2019-07-08  0:43 ` Liming Gao
2019-07-08  0:53   ` Yao, Jiewen
2019-07-08  1:14     ` Liming Gao
2019-07-08  2:09       ` Yao, Jiewen
2019-07-09  6:26         ` Liming Gao
     [not found]         ` <15AFA92770BB0C26.21445@groups.io>
2019-07-12 13:13           ` [edk2-devel] " Liming Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox