Replies: 1 comment 1 reply
-
|
On Jan 7, 2026, at 7:52 AM, jdoubleu ***@***.***> wrote:
Hi, I‘m looking for an elegant way to patch source files in the EDK2 repo for my project.
I need to slightly change the code of some libraries e.g. in the MdePkg. So far I‘ve applied these patches on top of a fork of the repo, that I maintain. However that makes updating the EDK2 and maintaining my fork harder.
Unfortunately there is no way to influence (neither patch nor add additional) the source files of a Module (.inf) in my Platform (.dsc). For EDK1, I learned, there was a <SOURCE_OVERRIDE_DIR> mechanism.
What’s the recommended way to maintain custom patches?
I think the primary answer is don’t use the MdePkg library class and make a new library class that has a new API that does what you want. So add a library header and instance to your package and call your new API to get different behavior. If that does not work for you it might be worth while to ask “What Are You Trying to Do” on the mailing list as maybe you are trying to implement something the wrong way?
If you are trying to add additional behavior to existing libs (logging, profiling, etc) just fork the libraries to a new package and maintain a new instance of the libraries. Then have your DSC point at your forked library vs. MdePkg instance.
This does not work if you are overriding something in MdeLibs.dsc.inc [1] (assuming you are including that).
But otherwise in your DSC [LibraryClasses] you just change:
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
To:
PcdLib|MyPkg/Library/BasePcdLibNull/BasePcdLibNull.inf
Then in general the original fork is from a known version and you know your patch applied. The down side is you have to apple patches by hand going forward.
[1] https://github.com/tianocore/edk2/blob/master/MdePkg/MdeLibs.dsc.inc
Thanks,
Andrew Fish
… —
Reply to this email directly, view it on GitHub <#11971>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AD4ZCO3LDELJ7IQ32PZ34ZD4FUTSNAVCNFSM6AAAAACQ6YLUFOVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZZGMYTQNJVGI>.
You are receiving this because you are subscribed to this thread.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I‘m looking for an elegant way to patch source files in the EDK2 repo for my project.
I need to slightly change the code of some libraries e.g. in the
MdePkg. So far I‘ve applied these patches on top of a fork of the repo, that I maintain. However that makes updating the EDK2 and maintaining my fork harder.Unfortunately there is no way to influence (neither patch nor add additional) the source files of a Module (
.inf) in my Platform (.dsc). For EDK1, I learned, there was a<SOURCE_OVERRIDE_DIR>mechanism.What’s the recommended way to maintain custom patches?
Beta Was this translation helpful? Give feedback.
All reactions