-
Notifications
You must be signed in to change notification settings - Fork 8.2k
scripts: kconfig: Replace conf with Python #5569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This completely replaces conf and merge_config with a single kconfig.py Python script. |
cmake/kconfig.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a leftover from debugging, to check that the kconfig/ folder, which is no longer being generated, is not required. Can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to removing it.
scripts/kconfig/kconfig.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can replace the header of the .config file if we want to
scripts/kconfig/kconfig.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can replace the header of the autoconf.h file if we want to
scripts/kconfig/kconfiglib.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is equivalent to an MIT license: https://en.wikipedia.org/wiki/ISC_license
|
you probably want to mention in the kconfiglib commit that it will replace the current version in doc. So it is not something new that need to be approved. |
|
When building hello_world with BOARD=nrf52_pca10040
Can we improve the UX here, make it more obvious that the warning is coming from Kconfig for example? |
|
I liked that the old system listed which files were used to merge configs,
|
|
Note there's no support for |
|
Ah, ok, please mark as WIP/RFC. |
Codecov Report
@@ Coverage Diff @@
## master #5569 +/- ##
==========================================
+ Coverage 52.51% 53.55% +1.04%
==========================================
Files 430 428 -2
Lines 41190 41189 -1
Branches 7916 7855 -61
==========================================
+ Hits 21631 22060 +429
+ Misses 19024 19018 -6
+ Partials 535 111 -424
Continue to review full report at Codecov.
|
|
CMake clean configure time regressed significantly :( 0.76 seconds in master It seems that it is doing more, which can give us a better UX, so 50ms or so performance degradation would be OK. but 200ms is quite a long time IMHO ... EDIT: Steps to reproduce: sebo@mach:~/zephyr/samples/hello_world/c$ rm -rf * && time cmake .. |
I'm sure this is true for Linux. But how about the same on MSYS2 vs running this on a native Windows prompt with a native Python build? |
I don't know ;) I still don't understand why msys runs so slow. |
|
Additional info: I compared the |
|
This used to work, and should continue to do so: cmake .. Expected result: Kconfig outputs will reflect Kconfig inputs (Such as Kconfig Intuitively; Kconfig is a part of configuration, and configuration is done in CMake's configure stage, so |
|
About KERNELVERSION. The user is supposed to be able to assume, that all # CONFIG_FOO_BAR defines he magically sees as available in his code, should also be available in CMake build scripts. e.g. he should be able to do if(CONFIG_KERNELVERSION STREQUAL bla bla) But I see that CONFIG_KERNELVERSION is not entered into the CMake namespace (because it is not in the .config file), this should be fixed. |
|
for the kconfiglib import, it would be cleaned if you import the upstream version and have another patch with the zephyr related changes. |
|
@nashif I did that initially actually. But then I thought it was better to point to my GitHub repo instead. Maybe we could keep Kconfiglib in a Zephyr-owned repo? The reason is that Zephyr patches != Kconfiglib patches, and it's a pain to maintain later. |
50371f0 to
5660ea3
Compare
|
@nashif @SebastianBoe Addressed comments except for the dependency problem, which @SebastianBoe is looking at. |
This is not new, |
I disagree that it is minor. But it doesn't need to block the merge as far as I am concerned. We can just open a bug for it and fix it later if you want. |
Some projects use wildcards when sourcing a Kconfig file. Add support for globbing the files that match the wildcards and process them one by one. Origin: https://github.com/carlescufi/Kconfiglib/tree/zephyr Signed-off-by: Carles Cufi <[email protected]>
This commit mirrors c6390d5 in Kconfiglib instead of Kconfig. Origin: https://github.com/carlescufi/Kconfiglib/tree/zephyr Signed-off-by: Carles Cufi <[email protected]>
No need. @ulfalizer has fixed it upstream and I've now updated to the latest Kconfiglib. |
cmake/kconfig.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SebastianBoe does this look OK to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cmake/host-tools.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep looking for conf in non-Windows builds, including MSYS2.
|
@nashif @SebastianBoe I now tested it on Windows' |
cmake/kconfig.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/run/${kconfig_target}/
We have been using a fork of the Linux kernel's Kconfig system to configure the Zephyr tree. The issue is that this is a native tool written in C that is not easy to compile for Windows. This patch replaces the use of the conf executable with kconfig.py, a script that uses Kconfiglib to generate the .config and autoconf.h files required to compile Zephyr. Signed-off-by: Carles Cufi <[email protected]>
|
Hello, Glad it's helpful! I'm currently looking for a job by the way. If you want me to build a good menuconfig for you or implement other more advanced Kconfig- or build-related features needed in Zephyr, then I'm available for freelance work. I'm always happy to help if you decide to do it yourselves. Just putting it out there as an option. :) Cheers, |
Thanks for letting us know, I will have a talk internally and get back to you privately. |
Kconfiglib does not support merging fragments without parsing the entire Kconfig "database". For Zephyr this means we no longer get a performance gain from splitting up the fragment-merging and the .config generation. This patch removes the seperated merge step and it's associated caching mechanism. Now we do a full Kconfig execution on every reconfiguration. Signed-off-by: Sebastian Bøe <[email protected]>
When Kconfiglib was introduced it caused a significant performance issue. This patch uses pruning to mitigate the performance issue. The pruning exploits the fact that before the Kconfig database is parsed we already know what ARCH and BOARD has been selected. So in theory we could prune away all Kconfig sources that are not related to the current ARCH or BOARD. In practice, it is only the Kconfig sources in zephyr/arch/$ARCH and zephyr/board/$ARCH/ that are easy to prune. Still, that is quite a few Kconfig sources. For qemu_x86 this patch reduced the number of parsed Kconfig source files from 632 to 272. This pruning resulted in a incremental reconfiguration (time cmake ..) speedup of 21% (0.56s to 0.46) and a clean build speedup of 4% (Using board qemu_x86 and sample hello_world). Furthermore, it should be easier to maintain ARCH's and BOARD's out-of-tree since the user now has a mechanism to redirect where Kconfig sources are found. But this has not been explored. Signed-off-by: Sebastian Bøe <[email protected]>
|
This is ready to be merged as far as @SebastianBoe and myself are concerned. |
|
will give it another try today. AFAIK, it looks great already. Need to remove the old Kconfiglib from the tree at the same time. #5622 |
+1 |
The file kconfig.py was originally introduced by myself in: zephyrproject-rtos#5569 The file was a modified version of a Kconfiglib one, so it makes sense to keep the original license (ISC). Signed-off-by: Carles Cufi <[email protected]>
The file kconfig.py was originally introduced by myself in: #5569 The file was a modified version of a Kconfiglib one, so it makes sense to keep the original license (ISC). Signed-off-by: Carles Cufi <[email protected]>
The file kconfig.py was originally introduced by myself in: zephyrproject-rtos/zephyr#5569 The file was a modified version of a Kconfiglib one, so it makes sense to keep the original license (ISC). (cherry picked from commit 05467ad) Original-Signed-off-by: Carles Cufi <[email protected]> GitOrigin-RevId: 05467ad Change-Id: If40741c5d8430c075585353ee62dd08f61985772 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4812192 Tested-by: ChromeOS Prod (Robot) <[email protected]> Commit-Queue: Fabio Baltieri <[email protected]> Tested-by: Fabio Baltieri <[email protected]> Reviewed-by: Fabio Baltieri <[email protected]>
fixes #5374
fixes #5419