Skip to content

Add Target.ensure_kconfig() #655

@douglas-raillard-arm

Description

@douglas-raillard-arm

Code sometimes need to check if some kernel config options is enabled. For a lot of them, checking they are =y is actually stricter than necessary, but allowing =m means the check can succeed without the feature being actually available if the corresponding module was not loaded.

To alleviate that, we could have a Target.ensure_kconfig() method that:

  • Checks if the option =y and if so returns
  • if =n or config does not exist at all, raises an exception
  • if =m, tried to lsmod/modprobe the corresponding module and raises if that fails.

Unfortunately, there is no generic way of knowing the module name associated with a given kconfig, so the mapping has hard coded. However, we can have a maintenance script that finds a mapping for a given kernel source tree by looking for obj-$(CONFIG_FOO) += the module.o anothermodule.o and merge the result with the existing mapping in devlib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions