From: Jan Stancek <jstancek(a)redhat.com>
redhat/configs: create a separate config for gcov options
Use existing config infrastructure to build and validate
gcov-enabled configs. Meaning for each arch we also apply
GCOV options on top and validate it.
From same options dir (kgcov) build also partial config, which
contains only GCOV options. We can merge this partial config
during build on top of existing config, which avoids the need
to store all possible combinations in dist-git and SRPM.
Signed-off-by: Jan Stancek <jstancek(a)redhat.com>
diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -141,6 +141,7 @@ dist-configs-check: dist-configs-prep
cd $(REDHAT)/configs; ./process_configs.sh $(PROCESS_CONFIGS_CHECK_OPTS)
$(PACKAGE_NAME)
dist-configs-prep: dist-clean-configs dist-buildreq-check
+ cd $(REDHAT)/configs; ./build_configs.sh "partial" "$(ARCH_MACH)"
"snip"
cd $(REDHAT)/configs; ./build_configs.sh "$(PACKAGE_NAME)"
"$(ARCH_MACH)" "$(FLAVOR)"
dist-configs-arch: ARCH_MACH = $(MACH)
@@ -259,6 +260,7 @@ sources-rh: $(TARBALL) generate-testpatch-tmp setup-source
dist-configs-check
keys/rhel*.x509 \
kabi/check-kabi \
configs/$(PACKAGE_NAME)-*.config \
+ configs/partial*.config \
gating.yaml \
rpminspect.yaml \
update_scripts.sh \
diff --git a/redhat/configs/.gitignore b/redhat/configs/.gitignore
index blahblah..blahblah 100644
--- a/redhat/configs/.gitignore
+++ b/redhat/configs/.gitignore
@@ -1,5 +1,6 @@
*merged
config-*
kernel*config
+partial*config
*.old
*.tmp
diff --git a/redhat/configs/common/kgcov/CONFIG_GCOV_KERNEL
b/redhat/configs/common/kgcov/CONFIG_GCOV_KERNEL
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ b/redhat/configs/common/kgcov/CONFIG_GCOV_KERNEL
@@ -0,0 +1 @@
+CONFIG_GCOV_KERNEL=y
diff --git a/redhat/configs/common/kgcov/CONFIG_GCOV_PROFILE_ALL
b/redhat/configs/common/kgcov/CONFIG_GCOV_PROFILE_ALL
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ b/redhat/configs/common/kgcov/CONFIG_GCOV_PROFILE_ALL
@@ -0,0 +1 @@
+CONFIG_GCOV_PROFILE_ALL=y
diff --git a/redhat/configs/common/kgcov/CONFIG_GCOV_PROFILE_FTRACE
b/redhat/configs/common/kgcov/CONFIG_GCOV_PROFILE_FTRACE
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ b/redhat/configs/common/kgcov/CONFIG_GCOV_PROFILE_FTRACE
@@ -0,0 +1 @@
+# CONFIG_GCOV_PROFILE_FTRACE is not set
diff --git a/redhat/configs/priority.fedora b/redhat/configs/priority.fedora
index blahblah..blahblah 100644
--- a/redhat/configs/priority.fedora
+++ b/redhat/configs/priority.fedora
@@ -22,26 +22,33 @@ EMPTY=s390x-zfcpdump
# x86_64
x86_64=generic:generic-x86:generic-x86-x86_64
x86_64-debug=generic:generic-x86:generic-x86-x86_64:debug:debug-x86-x86_64
+x86_64-kgcov=generic:generic-x86:generic-x86-x86_64:kgcov
# i686
i686=generic:generic-x86:generic-x86-i686
i686-debug=generic:generic-x86:generic-x86-i686:debug:debug-x86
+i686-kgcov=generic:generic-x86:generic-x86-i686:kgcov
# ppc64le
ppc64le=generic:generic-powerpc
ppc64le-debug=generic:generic-powerpc:debug:debug-powerpc
+ppc64le-kgcov=generic:generic-powerpc:kgcov
# s390x
s390x=generic:generic-s390x
s390x-debug=generic:generic-s390x:debug:debug-s390x
+s390x-kgcov=generic:generic-s390x:kgcov
# aarch64
aarch64=generic:generic-arm:generic-arm-aarch64
aarch64-debug=generic:generic-arm:generic-arm-aarch64:debug:debug-arm-aarch64
+aarch64-kgcov=generic:generic-arm:generic-arm-aarch64:kgcov
# arm
armv7hl=generic:generic-arm:generic-arm-armv7:generic-arm-armv7-armv7
armv7hl-debug=generic:generic-arm:generic-arm-armv7:generic-arm-armv7-armv7:debug:debug-arm
+armv7hl-kgcov=generic:generic-arm:generic-arm-armv7:generic-arm-armv7-armv7:kgcov
armv7hl-lpae=generic:generic-arm:generic-arm-armv7:generic-arm-armv7-lpae
armv7hl-lpae-debug=generic:generic-arm:generic-arm-armv7:generic-arm-armv7-lpae:debug:debug-arm
+armv7hl-lpae-kgcov=generic:generic-arm:generic-arm-armv7:generic-arm-armv7-lpae:kgcov
diff --git a/redhat/configs/priority.rhel b/redhat/configs/priority.rhel
index blahblah..blahblah 100644
--- a/redhat/configs/priority.rhel
+++ b/redhat/configs/priority.rhel
@@ -22,15 +22,20 @@ EMPTY=armv7hl armv7hl-debug armv7hl-lpae armv7hl-lpae-debug i686
i686-debug
# x86_64
x86_64=generic:generic-x86:generic-x86-x86_64
x86_64-debug=generic:generic-x86:generic-x86-x86_64:debug:debug-x86-x86_64
+x86_64-kgcov=generic:generic-x86:generic-x86-x86_64:kgcov
# ppc64le
ppc64le=generic:generic-powerpc
ppc64le-debug=generic:generic-powerpc:debug:debug-powerpc
+ppc64le-kgcov=generic:generic-powerpc:kgcov
# s390x
s390x=generic:generic-s390x
s390x-debug=generic:generic-s390x:debug:debug-s390x
s390x-zfcpdump=generic:generic-s390x:generic-s390x-zfcpdump
+s390x-kgcov=generic:generic-s390x:kgcov
+
# aarch64
aarch64=generic:generic-arm:generic-arm-aarch64
aarch64-debug=generic:generic-arm:generic-arm-aarch64:debug:debug-arm-aarch64
+aarch64-kgcov=generic:generic-arm:generic-arm-aarch64:kgcov
diff --git a/redhat/configs/priority.snip b/redhat/configs/priority.snip
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ b/redhat/configs/priority.snip
@@ -0,0 +1,12 @@
+# Individual entries must be ordered as
+# config-variant=config-1:config-2:config-3 in a descending order through
+# the hierarchy
+
+# kernel.config files are build on the fly based on this config,
+# the first arg is arch and variant, the second is a hierarchy of
+# config options, lowest priority to highest
+ORDER=common
+EMPTY=
+
+# gcov options
+kgcov=kgcov
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100755
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -797,6 +797,7 @@ Source72: filter-s390x.sh.fedora
Source73: filter-modules.sh.fedora
%endif
+Source75: partial-kgcov-snip.config
Source80: generate_all_configs.sh
Source81: process_configs.sh
@@ -1438,15 +1439,13 @@ for i in %{all_arch_configs}
do
mv $i $i.tmp
./merge.pl %{SOURCE3001} $i.tmp > $i
- rm $i.tmp
-done
-%endif
-
-# enable GCOV kernel config options if gcov is on
%if %{with_gcov}
-for i in *.config
-do
- sed -i 's/# CONFIG_GCOV_KERNEL is not
set/CONFIG_GCOV_KERNEL=y\nCONFIG_GCOV_PROFILE_ALL=y\n/' $i
+ echo "Merging with gcov options"
+ cat %{SOURCE75}
+ mv $i $i.tmp
+ ./merge.pl %{SOURCE75} $i.tmp > $i
+%endif
+ rm $i.tmp
done
%endif
@@ -2875,7 +2874,7 @@ fi
%endif
%if %{with_gcov}
-%ifarch x86_64 s390x ppc64le aarch64
+%ifnarch %nobuildarches
%files gcov
%{_builddir}
%endif
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1433