Customizing kernel configuration

I’m trying to compile a custom kernel using this official guide, and I put config changes into kernel-local as it suggested:

CONFIG_DRM_AMDGPU=n

Unfortunately, when I do build using fedpkg local, I’ve got following error:

Error: Mismatches found in configuration files for arm64 aarch64-16k
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
Error: Mismatches found in configuration files for arm64 aarch64-debug
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
Error: Mismatches found in configuration files for arm64 aarch64
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
Error: Mismatches found in configuration files for powerpc ppc64le-debug
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
Error: Mismatches found in configuration files for powerpc ppc64le
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
Error: Mismatches found in configuration files for s390 s390x-debug
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
Error: Mismatches found in configuration files for s390 s390x
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
Error: Mismatches found in configuration files for x86_64 x86_64-debug
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
Error: Mismatches found in configuration files for x86_64 x86_64
Found # CONFIG_DRM_AMDGPU is not set, after generation, had CONFIG_DRM_AMDGPU n in Source tree
error: Bad exit status from /var/tmp/rpm-tmp.0d5A0J (%prep)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.0d5A0J (%prep)

Funny thing is that error outs # CONFIG_DRM_AMDGPU is not set while grep CONFIG_DRM_AMDGPU kernel-x86_64-fedora.config returns:

CONFIG_DRM_AMDGPU_CIK=y
CONFIG_DRM_AMDGPU=m
CONFIG_DRM_AMDGPU_SI=y
CONFIG_DRM_AMDGPU_USERPTR=y
# CONFIG_DRM_AMDGPU_WERROR is not set

I’ve tried putting # CONFIG_DRM_AMDGPU is not set into kernel-local as well as putting

%define listnewconfig_fail 0
%define configmismatch_fail 0

into kernel.spec as this guide suggested, but it didn’t help me either.

Hello! I have had exactly the same issue, which I could solve after a lot of digging as I could find precious little information on the topic.

So, some clues are in the kernel.spec file which refers to a number of options that one can turn on and off:

# The following build options are (mostly) enabled by default, but may become
# enabled/disabled by later architecture-specific checks.
# Where disabled by default, they can be enabled by using --with <opt> in the
# rpmbuild command, or by forcing these values to 1.
# Where enabled by default, they can be disabled by using --without <opt> in
# the rpmbuild command, or by forcing these values to 0.

There is one option in particular that seemed really useful to me:

# Only build the base kernel (--with baseonly):
%define with_baseonly  %{?_with_baseonly:     1} %{?!_with_baseonly:     0}

and

# check for mismatched config options
%define with_configchecks %{?_without_configchecks:        0} %{?!_without_configchecks:        1}

Then the packaging guidelines shows:

If the spec file contains conditional dependencies selected based on presence of optional --with(out) foo arguments to rpmbuild, build the source RPM to be submitted with the default options, i.e., so that none of these arguments are present in the rpmbuild command line. The reason is that those requirements get “serialized” into the resulting source RPM, i.e., the conditionals no longer apply.

And the --with, --without options also now apply to fedpkg local (and scratch-build), see this bug tracker for the history.

So, putting it all together what made my day, today, is:
fedpkg local --arch x86_64 --without configcheck --with baseonly

Bonus point, the build is super rapid (granted, my kernel-local was made with make localmodconfig on a VM, so very few modules to build) and I don’t end up with a million rpm packages that I don’t need.

Hope that’ll be useful for many folks out there.

1 Like

Edit: fedpkg local --arch x86_64 --without configchecks --with baseonly, this is configchecks plural…