There is DevicePathLib enhancement to meet such app requirement and reduce 
duplicated code. You can just link to the newly added DevicePathLib instance:  
MdePkg\Library\UefiDevicePathLib\UefiDevicePathLibOptionalDevicePathProtocol.inf.

Revision: 14504
Author: niruiyu
Date: 2013年7月26日 11:00:21
Message:
Add 4 APIs to DevicePathLib: ConvertDeviceNodeToText, ConvertDevicePathToText, 
ConvertTextToDeviceNode and ConvertTextToDevicePath.
Add a new instance of DevicePathLib which tries to locate the protocol and if 
it's not found, it uses the internal functions.

Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
----
Modified : /trunk/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePath.c
Deleted : /trunk/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePath.h
Modified : /trunk/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
Deleted : /trunk/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePathFromText.c
Deleted : /trunk/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePathToText.c
Deleted : /trunk/edk2/MdeModulePkg/Universal/DevicePathDxe/DevicePathUtilities.c
Modified : /trunk/edk2/MdePkg/Include/Library/DevicePathLib.h
Added : /trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
Added : /trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
Added : /trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c 
(Copy from path: 
/trunk/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c, Revision, 
14458)
Modified : /trunk/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
Added : /trunk/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.h
Modified : /trunk/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
Added : 
/trunk/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.c
Added : 
/trunk/edk2/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProtocol.inf
Modified : 
/trunk/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
Modified : 
/trunk/edk2/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
Modified : /trunk/edk2/MdePkg/MdePkg.dsc


Thanks,
Hot

-----Original Message-----
From: Brian J. Johnson [mailto:[email protected]] 
Sent: Friday, October 04, 2013 11:38 PM
To: [email protected]
Subject: Re: [edk2] using build with edk2

Duck,

As far as I know, libraries are only built if they are used.  The EDKII 
build is much smarter than the EDKI build in this regard.  So if your 
new library is not used, the new .inf file won't be referenced, and the 
library won't be built.

Brian

On 10/04/2013 09:36 AM, duck wilson wrote:
> Brian, thanks. The solutions you enumerated were all I could find. I was
> hoping for something simpler but will go with your first suggestion and
> just spin out another library.
>
> Quick question. I assume that a PCD can be created that enables/disables
> building of the new library when MdeModulePkg is built?
>
>
> On Fri, Oct 4, 2013 at 10:15 AM, Brian J. Johnson <[email protected]
> <mailto:[email protected]>> wrote:
>
>     On 10/04/2013 04:26 AM, duck wilson wrote:
>      > ... Really,
>      > all that is needed is to simply link to the need object files in
>      > MdeModulePkg/Universal/DevicePathDxe/. My problem is that I have not
>      > found a way to do this with build. I have included
>      > MdeModulePkg/MdeModulePkg.dec in the [Packages] section of the
>     app .inf
>      > file. However, I don't see a way to instruct build to make
>      > MdeModulePkg/Universal/DevicePathDxe/.DevicePath.h part of the
>     include
>      > path so I can simply statically link against the EDK2 library.
>     Can this
>      > be done with build?
>
>     You could put a new .inf file in MdeModulePkg/Universal/DevicePathDxe
>     which builds the relevant .c files to generate a library.  Then add the
>     library to your application in the usual way.  That way you would only
>     have to maintain a new .inf file, rather than separate copies of the
>     source files.  This would be what I'd recommend.
>
>     Or you could try modifying MdeModulePkg.dec to add
>     MdeModulePkg/Universal/DevicePathDxe to the [Includes] list.  But that
>     may break other parts of the build, if it causes them to pick up the
>     wrong DevicePath.h.
>
>     Or you could hardcode stuff into the [BuildOptions] section of your
>     app's .inf file, but that sounds worse.
>     --
>
>                                                       Brian Johnson
>
>     --------------------------------------------------------------------
>
>         To go fast, you may go alone.  But to go far, you must go with
>     others.
>                                                  -- Norm Anderson
>
>
>     
> ------------------------------------------------------------------------------
>     October Webinars: Code for Performance
>     Free Intel webinars can help you accelerate application performance.
>     Explore tips for MPI, OpenMP, advanced profiling, and more. Get the
>     most from
>     the latest Intel processors and coprocessors. See abstracts and
>     register >
>     
> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
>     _______________________________________________
>     edk2-devel mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to