Hello,

I would like to rebuild a Debian source package of the Linux kernel after changing one or more kernel configuration parameters.

The Debian Administrator Handbook [1] suggests generating the configuration file '.config' in the root directory of the source code form current running configuration, and then modifying it. This method works, but I would like to understand how to modify the Linux kernel configuration used by the Debian packaging system.

The building scripts for the Debian source package of the Linux kernel assemble the kernel's configuration files using configuration snippets in the ./debian/config directory. The ./debian/README.sources [2] states:

---------%< ---------%< ---------%< ---------%< ---------%<

Kernel config files
===================

Each kernel configuration file is constructed dynamically from a
number of files under debian/config and (if it exists)
debian/config.local.  They are read in the following order, such that
files later on the list can override settings from earlier files.
Files in debian/config.local can also override settings from the
corresponding file in debian/config.

1. Common:
   - Default filename: config
   - Filename list: [build.config]
2. Per kernel architecture:
   - Default filename: kernelarch-<karch>/config
   - Filename list: [kernelarch.build.config]
3. Per Debian architecture:
   - Default filename: <arch>/config
   - Filename list: [kernelarch.debianarch.build.config]
4. Per Debian architecture and flavour:
   - Default filename: <arch>/config.<flavour>
   - Filename list: [kernelarch.debianarch.flavour.build.config]
5. Per featureset:
   - Default filename: featureset-<fset>/config
   - Filename list: [featureset.build.config]
6. Per Debian architecture and featureset:
   - Default filename: <arch>/<fset>/config
   - Filename list: [kernelarch.debianarch.featureset.build.config]
7. Per Debian architecture, featureset, and flavour:
   - Default filename: <arch>/<fset>/config.<flavour>
   - Filename list: [kernelarch.debianarch.featureset.flavour.build.config]

You can check the final list of configuration files by reading
debian/rules.gen.  Each binary-arch_<arch>_<fset>_<flavour>_image
rule passes the list to debian/rules.real as the KCONFIG variable.

These files should be kept in order using the kconfigeditor2
utility from <https://salsa.debian.org/kernel-team/kernel-team>.
With this source package as your working directory, run:

    debian/rules source
    .../kernel-team/utils/kconfigeditor2/process.py .

This will also warn about any symbols that no longer exist, or
cannot be explicitly configured.

---------%< ---------%< ---------%< ---------%< ---------%<

If I understand correctly, the config snippets in ./debin/config are assembled using the ./debian/bin/kconfig.py program [3] in ./debian/rules.gen to generate the final .config file required for building the kernel's binary images.

What's the "cleanest" debian way to change some kernel parameters in Debian Linux source package before building the binary packages ?

As an example, how to enable the following parameters (that are disabled in the default configuration) ?
    # CONFIG_BOOT_CONFIG is not set
    # CONFIG_BOOTTIME_TRACING is not set

Thanks.

--
[1] https://debian-handbook.info/browse/stable/sect.kernel-compilation.html
[2] https://sources.debian.org/src/linux/6.18.12-1/debian/README.source?hl=107#L104
[3] https://salsa.debian.org/kernel-team/kernel-team
[4] https://www.linux.it/~ema/posts/enabling-kernel-settings-in-debian/

Reply via email to