public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Problems with FDF for OptionROM when using GCC
@ 2018-10-02 13:09 Tomas Pilar (tpilar)
  2018-10-02 13:43 ` Tomas Pilar (tpilar)
  0 siblings, 1 reply; 2+ messages in thread
From: Tomas Pilar (tpilar) @ 2018-10-02 13:09 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Hi,

I am trying to move the OptionROM flash specification in my package to a FDF file. I use the following snippet to define the OptionROM:

[Defines]
  FDF_VERSION = 0x00000100
  FDF_SPECIFICATION = 0x0001001B
 
[OptionROM.SfcNicDriver]
  INF USE = $(ARCH) SfcPkg/SfcNicDriver/SfcNicDriver.inf {
    PCI_VENDOR_ID             = 0x1924
    PCI_DEVICE_ID             = 0x0903
    PCI_CLASS_CODE            = 0x02 # Network Controller
    PCI_REVISION              = 0x00 # Vendor defined Revision ID
    PCI_COMPRESS              = TRUE
  }

which results in a

error F003: Don't Find common rule RULE.COMMON.UEFI_DRIVER for INF SfcPkg/SfcNicDriver/SfcNicDriver.inf

so then I cargo cult copy an example rule from FDF:

[Rule.Common.UEFI_DRIVER]
FILE DRIVER = $(NAMED_GUID) {
  COMPRESS PI_STD {
    GUIDED {
      PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
      UI STRING = "$(MODULE_NAME)" Optional
      VERSION STRING = "$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
    }
  }
}

which results in the following error:

GenFds.py...
 : error C0DE: Tools code failure
        Please send email to edk2-devel@lists.01.org for help, attaching following call stack trace!

Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/local/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/GenFds.py", line 735, in <module>
    r = main()
  File "/local/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/GenFds.py", line 356, in main
    RaiseError=False
  File "/home/tp/sauce/uefi/BuildTree/BaseTools/Source/Python/Common/EdkLogger.py", line 203, in error
    raise FatalError(ErrorCode)
Common.BuildToolError.FatalError: 49374


build.py...
 : error 7000: Failed to execute command
        GenFds -f /home/tp/sauce/uefi/BuildTree/SfcPkg/SfcPkg.fdf --conf=/home/tp/sauce/uefi/BuildTree/Conf -o /home/tp/sauce/uefi/BuildTree/Build/SfcPkg/DEBUG_GCC49 -t GCC49 -b DEBUG -p /home/tp/sauce/uefi/BuildTree/SfcPkg/SfcPkg.dsc -a X64 -D "EFI_SOURCE=/home/tp/sauce/uefi/BuildTree/EdkCompatibilityPkg" -D "EDK_SOURCE=/home/tp/sauce/uefi/BuildTree/EdkCompatibilityPkg" -D "TOOL_CHAIN_TAG=GCC49" -D "TOOLCHAIN=GCC49" -D "TARGET=DEBUG" -D "FAMILY=GCC" -D "WORKSPACE=/home/tp/sauce/uefi/BuildTree" -D "EDK_TOOLS_PATH=/home/tp/sauce/uefi/BuildTree/BaseTools" -D "ARCH=X64" -D "ECP_SOURCE=/home/tp/sauce/uefi/BuildTree/EdkCompatibilityPkg" [/local/sauce/uefi/BuildTree]

- Failed -
Build end time: 14:07:26, Oct.02 2018
Build total time: 00:00:04

Help?


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

* Re: Problems with FDF for OptionROM when using GCC
  2018-10-02 13:09 Problems with FDF for OptionROM when using GCC Tomas Pilar (tpilar)
@ 2018-10-02 13:43 ` Tomas Pilar (tpilar)
  0 siblings, 0 replies; 2+ messages in thread
From: Tomas Pilar (tpilar) @ 2018-10-02 13:43 UTC (permalink / raw)
  To: edk2-devel

So the solution turns out to swap the Compress and Guided around, Compress apparently requires a LeafSection while Guided is happy to contain EncapSection. Odd.

Anyway, I had to hack up GenFds to get a sensible python backtrace:

      1 diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
      2 index 9dec9c5eb5..adcadce5a5 100644
      3 --- a/BaseTools/Source/Python/GenFds/GenFds.py
      4 +++ b/BaseTools/Source/Python/GenFds/GenFds.py
      5 @@ -348,6 +348,7 @@ def main():
      6          ReturnCode = X.args[0]
      7      except:
      8          import traceback
      9 +        raise^M
     10          EdkLogger.error(
     11                      "\nPython",
     12                      CODE_ERROR,

to get

Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/local/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/GenFds.py", line 736, in <module>
    r = main()
  File "/local/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/GenFds.py", line 333, in main
    GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)
  File "/local/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/GenFds.py", line 473, in GenFd
    OptRomObj.AddToBuffer(None)
  File "/home/tp/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/OptionRom.py", line 62, in AddToBuffer
    FilePathNameList = FfsFile.GenFfs(IsMakefile=Flag)
  File "/home/tp/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/OptRomInfStatement.py", line 105, in GenFfs
    EfiOutputList = self.__GenComplexFileSection__(Rule, IsMakefile=IsMakefile)
  File "/home/tp/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/OptRomInfStatement.py", line 143, in __GenComplexFileSection__
    if Sect.SectionType == BINARY_FILE_TYPE_PE32:
