I'm doing the same in one of my projects where I link against a
prebuilt gcc lib.
Adding support for that is quite easy actually:

https://github.com/efidroid/edk2/commit/841473c1c86823521dfad5eb3d74461557302e42

On Thu, Apr 6, 2017 at 8:57 PM, Andrew Fish <[email protected]> wrote:
>
>> On Apr 6, 2017, at 11:07 AM, Peter Hornyack <[email protected]> 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
>> [email protected]
>> https://lists.01.org/mailman/listinfo/edk2-devel
>
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to