On 3/17/23, Nathan Hartman <hartman.nat...@gmail.com> wrote: > On Wed, Mar 15, 2023 at 6:16 AM raiden00pl <raiden0...@gmail.com> wrote: >> >> NVMC support for NRF52 chips was ported from Nordic SDK which was >> released >> on the BSD license (old times), so these features should depend on >> CONFIG_ALLOW_BSD_COMPONENTS=y. Users must manually enable support for the >> BSD components to continue using the mentioned features. >> >> Related PR: https://github.com/apache/nuttx/pull/8827 > > > Thanks for posting about it to the list. I just added my review there, > but it got me thinking: > > We have many files listed in LICENSE which are non-Apache-2.0-License > and I haven't had a chance to check but I have a feeling that there > could be more files that should be protected by ALLOW_BSD_COMPONENTS / > ALLOW_MIT_COMPONENTS / ALLOW_GPL_COMPONENTS / ALLOW_*_COMPONENTS that > are not currently protected. > > For each file that has a non-Apache-2.0-License at the top, should we > wrap the entire file contents with: > > #ifdef ALLOW_*_COMPONENTS > . > . > . > #endif /* ALLOW_*_COMPONENTS */ > > (for the appropriate value of * of course)? > > Yes, doing that will cause compiler errors when a build tries to use > those files and doesn't have the required ALLOW_*_COMPONENTS enabled, > but that will help us find all those cases relatively quickly and fix > them by adding "depends on ALLOW_*_COMPONENTS" in Kconfig. > > It will ensure that when someone doesn't choose ALLOW_BSD_COMPONENTS / > ALLOW_MIT_COMPONENTS / ALLOW_GPL_COMPONENTS then their build will > actually be licensed as advertised. > > If we want to do it then obviously it should be separate PRs, maybe > one for each component we find... > > Thoughts? >
Nathan, the downsize of adding "depends on ALLOW_*_COMPONENTS" in Kconfig is it will hide the feature, so a new user will never know that NuttX supports such feature. There is an "awful" workaround that people uses to show comments in the Kconfig, they just use "depends on !ALLOW_*_COMPONENTS" to display a comment saying that the user needs to enable that LICENSE to use that feature. Sometime ago I suggested the option of adding a "tainted" symbol (like that used on Linux kernel) that indicates if the final binary has some license different from Apache and warn the user. That should be a better approach because make users' live easier (and our as well because we don't need to worry about Kconfig workarounds). BTW, few days ago a colleague of mine that works here at Espressif, but on Zephyr team, added it into mainline. BR, Alan