AttributeError: CompressSection instance has no attribute 'SectionType'

which is a much more helpful backtrace than what the logger was producing.

I assume I have misconfigured my EdkLogger somehow, or forgot some runes? Has anyone else had a similar experience?

Cheers,
Tom

On 02/10/18 14:09, Tomas Pilar (tpilar) wrote:
> Hi,
>
> I am trying to move the OptionROM flash specification in my package to a FDF file. I use the following snippet to define the OptionROM:
>
> [Defines]
>   FDF_VERSION = 0x00000100
>   FDF_SPECIFICATION = 0x0001001B
>  
> [OptionROM.SfcNicDriver]
>   INF USE = $(ARCH) SfcPkg/SfcNicDriver/SfcNicDriver.inf {
>     PCI_VENDOR_ID             = 0x1924
>     PCI_DEVICE_ID             = 0x0903
>     PCI_CLASS_CODE            = 0x02 # Network Controller
>     PCI_REVISION              = 0x00 # Vendor defined Revision ID
>     PCI_COMPRESS              = TRUE
>   }
>
> which results in a
>
> error F003: Don't Find common rule RULE.COMMON.UEFI_DRIVER for INF SfcPkg/SfcNicDriver/SfcNicDriver.inf
>
> so then I cargo cult copy an example rule from FDF:
>
> [Rule.Common.UEFI_DRIVER]
> FILE DRIVER = $(NAMED_GUID) {
>   COMPRESS PI_STD {
>     GUIDED {
>       PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
>       UI STRING = "$(MODULE_NAME)" Optional
>       VERSION STRING = "$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
>     }
>   }
> }
>
> which results in the following error:
>
> GenFds.py...
>  : error C0DE: Tools code failure
>         Please send email to edk2-devel@lists.01.org for help, attaching following call stack trace!
>
> Traceback (most recent call last):
>   File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
>     "__main__", fname, loader, pkg_name)
>   File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
>     exec code in run_globals
>   File "/local/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/GenFds.py", line 735, in <module>
>     r = main()
>   File "/local/sauce/uefi/BuildTree/BaseTools/Source/Python/GenFds/GenFds.py", line 356, in main
>     RaiseError=False
>   File "/home/tp/sauce/uefi/BuildTree/BaseTools/Source/Python/Common/EdkLogger.py", line 203, in error
>     raise FatalError(ErrorCode)
> Common.BuildToolError.FatalError: 49374
>
>
> build.py...
>  : error 7000: Failed to execute command
>         GenFds -f /home/tp/sauce/uefi/BuildTree/SfcPkg/SfcPkg.fdf --conf=/home/tp/sauce/uefi/BuildTree/Conf -o /home/tp/sauce/uefi/BuildTree/Build/SfcPkg/DEBUG_GCC49 -t GCC49 -b DEBUG -p /home/tp/sauce/uefi/BuildTree/SfcPkg/SfcPkg.dsc -a X64 -D "EFI_SOURCE=/home/tp/sauce/uefi/BuildTree/EdkCompatibilityPkg" -D "EDK_SOURCE=/home/tp/sauce/uefi/BuildTree/EdkCompatibilityPkg" -D "TOOL_CHAIN_TAG=GCC49" -D "TOOLCHAIN=GCC49" -D "TARGET=DEBUG" -D "FAMILY=GCC" -D "WORKSPACE=/home/tp/sauce/uefi/BuildTree" -D "EDK_TOOLS_PATH=/home/tp/sauce/uefi/BuildTree/BaseTools" -D "ARCH=X64" -D "ECP_SOURCE=/home/tp/sauce/uefi/BuildTree/EdkCompatibilityPkg" [/local/sauce/uefi/BuildTree]
>
> - Failed -
> Build end time: 14:07:26, Oct.02 2018
> Build total time: 00:00:04
>
> Help?
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



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

end of thread, other threads:[~2018-10-02 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-02 13:09 Problems with FDF for OptionROM when using GCC Tomas Pilar (tpilar)
2018-10-02 13:43 ` Tomas Pilar (tpilar)

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