Skip to content

change kernel config system #45

Description

@Jan200101

Config change suggestions

The OGC Kernel currently provides a set of plain files to set and unset kernel configurations based on the desired distro however the system is fairly inflexible and has many shortcomings that make it less attractive for downstream consumers.

Prelude

Kconfig

To get people up to speed:

The Linux kernel uses a config system called Kconfig which allows various subcomponents (such as drivers) to be enabled, disabled or otherwise configured during compilation.

The config file used is a singular file with options in the format of CONFIG_OPTION=VALUE being separated by newlines i.e.

CONFIG_FOO=y # bool/tristate
CONFIG_BAR=2000 # int
CONFIG_MOD=m # tristate

For distributions one config is usually not enough so there are multiple ways this is solved:

  • Arch: only supports x86_64 so only needs one config
  • Debian: has a predefined config per architecture (source)
  • Fedora: Keeps a hiarchical folder based structure to have one filer per config with the ability to inherit from different trees, architecture dependent configs, support for flavor configuration (i.e. Real-Time, Debug, etc.) (source)
  • Ubuntu: uses a custom python based annotation system to create a config. Launchpad does not provide a web interface for the git repo anymore so here is a snippet:
# Menu: HEADER
# FORMAT: 4
# ARCH: amd64 arm64 armhf ppc64el s390x
# FLAVOUR: amd64-generic amd64-lowlatency arm64-generic arm64-generic-64k arm64-lowlatency arm64-lowlatency-64k armhf-generic armhf-generic-lpae ppc64el-generic s390x-generic

CONFIG_ACCESSIBILITY                            policy<{'amd64': 'y', 'arm64': 'y', 'armhf': 'y', 'ppc64el': 'y', 's390x': 'n'}>
CONFIG_ACCESSIBILITY                            note<'LP: #1967702'>

CONFIG_ACPI_CUSTOM_DSDT_FILE                    policy<{'amd64': '""'}>
CONFIG_ACPI_CUSTOM_DSDT_FILE                    note<'might allow hardware damage'>

CONFIG_ACPI_CUSTOM_METHOD                       policy<{'amd64': 'n', 'arm64': 'n'}>
CONFIG_ACPI_CUSTOM_METHOD                       note<'SECURITY: allows arbitrary execution'>

CONFIG_AGP                                      policy<{'amd64': 'y', 'ppc64el': 'y'}>
CONFIG_AGP                                      note<'not autoloadable'>

Possible Changes

Option 1 - plain

Keep everything as is and keep separate configs per architectures and required feature set.

Different distros usually enable different options per architecture so having one universal config may not always be feasible in terms of compatibility.

Option 2 - hierarchical Kconfig

Do it similar to how Fedora does, keep every option as a dedicated file as part of a bigger tree that can then be used directly or inherited from other trees.

This option would require custom tooling but would make it feasible for downstream consumers to easily layer their own configuration ontop of the OGC and base distro configs.

Option 3 - Custom Format

The KConfig system can in many ways be considered dated but not really replacable due to how flexible it is, since we are a downstream consumer with their own needs a custom format (likely based on an existing file format) could be made to make the creation of KConfig files easier

Here is one mockup of what such a custom format could look like using TOML, this does not represent how this implementation would look:

FB_SIMPLE = "n"

[arch.x86]
USB_DWC3 = "m"  

Up- and downstreams would need to be considered because existing systems will need to be migrated.

Some consideration needs to be taken when this is implemented due to the fact that all current up- and potential downstreams make use of the kconfig system, an automatic conversion system would make it easier to adopt the ogc kernel and even allow themto keep their existing tools and workflows.

Implementation

I already wrote my own tools for kernel-blu so I volunteer to write any additional tooling needed to implement this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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