From: Jan Stancek jstancek@redhat.com
redhat/kernel.spec: _buildvars_variant
This introduces a new macro that allows to override variant/config to use for standalone tools/tests build.
In SPEC, we support building standalone tools and selftests. Main user are CKI pipelines, which run a native build. Over time however, selftests introduced also kmods, so picking a correct config now matters as well.
This patch allows CKI (or other users) to pick a variant when doing standalone tools/tests build. Nothing is changing for builds that include kernel build.
Signed-off-by: Jan Stancek jstancek@redhat.com
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -217,6 +217,12 @@ Summary: The Linux kernel # arm64_64k X X X # realtime X X X
+# _buildvars_variant - kernel variant used to initialise build variables +# This variable allows to set variant (and config) that is used when building +# standalone tools and/or tests (with no kernel and no modules). +# See variant parameter to BuildKernel() function. +%define buildvars_variant %{?_buildvars_variant}%{nil} + # kernel-doc %define with_doc %{?_without_doc: 0} %{?!_without_doc: 1} # kernel-headers @@ -2809,10 +2815,11 @@ BuildKernel %make_target %kernel_image %{_use_vdso}
%ifnarch noarch i686 %{nobuildarches} %if !%{with_debug} && !%{with_zfcpdump} && !%{with_up} && !%{with_arm64_16k} && !%{with_arm64_64k} && !%{with_realtime} -# If only building the user space tools, then initialize the build environment -# and some variables so that the various userspace tools can be built. +# If only building the user space tools or selftests, then initialize +# the build environment and some variables so that the various userspace +# tools can be built. %{log_msg "Initialize userspace tools build environment"} -InitBuildVars +InitBuildVars %{buildvars_variant} # Some tests build also modules, and need Module.symvers if ! [[ -e Module.symvers ]] && [[ -f $DevelDir/Module.symvers ]]; then %{log_msg "Found Module.symvers in DevelDir, copying to ."}
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3089
kernel@lists.fedoraproject.org