Please tell if such a feature is relevant: We might have some kernel config fragments which aim to override any system or user configuration (such as menuconfig). For example, we might want to force removing all debug config. If so, as the configuration might be change in any do_configure:prepend task, the only place for that is to apply them inside the do_configure task just before make is called. If this is relevant, this may be done on top of patches given in #8191 with an extra variable (eg. KERNEL_CONFIG_FRAGMENTS_OVERRIDE)
It might be, if one of the existing methods isn't appropriate. The changes from 8181 not-withstanding (they need re-work due to some new options in the fragments), let me ask a few questions! We wouldn't want to override the values set via menuconfig (assuming it is being run interactively and values are changed). There would be some very annoyed users if what they select and attempt to build was always clobbered by the build system. but I might be misunderstanding what you meant there. Feel free to clarify if I'm off base. As for applying something "last", that's the current intent of KERNEL_FEATURES. They are always applied after any layer or meta-data fragments, and their values are checked to exist in the final .config. They form a "must have" contract with the configuration. The order of KERNEL_FEATURES is the order they are listed in the variable, so it is definitely possible that someone still comes in later and clobbers some features. The complexity of preventing that override hasn't been worth it, since there are bitbake fundamentals around appending to a variable that could mitigate it. Is that what you were thinking ?
Thank you, that makes things quite clear. Actually my suggestion is to have something that overrides the menuconfig. I understand it is not expected in a development area. In our production, we must prevent our users to leave unsecure kernel configs. Perhaps it is better to keep that out of the mainline... If so, we can close the ticket. We may have a look on #8191 if you think the concept of the patch is still good.
A better option than forcing the options to be set specifically, is to have a fragment that declares the options as 'required' and the build will error on the audit phase if they aren't set. The support is already 99% in the code base for that, it just hasn't been tested / used in quite some time. As for 8191 the approach is still viable, but I have a newer patch than what is attached to the case, but I'm still not convinced it is the right approach for what you may want, and the reason I haven't sent it to OEcore is that the kernel-yocto support has been significantly re-worked since I wrote the patch and the easiest way to add fragment support to a kernel is to just inherit kernel-yocto. The complexity and tradeoffs of adding it to all kernels (configuration modes, kernel versions, etc) without the supporting features of kernel-yocto (audit, etc) is not appealing or viable. It will cause bigger maintenance and usability issues than the functionality is worth.
I agree with your solution, it will be better for the user to just have an error. On our side, we inherit from the kernel-yocto, so we aren't in trouble with fragments. However, our fragments are in the kernel sources. It seemed to me it's not correctly handled at the moment. I'll double check and raise an appropriate issue if so. Thanks for all the answers !