Skip to content

Conversation

leandrolanzieri
Copy link
Contributor

Contribution description

This PR is a proposal of how we could model module's dependencies in Kconfig. Although there are many commits, this models the minimum to get examples/gnrc_networking to compile for samr21-xpro. It's to have an idea of how this can look like.

As presented before, the approach for module selection is bottom-up. This means that all dependencies of a module need to be active in order to select that module. Opposite to the current approach where some modules are selected and its dependencies are included (some sort of top-down approach).

Documentation has been added and split into:

  • Kconfig overview
  • User's guide to configure with Kconfig
  • Developer's guide and tips to write Kconfig files (this also contains some modelling decisions)
  • Integration of Kconfig into the build system

Reviewing this

I tried to make each commit as self-contained as possible, mostly modelling a module per commit. Nonetheless there are a lot of changes so I will point out some things which might be nice to take a look at:

  • CPU / boards features modelling
    • cpu/Kconfig.features
    • cpu/{samd21, sam0_common, cortexm_common}/Kconfig
    • boards/samr21-xpro/Kconfig
  • sys/net/Kconfig (only GNRC modelled)
  • sys/net/gnrc/*/Kconfig
  • drivers/at86rf2xx/Kconfig
  • examples/gnrc_networking/app.config
  • Documentation
    • Kconfig developer guide in Doxygen

I based most of the dependencies on our Makefile.dep files, but the current modelling is not definitive as some dependencies might still be missing, and some modules that are always used may be hidden.

Example of configuration

Selecting source seed and implementation for random
menuconfig_random_seed_selection

Usage

  • With a clean examples/gnrc_networking run
make BOARD=samr21-xpro TEST_KCONFIG=1 all

TEST_KCONFIG=1 allows to switch between the usage of Kconfig and Makefile.dep to get the module list to compile.

Kconfig will load the configuration file present in the application folder.

  • To take a look on how module selection looks like run
make BOARD=samr21-xpro TEST_KCONFIG=1 menuconfig

If you need to clean the application take into account that for now make clean and make all should be called separately.

@leandrolanzieri leandrolanzieri added Area: build system Area: Build system Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR TF: Config Marks issues and PRs related to the work of the Configuration Task Force State: demonstrator State: This PR (loosely) demonstrates a concept and is not necessarily meant to be merged. Area: Kconfig Area: Kconfig integration labels May 11, 2020
@leandrolanzieri leandrolanzieri force-pushed the dev/kconfig/module_dependency branch 2 times, most recently from 96f2b23 to 479cf8b Compare July 24, 2020 11:42
@cgundogan cgundogan added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jul 24, 2020
@leandrolanzieri leandrolanzieri force-pushed the dev/kconfig/module_dependency branch from 479cf8b to bf21ed6 Compare July 24, 2020 12:59
@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 24, 2020
@miri64
Copy link
Member

miri64 commented Jul 24, 2020

Rescheduled in favor of release notes, which I want to get into the release branch ASAP

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 24, 2020
@@ -8,3 +8,9 @@ config BOARD
string
help
Name of the currently selected board.

config MOD_BOARD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use an explicit MODULE prefix instead of MOD ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, once the migration is completed we could just change that. But the MODULE_ prefix is currently being used to get the information of the modules added via USEMODULE, which allows to show only relevant configurations:

RIOT/makefiles/kconfig.mk

Lines 94 to 102 in 06dca07

# Build a Kconfig file defining all used modules and packages. This is done by
# defining symbols like 'MODULE_<MODULE_NAME>' or PKG_<PACKAGE_NAME> which
# default to 'y'. Then, every module and package Kconfig menu will depend on
# that symbol being set to show its options.
$(KCONFIG_GENERATED_DEPENDENCIES): FORCE | $(GENERATED_DIR)
$(Q)printf "%s " $(USEMODULE_W_PREFIX) $(USEPKG_W_PREFIX) \
| awk 'BEGIN {RS=" "}{ gsub("-", "_", $$0); \
printf "config %s\n\tbool\n\tdefault y\n", toupper($$0)}' \
| $(LAZYSPONGE) $(LAZYSPONGE_FLAGS) $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: Kconfig Area: Kconfig integration CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: demonstrator State: This PR (loosely) demonstrates a concept and is not necessarily meant to be merged. TF: Config Marks issues and PRs related to the work of the Configuration Task Force
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants