Skip to content
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

Skip building modules for incompatible kernel configs #219

Closed
xnox opened this issue Mar 24, 2022 · 6 comments
Closed

Skip building modules for incompatible kernel configs #219

xnox opened this issue Mar 24, 2022 · 6 comments

Comments

@xnox
Copy link
Contributor

xnox commented Mar 24, 2022

In Ubuntu, we ship various dkms modules and we also have many different kernel types.

Some dkms modules target hardware & kernels that require certain configuration options to be enabled in the kernel. Most of Ubuntu kernels have those options turned on, but not others.

At the same time when developing kernels we test a cross combination of all dkms modules against all kernel modules.

It would be nice to have something like a BUILD_EXCLUSIVE_KERNEL= option but something along the lines of BUILD_REQUIRED_CONFIG= such that one can do something like

BUILD_REQUIRED_CONFIG=CONFIG_ACPI

And if a given kernel doesn't have ACPI turned on, dkms module build will not be attempted and instead it would be skipped, declaring that this dkms module is incompatible with a given kernel.

Ditto other scenarios similar to that one - i.e. when dkms module plugs into a wider kernel framework that might be turned off in a given kernel. For example dahdi-linux dkms unable to be built against kernels that have CONFIG_AUDIO turned off.

Or can you please suggest any other options as to how dkms.conf can include some kernel config validation checks (either declarative or scripts) which are not based on kernel version number; but based on kernel config features.

@xnox
Copy link
Contributor Author

xnox commented Mar 25, 2022

I ended up doing:

if ! grep -q '^CONFIG_ECHO=[ym]$' $kernel_source_dir/.config || ! grep -q '^CONFIG_FW_LOADER=[ym]$' $kernel_source_dir/.config; then
BUILD_EXCLUSIVE_KERNEL="^$"
fi

Not sure if this is the best way.

@anbe42
Copy link
Collaborator

anbe42 commented Jun 3, 2022

There is also the other way around, i.e. a certain configuration must not be enabled. E.g. the zfs and nvidia modules cannot be built on PREEMPT_RT kernels (due to transitive usage of GPL-only symbols).

Could perhaps be modeled as
BUILD_REQUIRED_CONFIG="!CONFIG_PREEMPT_RT"

In general, this should allow a space (or comma) separated list of (negated) options.

@anbe42
Copy link
Collaborator

anbe42 commented Jun 13, 2022

A preliminary patch that adds a (yet undocumented) BUILD_EXCLUSIVE_CONFIG option can be found here:
https://gist.github.com/anbe42/66aacc5a4ee1c91089cf11f02d677e3f

@scaronni
Copy link
Collaborator

scaronni commented Aug 8, 2022

Can you make a pull request with the updated option also in the man page? thanks.

@evelikov
Copy link
Collaborator

@anbe42 seems like this landed in Debian. As mentioned above - can you make this a proper PR and while also updating the manual page?

@anbe42
Copy link
Collaborator

anbe42 commented Oct 26, 2022

See pull request #269.

anbe42 added a commit to anbe42/dkms that referenced this issue Oct 27, 2022
support build exclusion depending on kernel features being present/absent,
e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"

Closes: dell#219
anbe42 added a commit to anbe42/dkms that referenced this issue Oct 27, 2022
support build exclusion depending on kernel features being present/absent,
e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"

Closes: dell#219
anbe42 added a commit to anbe42/dkms that referenced this issue Mar 23, 2023
support build exclusion depending on kernel features being present/absent,
e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"

Closes dell#219
anbe42 added a commit to anbe42/dkms that referenced this issue Mar 23, 2023
support build exclusion depending on kernel features being present/absent,
e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"

Closes dell#219
anbe42 added a commit to anbe42/dkms that referenced this issue Apr 3, 2023
support build exclusion depending on kernel features being present/absent,
e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"

Closes dell#219
anbe42 added a commit to anbe42/dkms that referenced this issue Apr 6, 2023
support build exclusion depending on kernel features being present/absent,
e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"

Closes dell#219
anbe42 added a commit to anbe42/dkms that referenced this issue Apr 6, 2023
support build exclusion depending on kernel features being present/absent,
e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"

Closes dell#219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants