public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Andrew Fish <afish@apple.com>
To: Peter Hornyack <peterhornyack@google.com>
Cc: edk2-devel@lists.01.org
Subject: Re: Pull in pre-built library during edk2 build?
Date: Thu, 06 Apr 2017 11:57:10 -0700	[thread overview]
Message-ID: <C94FC8CF-5728-4C27-B53A-695431661A19@apple.com> (raw)
In-Reply-To: <CA+0KQ4MrXHfAoLmxyvaaEpVTekryxOZJXB9Be1UkXn6UhEBwZw@mail.gmail.com>


> On Apr 6, 2017, at 11:07 AM, Peter Hornyack <peterhornyack@google.com> wrote:
> 
> I'd like to make an adjustment to the edk2 build (locally, not for
> upstream) and I'm hoping someone can offer some guidance.
> 
> My goal is to pre-build an edk2 library in a separate build process,
> then pull that library into the full build later on. Specifically I'm
> building my firmware image using OvmfPkgX64.dsc, but I want to build
> OpensslLib (CryptoPkg/Library/OpensslLib/OpensslLib.inf) in advance,
> then pull the resulting lib into the full build later. How can I
> achieve this?
> 
> In my build output I can see that when OpensslLib.inf is built, all of
> the openssl .c files are compiled into .obj files, then an ar command
> wraps those up into OpensslLib.lib. I want to pull those steps out and
> pre-build OpensslLib.lib, but I've been unable to find where/how the
> edk2 build grabs that .lib file and turns it into the final firmware
> image. I've reviewed the edk2 build documentation but still can't
> figure this out. Can anyone point me to the right place in the edk2
> build files where I can make this happen? Or perhaps is there an
> example of this already in the edk2 build that I can imitate?
> 

Peter,

https://github.com/tianocore/edk2/blob/master/BaseTools/Conf/build_rule.template <https://github.com/tianocore/edk2/blob/master/BaseTools/Conf/build_rule.template> gets copied to Cont/build_rule.txt and these are the rules use to build the makefiles. 

In your INF file you can add a [BuildOptions] section and use that to modify the compiler, linker flags, etc for your module. 

This is the horrific example of what is possible:
https://github.com/tianocore/edk2/blob/master/EmulatorPkg/Unix/Host/Host.inf#L118 <https://github.com/tianocore/edk2/blob/master/EmulatorPkg/Unix/Host/Host.inf#L118>

You can prune by compiler type, architecture, and which FLAG you want to use. I seem to remember = is append and == is replace. 

Thanks,

Andrew Fish

> Thanks,
> Peter
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



  reply	other threads:[~2017-04-06 18:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 18:07 Pull in pre-built library during edk2 build? Peter Hornyack
2017-04-06 18:57 ` Andrew Fish [this message]
2017-04-06 19:42   ` Michael Zimmermann
2017-04-06 22:46 ` Laszlo Ersek
2017-04-06 23:16   ` Laszlo Ersek
2017-04-07  3:30     ` Peter Hornyack

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=C94FC8CF-5728-4C27-B53A-695431661A19@apple.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