public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: "KarunakarPoosapalli@Dell.com" <KarunakarPoosapalli@Dell.com>,
	"Gao, Liming" <liming.gao@intel.com>,
	"lersek@redhat.com" <lersek@redhat.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Sumanth.Vidyadhara@dell.com" <Sumanth.Vidyadhara@dell.com>,
	"Shekar.Babu.S@dell.com" <Shekar.Babu.S@dell.com>,
	"Gao, Liming" <liming.gao@intel.com>,
	"Sriramkumar.Raju@dell.com" <Sriramkumar.Raju@dell.com>
Subject: Re: Conditional Compilation support in INF file
Date: Fri, 11 Jan 2019 18:54:18 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5B8B7E08C@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <524c6b9c19b34d3680f709e6f0b2e68b@BLRX13MDC432.AMER.DELL.COM>

Karunakar,

Feature Flag Expressions is a concept that is defined in the
specs, but is a feature that is not fully implemented.  Liming
should be able to provide details on what has been implemented
and validated in BaseTools.  I think the reason that this feature
has not been implemented fully is that we have been able to find
alternate ways to get the equivalent results.  Here are a few
example techniques:

3a: One approach is to use multiple INF files and select the
    Right INF for different types of platform builds in DSC file.
    If multiple modules share source files but have different
    elements produced/consumed/depex, then multiple INF
    file is an approach that makes the produced/consumed/depex
    clear and is compatible with UDP Spec.

3c: One approach is to use DEBUG_CODE(), DEBUG_CODE_BEGIN(),
    and DEBUG_CODE_END() macros in a single version of the
    source files and enable/disable the debug code using BIT2
    in the following PCD:

  ## The mask is used to control DebugLib behavior.<BR><BR>
  #  BIT0 - Enable Debug Assert.<BR>
  #  BIT1 - Enable Debug Print.<BR>
  #  BIT2 - Enable Debug Code.<BR>
  #  BIT3 - Enable Clear Memory.<BR>
  #  BIT4 - Enable BreakPoint as ASSERT.<BR>
  #  BIT5 - Enable DeadLoop as ASSERT.<BR>
  # @Prompt Debug Property.
  # @Expression  0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005

3c: Another approach is to use multiple INF files and select
    the one needed for debug/release in DSC file.

If these techniques, or other techniques that other community
Member may be using do not work for your use cases, and 
Feature Flag Expressions are the best approach, then Bugzillas
Can be entered with supporting use cases to justify adding the
feature to BaseTools.

