[RFC] Support core library overrides #261
Replies: 2 comments
-
@michpappas , please open up this discussion on the Unikraft Discord server or as an issue. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ok thanks, closing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is related to a recent discussion we had with @skuenzer about overriding the default implementation of spinlocks. I was considering what it would take to do that in a clean way, ie without patching Unikraft core, but rather by overriding an internal library with an external implementation through the build system. I came up with a quick PoC, and I would like to discuss whether there is interest for such a change in Unikraft.
So the main idea involves establishing a convention for configuration options declared by external libraries that wish to override internal ones. For example a config option in the form of CONFIG_{LIB}_EXT, where CONFIG_{LIB} is the corresponding configuration option introduced by the original library in Unikraft core.
Using uklock as an example, the implementation of the external library would need to provide Config.uk with the following contents:
The application's Makefile.uk looks like
As with other external libraries, applications would need to add LIBUKLOCK_EXT in their list of library dependencies in Config.uk.
The change required in Unikraft core is modifying lib/Makefile.uk to conditionally include internal libraries depending on whether the corresponding override has been declared or not, eg:
With these proposed scheme, the interface in menuconfig remains as is, given that CONFIG_LIBUKLOCK_EXT is a hidden option. Notice that the original configuration parameters (in this case CONFIG_UKLOCK, CONFIG_UKLOCK_MUTEX and CONFIG_UKLOCK_SEMAPHORE) are still defined for code that is conditional to it, when CONFIG_LIBUKLOCK_EXT is enabled.
Beta Was this translation helpful? Give feedback.
All reactions