Thanks,
 
Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-
> bounces@lists.01.org] On Behalf Of
> KarunakarPoosapalli@Dell.com
> Sent: Thursday, January 10, 2019 10:34 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; Gao,
> Liming <liming.gao@intel.com>; lersek@redhat.com; edk2-
> devel@lists.01.org
> Cc: Sumanth.Vidyadhara@dell.com; Shekar.Babu.S@dell.com;
> Gao, Liming <liming.gao@intel.com>;
> Sriramkumar.Raju@dell.com
> Subject: Re: [edk2] Conditional Compilation support in
> INF file
> 
> Hi All,
> 
> Thank you very much for your valuable thoughts.
> Below are my concerns/thoughts, Could you please help on
> 
> 1. Is there any module or INF already using
> FeatureFlagExpression feature support in current edk2
> source?
> 2. If not, could you please help in providing more
> detailed spec/Doc to verify this support.
> 3. Below are the few of use cases we're looking for, Did
> really FeatureFlagExpression support all of this?
>    		a.	If we've this support we can add different
> protocols in DEPEX section, like we can put condition
> check and add rotococol1 for Notebook and Protocol2 for
> Desktop.
> 		b.           Help in simplifying build files. We
> could dispense with the prefix to inf files and more
> developer convenient.
> 		c.	Sometimes we would like to add Conditional  .C
> and .H for file inclusion. Helps in our Debug / release
> builds as well..
> 				Example; we do have release and debug
> build, although Source Section has - IA32,X64, Common,
> IPF, EBC exclusively.
> 					  But for the same Source section, we
> can't have choices based on our build inputs...
> 
>         						#if Condition1
>              						  [Sources]
>                					    Main.c
>       						#elif Condition2
>               						 [Sources]
>                    					    DebugMain.c
> 
> 4. I don't think INF file support MACRO support, How
> complex in modifying the BaseTools to support Condition
> checks and MACRO support?
> 
> Thanks & Regards,
> Karunakar
> 
> -----Original Message-----
> From: Kinney, Michael D
> [mailto:michael.d.kinney@intel.com]
> Sent: Thursday, January 10, 2019 10:23 PM
> To: Gao, Liming; Laszlo Ersek; Poosapalli, Karunakar;
> edk2-devel@lists.01.org; Kinney, Michael D
> Cc: Vidyadhara, Sumanth; Gao, Liming; Raju, SriramKumar
> Subject: RE: [edk2] Conditional Compilation support in
> INF file
> 
> 
> [EXTERNAL EMAIL]
> 
> There is one additional constraint for adding
> conditionals to INF files.
> 
> The UEFI Distribution Packaging Specification defines a
> format to share package and module content in a standard
> format and uses an XML schema for the metadata.  We need
> to be able to convert between INF <--> XML and DEC <-->
> XML.
> 
> http://www.uefi.org/sites/default/files/resources/Dist_P
> ackage_Spec_1_1.pdf
> 
> If we define extensions to INF or DEC files, we need to
> make sure these transforms are still supported.  If an
> extension prevents these transforms, then we either need
> to change the extension to be compatible or work on an
> update to the UDP spec to support the extension in the
> XML.
> 
> Best regards,
> 
> Mike
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-
> > bounces@lists.01.org] On Behalf Of Gao, Liming
> > Sent: Thursday, January 10, 2019 7:48 AM
> > To: Laszlo Ersek <lersek@redhat.com>;
> > KarunakarPoosapalli@Dell.com; edk2-devel@lists.01.org
> > Cc: Sumanth.Vidyadhara@dell.com; Gao, Liming
> <liming.gao@intel.com>;
> > Sriramkumar.Raju@dell.com
> > Subject: Re: [edk2] Conditional Compilation support in
> INF file
> >
> > I have same question. What flexibility is expected in
> INF? I see one
> > request in [Depex] section. So, PCD support in [Depex]
> is added.
> >
> > Edk2 INF is used to describe the source code behavior.
> > If the source uses Ppi/Protocol/Guid/Pcd, these
> information are always
> > required to be described in INF file. The compiler can
> optimize the
> > code and remove the unused Ppi/Protocol/Guid/Pcd. It
> doesn't need
> > developer specify the conditional statement.
> >
> > Thanks
> > Liming
> > > -----Original Message-----
> > > From: Laszlo Ersek [mailto:lersek@redhat.com]
> > > Sent: Thursday, January 10, 2019 8:54 PM
> > > To: KarunakarPoosapalli@Dell.com; Gao, Liming
> > <liming.gao@intel.com>; edk2-devel@lists.01.org
> > > Cc: Sumanth.Vidyadhara@dell.com;
> > Sriramkumar.Raju@dell.com
> > > Subject: Re: [edk2] Conditional Compilation support
> in
> > INF file
> > >
> > > On 01/10/19 07:03, KarunakarPoosapalli@Dell.com
> wrote:
> > > > Hi All,
> > > >
> > > > I agree with providing the support like
> > "FixedAtBuild PCD in INF". And we need to modify or
> provide support in
> > BaseTools to support
> > > this feature.
> > > >
> > > > There are more use cases or flexibility to
> developer
> > if we support Conditional compilation support in INF.
> > > > As we're providing support in BaseTools for
> > FixedAtBuild PCD support in INF, Is there any
> challenges or drawbacks
> > in  providing
> > > conditional compilation support in INF?
> > >
> > > This is not for me to say authoritatively, but I'm
> > unaware of any
> > > specific use case that cannot be solved without this
> > feature addition,
> > > and any further complexity to BaseTools should be
> > strongly justified.
> > > "More convenient" is too vague for me, and the
> > BaseTools code is already
> > > hard to read and debug.
> > >
> > > That's just my opinion, again.
> > >
> > > Thanks
> > > Laszlo
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2019-01-11 18:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09  6:55 Conditional Compilation support in INF file KarunakarPoosapalli
2019-01-09 11:00 ` Laszlo Ersek
2019-01-09 12:42   ` Gao, Liming
2019-01-09 14:37     ` Laszlo Ersek
2019-01-10  6:03     ` KarunakarPoosapalli
2019-01-10 12:54       ` Laszlo Ersek
2019-01-10 15:48         ` Gao, Liming
2019-01-10 16:53           ` Kinney, Michael D
2019-01-11  6:33             ` KarunakarPoosapalli
2019-01-11 18:54               ` Kinney, Michael D [this message]
2019-01-15 15:10                 ` Gao, Liming
2019-01-28  7:50                   ` KarunakarPoosapalli
2019-01-28  8:36                   ` KarunakarPoosapalli
2019-01-31  6:56                     ` Gao, Liming
2019-01-31 16:26                       ` stephano
2019-02-01 10:52                         ` KarunakarPoosapalli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E92EE9817A31E24EB0585FDF735412F5B8B7E08C@ORSMSX113.amr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox