From: Prarit Bhargava on gitlab.com Merge Request: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413
The centos-stream-9 (c9s) [1] repository contains files for both RHEL and Fedora configs. The Fedora configs will never be updated, and will quickly be out-of-date with respect to upstream. Having the files in place causes confusion for engineers and contributors.
This patchset adds an include_rhel and include_fedora variable to the kernel rpm specfile, and adds a INCLUDE_FEDORA_FILES and INCLUDE_RHEL_FILES as Makefile variables. For RHEL and centos-stream, the fedora files can be removed, redhat/configs/flavors updated, and INCLUDE_FEDORA_FILES can be set to 0 with a single extra patch which requires minimal effort.
Signed-off-by: Prarit Bhargava prarit@redhat.com
--- redhat/Makefile | 6 +- redhat/Makefile.variables | 7 + redhat/genspec.sh | 4 + redhat/fedora_files/kernel-local => redhat/kernel-local | 0 redhat/kernel.spec.template | 142 ++++++++------- 5 files changed, 90 insertions(+), 69 deletions(-)
From: Prarit Bhargava prarit@redhat.com
redhat/Makefile: Use flavors file
Use the configs/flavors file instead of hardcoding directory copies.
Signed-off-by: Prarit Bhargava prarit@redhat.com
diff --git a/redhat/Makefile b/redhat/Makefile index blahblah..blahblah 100644 --- a/redhat/Makefile +++ b/redhat/Makefile @@ -254,8 +254,7 @@ sources-rh: $(TARBALL) generate-testpatch-tmp setup-source dist-configs-check echo "WARNING: There are uncommitted changes in your tree or the changes are not in sync with linux-kernel-test.patch. Either commit the changes or run 'make dist-test-patch'" @rm $(TESTPATCH).tmp @cp $(TESTPATCH) $(SOURCES)/linux-kernel-test.patch - @cp fedora_files/* $(SOURCES); - @cp rhel_files/* $(SOURCES); + @cat configs/flavors | while read flavor; do echo "Copying sources for $${flavor}"; [ -e $${flavor}_files ] && cp $${flavor}_files/* $(SOURCES); done @cp cpupower.* \ keys/rhel*.x509 \ kabi/check-kabi \
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413
From: Prarit Bhargava prarit@redhat.com
redhat/Makefile: Make kernel-local global
The kernel-local file is applied on both rhel and fedora builds. Make it a global file instead of in the fedora_files dir.
Signed-off-by: Prarit Bhargava prarit@redhat.com
diff --git a/redhat/Makefile b/redhat/Makefile index blahblah..blahblah 100644 --- a/redhat/Makefile +++ b/redhat/Makefile @@ -274,6 +274,7 @@ sources-rh: $(TARBALL) generate-testpatch-tmp setup-source dist-configs-check generate_crashkernel_default.sh \ ../Makefile.rhelver \ README.rst \ + kernel-local \ $(SOURCES)/ @if [ "$(RELEASED_KERNEL)" -ne 0 ]; then \ cp keys/redhatsecureboot{301,501,ca5,ca1}.cer $(SOURCES)/; \ diff --git a/redhat/fedora_files/kernel-local b/redhat/kernel-local rename from redhat/fedora_files/kernel-local rename to redhat/kernel-local index blahblah..blahblah 100644 --- a/redhat/fedora_files/kernel-local +++ b/redhat/kernel-local
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413
From: Prarit Bhargava prarit@redhat.com
redhat/kernel.spec.template: Add include_fedora and include_rhel variables
The centos-stream-9 (c9s) [1] repository contains files for both RHEL and Fedora configs. The Fedora configs will never be updated, and will quickly be out-of-date with respect to upstream. Having the files in place causes confusion having the Fedora files causes for engineers and contributors.
Add include_fedora and include_rhel variables. These can be set in Makefile.variables to include or exclude RHEL or Fedora-specific files. These are enabled for ARK, and include_fedora can be disabled for c9s.
[1] https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/ Signed-off-by: Prarit Bhargava prarit@redhat.com
diff --git a/redhat/Makefile b/redhat/Makefile index blahblah..blahblah 100644 --- a/redhat/Makefile +++ b/redhat/Makefile @@ -236,7 +236,7 @@ setup-source: dist-git-version-check dist-clean-sources cp $(REDHAT)/$(CHANGELOG_PREV) $(REDHAT)/$(CHANGELOG); \ fi @cp $(REDHAT)/$(CHANGELOG) $(SOURCES)/$(CHANGELOG) - @$(REDHAT)/genspec.sh $(SOURCES) $(SOURCES)/$(SPECFILE) $(SOURCES)/$(CHANGELOG) $(PKGRELEASE) $(RPMKVERSION) $(RPMKPATCHLEVEL) $(RPMKSUBLEVEL) $(DISTRO_BUILD) $(RELEASED_KERNEL) $(SPECRELEASE) $(__ZSTREAM) "$(BUILDOPTS)" $(MARKER) `cat $(REDHAT)/marker` $(SINGLE_TARBALL) $(TARFILE_RELEASE) $(SNAPSHOT) $(UPSTREAM_BRANCH) $(BUILDID) + @$(REDHAT)/genspec.sh $(SOURCES) $(SOURCES)/$(SPECFILE) $(SOURCES)/$(CHANGELOG) $(PKGRELEASE) $(RPMKVERSION) $(RPMKPATCHLEVEL) $(RPMKSUBLEVEL) $(DISTRO_BUILD) $(RELEASED_KERNEL) $(SPECRELEASE) $(__ZSTREAM) "$(BUILDOPTS)" $(MARKER) `cat $(REDHAT)/marker` $(SINGLE_TARBALL) $(TARFILE_RELEASE) $(SNAPSHOT) $(UPSTREAM_BRANCH) $(BUILDID) $(INCLUDE_FEDORA_FILES) $(INCLUDE_RHEL_FILES) @cp $(SOURCES)/$(SPECFILE) $(SOURCES)/../SPECS/
generate-testpatch-tmp: diff --git a/redhat/Makefile.variables b/redhat/Makefile.variables index blahblah..blahblah 100644 --- a/redhat/Makefile.variables +++ b/redhat/Makefile.variables @@ -34,3 +34,10 @@ RELEASED_KERNEL:=0 # multiple updates and builds without bumping the base version, and no # when you expect every build to use a different base kernel version. BUMP_RELEASE:=yes + +# INCLUDE_*_FILES determines whether or not the specific OS flavor files will +# be included as part of the source RPM. Downstream projects, such as +# centos-stream or RHEL, can disable file inclusion by setting these values +# to '0'. +INCLUDE_FEDORA_FILES:=1 +INCLUDE_RHEL_FILES:=1 diff --git a/redhat/genspec.sh b/redhat/genspec.sh index blahblah..blahblah 100755 --- a/redhat/genspec.sh +++ b/redhat/genspec.sh @@ -23,6 +23,8 @@ TARFILE_RELEASE=${16} SNAPSHOT=${17} UPSTREAM_BRANCH=${18} BUILDID=${19} +INCLUDE_FEDORA_FILES=${20} +INCLUDE_RHEL_FILES=${21} RPMVERSION=${KVERSION}.${KPATCHLEVEL} clogf="$SOURCES/changelog" # hide [redhat] entries from changelog @@ -137,6 +139,8 @@ test -n "$SPECFILE" && s/%%DISTRO_BUILD%%/$DISTRO_BUILD/ s/%%RELEASED_KERNEL%%/$RELEASED_KERNEL/ s/%%DEBUG_BUILDS_ENABLED%%/$DEBUG_BUILDS_ENABLED/ + s/%%INCLUDE_FEDORA_FILES%%/$INCLUDE_FEDORA_FILES/ + s/%%INCLUDE_RHEL_FILES%%/$INCLUDE_RHEL_FILES/ s/%%TARBALL_VERSION%%/$TARFILE_RELEASE/" "$SPECFILE"
echo "MARKER is $MARKER" 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 @@ -3,6 +3,11 @@ # environment changes that affect %%install need to go # here before the %%install macro is pre-built.
+# Include Fedora files +%global include_fedora %%INCLUDE_FEDORA_FILES%% +# Include RHEL files +%global include_rhel %%INCLUDE_RHEL_FILES%% + # Disable LTO in userspace packages. %global _lto_cflags %{nil}
@@ -685,8 +690,12 @@ Source1: Makefile.rhelver %define signing_key_filename kernel-signing-s390.cer %endif
+%if 0%{?include_rhel} Source8: x509.genkey.rhel +%endif +%if 0%{?include_fedora} Source9: x509.genkey.fedora +%endif
%if %{?released_kernel}
@@ -732,12 +741,17 @@ Source13: redhatsecureboot003.cer # released_kernel %endif
+%if 0%{?include_rhel} Source22: mod-extra.list.rhel +%endif +%if 0%{?include_fedora} Source16: mod-extra.list.fedora +%endif Source17: mod-denylist.sh Source18: mod-sign.sh Source79: parallel_xz.sh
+%if 0%{?include_fedora} Source80: filter-x86_64.sh.fedora Source81: filter-armv7hl.sh.fedora Source82: filter-i686.sh.fedora @@ -745,7 +759,9 @@ Source83: filter-aarch64.sh.fedora Source86: filter-ppc64le.sh.fedora Source87: filter-s390x.sh.fedora Source89: filter-modules.sh.fedora +%endif
+%if 0%{?include_rhel} Source90: filter-x86_64.sh.rhel Source91: filter-armv7hl.sh.rhel Source92: filter-i686.sh.rhel @@ -753,8 +769,10 @@ Source93: filter-aarch64.sh.rhel Source96: filter-ppc64le.sh.rhel Source97: filter-s390x.sh.rhel Source99: filter-modules.sh.rhel +%endif %define modsign_cmd %{SOURCE18}
+%if 0%{?include_rhel} Source20: kernel-aarch64-rhel.config Source21: kernel-aarch64-debug-rhel.config Source30: kernel-ppc64le-rhel.config @@ -764,7 +782,9 @@ Source33: kernel-s390x-debug-rhel.config Source34: kernel-s390x-zfcpdump-rhel.config Source35: kernel-x86_64-rhel.config Source36: kernel-x86_64-debug-rhel.config +%endif
+%if 0%{?include_fedora} Source37: kernel-aarch64-fedora.config Source38: kernel-aarch64-debug-fedora.config Source39: kernel-armv7hl-fedora.config @@ -779,7 +799,7 @@ Source47: kernel-s390x-fedora.config Source48: kernel-s390x-debug-fedora.config Source49: kernel-x86_64-fedora.config Source50: kernel-x86_64-debug-fedora.config - +%endif
Source51: generate_all_configs.sh
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413
From: Prarit Bhargava prarit@redhat.com
redhat/kernel.spec.template: Reorganize RHEL and Fedora specific files
Reorganize the RHEL and Fedora specific files into a single section.
Signed-off-by: Prarit Bhargava prarit@redhat.com
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 @@ -690,13 +690,6 @@ Source1: Makefile.rhelver %define signing_key_filename kernel-signing-s390.cer %endif
-%if 0%{?include_rhel} -Source8: x509.genkey.rhel -%endif -%if 0%{?include_fedora} -Source9: x509.genkey.fedora -%endif - %if %{?released_kernel}
Source10: redhatsecurebootca5.cer @@ -741,40 +734,19 @@ Source13: redhatsecureboot003.cer # released_kernel %endif
-%if 0%{?include_rhel} -Source22: mod-extra.list.rhel -%endif -%if 0%{?include_fedora} -Source16: mod-extra.list.fedora -%endif Source17: mod-denylist.sh Source18: mod-sign.sh Source79: parallel_xz.sh
-%if 0%{?include_fedora} -Source80: filter-x86_64.sh.fedora -Source81: filter-armv7hl.sh.fedora -Source82: filter-i686.sh.fedora -Source83: filter-aarch64.sh.fedora -Source86: filter-ppc64le.sh.fedora -Source87: filter-s390x.sh.fedora -Source89: filter-modules.sh.fedora -%endif - -%if 0%{?include_rhel} -Source90: filter-x86_64.sh.rhel -Source91: filter-armv7hl.sh.rhel -Source92: filter-i686.sh.rhel -Source93: filter-aarch64.sh.rhel -Source96: filter-ppc64le.sh.rhel -Source97: filter-s390x.sh.rhel -Source99: filter-modules.sh.rhel -%endif %define modsign_cmd %{SOURCE18}
%if 0%{?include_rhel} +Source8: x509.genkey.rhel + Source20: kernel-aarch64-rhel.config Source21: kernel-aarch64-debug-rhel.config +Source22: mod-extra.list.rhel + Source30: kernel-ppc64le-rhel.config Source31: kernel-ppc64le-debug-rhel.config Source32: kernel-s390x-rhel.config @@ -782,9 +754,20 @@ Source33: kernel-s390x-debug-rhel.config Source34: kernel-s390x-zfcpdump-rhel.config Source35: kernel-x86_64-rhel.config Source36: kernel-x86_64-debug-rhel.config + +Source90: filter-x86_64.sh.rhel +Source91: filter-armv7hl.sh.rhel +Source92: filter-i686.sh.rhel +Source93: filter-aarch64.sh.rhel +Source96: filter-ppc64le.sh.rhel +Source97: filter-s390x.sh.rhel +Source99: filter-modules.sh.rhel %endif
%if 0%{?include_fedora} +Source9: x509.genkey.fedora +Source16: mod-extra.list.fedora + Source37: kernel-aarch64-fedora.config Source38: kernel-aarch64-debug-fedora.config Source39: kernel-armv7hl-fedora.config @@ -799,6 +782,14 @@ Source47: kernel-s390x-fedora.config Source48: kernel-s390x-debug-fedora.config Source49: kernel-x86_64-fedora.config Source50: kernel-x86_64-debug-fedora.config + +Source80: filter-x86_64.sh.fedora +Source81: filter-armv7hl.sh.fedora +Source82: filter-i686.sh.fedora +Source83: filter-aarch64.sh.fedora +Source86: filter-ppc64le.sh.fedora +Source87: filter-s390x.sh.fedora +Source89: filter-modules.sh.fedora %endif
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413
From: Prarit Bhargava prarit@redhat.com
redhat/kernel.spec.template: Cleanup source numbering
Cleanup the numbering of the source files.
Signed-off-by: Prarit Bhargava prarit@redhat.com
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 @@ -734,72 +734,71 @@ Source13: redhatsecureboot003.cer # released_kernel %endif
-Source17: mod-denylist.sh -Source18: mod-sign.sh -Source79: parallel_xz.sh +Source20: mod-denylist.sh +Source21: mod-sign.sh +Source22: parallel_xz.sh
-%define modsign_cmd %{SOURCE18} +%define modsign_cmd %{SOURCE21}
%if 0%{?include_rhel} -Source8: x509.genkey.rhel +Source23: x509.genkey.rhel
-Source20: kernel-aarch64-rhel.config -Source21: kernel-aarch64-debug-rhel.config -Source22: mod-extra.list.rhel +Source24: kernel-aarch64-rhel.config +Source25: kernel-aarch64-debug-rhel.config +Source26: mod-extra.list.rhel
-Source30: kernel-ppc64le-rhel.config -Source31: kernel-ppc64le-debug-rhel.config -Source32: kernel-s390x-rhel.config -Source33: kernel-s390x-debug-rhel.config -Source34: kernel-s390x-zfcpdump-rhel.config -Source35: kernel-x86_64-rhel.config -Source36: kernel-x86_64-debug-rhel.config +Source27: kernel-ppc64le-rhel.config +Source28: kernel-ppc64le-debug-rhel.config +Source29: kernel-s390x-rhel.config +Source30: kernel-s390x-debug-rhel.config +Source31: kernel-s390x-zfcpdump-rhel.config +Source32: kernel-x86_64-rhel.config +Source33: kernel-x86_64-debug-rhel.config
-Source90: filter-x86_64.sh.rhel -Source91: filter-armv7hl.sh.rhel -Source92: filter-i686.sh.rhel -Source93: filter-aarch64.sh.rhel -Source96: filter-ppc64le.sh.rhel -Source97: filter-s390x.sh.rhel -Source99: filter-modules.sh.rhel +Source34: filter-x86_64.sh.rhel +Source35: filter-armv7hl.sh.rhel +Source36: filter-i686.sh.rhel +Source37: filter-aarch64.sh.rhel +Source38: filter-ppc64le.sh.rhel +Source39: filter-s390x.sh.rhel +Source40: filter-modules.sh.rhel %endif
%if 0%{?include_fedora} -Source9: x509.genkey.fedora -Source16: mod-extra.list.fedora - -Source37: kernel-aarch64-fedora.config -Source38: kernel-aarch64-debug-fedora.config -Source39: kernel-armv7hl-fedora.config -Source40: kernel-armv7hl-debug-fedora.config -Source41: kernel-armv7hl-lpae-fedora.config -Source42: kernel-armv7hl-lpae-debug-fedora.config -Source43: kernel-i686-fedora.config -Source44: kernel-i686-debug-fedora.config -Source45: kernel-ppc64le-fedora.config -Source46: kernel-ppc64le-debug-fedora.config -Source47: kernel-s390x-fedora.config -Source48: kernel-s390x-debug-fedora.config -Source49: kernel-x86_64-fedora.config -Source50: kernel-x86_64-debug-fedora.config - -Source80: filter-x86_64.sh.fedora -Source81: filter-armv7hl.sh.fedora -Source82: filter-i686.sh.fedora -Source83: filter-aarch64.sh.fedora -Source86: filter-ppc64le.sh.fedora -Source87: filter-s390x.sh.fedora -Source89: filter-modules.sh.fedora -%endif - - -Source51: generate_all_configs.sh - -Source52: process_configs.sh -Source56: update_scripts.sh -Source57: generate_crashkernel_default.sh - -Source54: mod-internal.list +Source50: x509.genkey.fedora +Source51: mod-extra.list.fedora + +Source52: kernel-aarch64-fedora.config +Source53: kernel-aarch64-debug-fedora.config +Source54: kernel-armv7hl-fedora.config +Source55: kernel-armv7hl-debug-fedora.config +Source56: kernel-armv7hl-lpae-fedora.config +Source57: kernel-armv7hl-lpae-debug-fedora.config +Source58: kernel-i686-fedora.config +Source59: kernel-i686-debug-fedora.config +Source60: kernel-ppc64le-fedora.config +Source61: kernel-ppc64le-debug-fedora.config +Source62: kernel-s390x-fedora.config +Source63: kernel-s390x-debug-fedora.config +Source64: kernel-x86_64-fedora.config +Source65: kernel-x86_64-debug-fedora.config + +Source67: filter-x86_64.sh.fedora +Source68: filter-armv7hl.sh.fedora +Source69: filter-i686.sh.fedora +Source70: filter-aarch64.sh.fedora +Source71: filter-ppc64le.sh.fedora +Source72: filter-s390x.sh.fedora +Source73: filter-modules.sh.fedora +%endif + +Source80: generate_all_configs.sh +Source81: process_configs.sh + +Source82: update_scripts.sh +Source83: generate_crashkernel_default.sh + +Source84: mod-internal.list
Source100: rheldup3.x509 Source101: rhelkpatch1.x509 @@ -1421,7 +1420,7 @@ cd configs
# Drop some necessary files from the source dir into the buildroot cp $RPM_SOURCE_DIR/kernel-*.config . -cp %{SOURCE51} . +cp %{SOURCE80} . # merge.pl cp %{SOURCE3000} . # kernel-local @@ -1469,7 +1468,7 @@ done %endif %endif
-cp %{SOURCE52} . +cp %{SOURCE81} . OPTS="" %if %{with_configchecks} OPTS="$OPTS -w -n -c" @@ -1481,7 +1480,7 @@ done %endif ./process_configs.sh $OPTS kernel %{rpmversion}
-cp %{SOURCE56} . +cp %{SOURCE82} . RPM_SOURCE_DIR=$RPM_SOURCE_DIR ./update_scripts.sh %{primary_target}
# end of kernel config @@ -2002,9 +2001,9 @@ BuildKernel() { remove_depmod_files
# Identify modules in the kernel-modules-extras package - %{SOURCE17} $RPM_BUILD_ROOT lib/modules/$KernelVer $RPM_SOURCE_DIR/mod-extra.list + %{SOURCE20} $RPM_BUILD_ROOT lib/modules/$KernelVer $RPM_SOURCE_DIR/mod-extra.list # Identify modules in the kernel-modules-extras package - %{SOURCE17} $RPM_BUILD_ROOT lib/modules/$KernelVer %{SOURCE54} internal + %{SOURCE20} $RPM_BUILD_ROOT lib/modules/$KernelVer %{SOURCE84} internal
# # Generate the kernel-core and kernel-modules files lists @@ -2105,7 +2104,7 @@ BuildKernel() { find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -delete
# Generate crashkernel default config - %{SOURCE57} "$KernelVer" "$Arch" "$RPM_BUILD_ROOT" + %{SOURCE83} "$KernelVer" "$Arch" "$RPM_BUILD_ROOT"
# Red Hat UEFI Secure Boot CA cert, which can be used to authenticate the kernel mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/kernel-keys/$KernelVer
-- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413
From: Prarit Bhargava on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413#note_6903823...
Fixed :)
From: Herton R. Krzesinski on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413#note_6904160...
I think this need an additional change on top: If INCLUDE_FEDORA_FILES is disabled, you don't need to copy ```fedora_files/*```. The same with INCLUDE_RHEL_FILES. It is harmless the way it is right now, however, when the maintainer does the dist-git sync, a diff file is generated, and those uneeded files which are copied will show on the diff saying they exist there but not on the dist-git sync copy (because they are not included on the src.rpm), so I think they must conditionally copied here.
From: Prarit Bhargava on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413#note_6904438...
Good point @hertonrk-rh. My plan is to remove the fedora_files, configs/fedora, priority.fedora, and update flavors in RHEL & centos-stream. Would that solve your concerns?
From: Herton R. Krzesinski on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413#note_6904957...
No, because there is a window in the future where we will use again kernel-ark to sync to dist-git (in next centos stream/rhel major version), and then we will still have fedora and rhel files in this case.
From: Herton R. Krzesinski on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413#note_6905029...
So the question here is if when we do the kernel-ark sync to centos/rhel dist- git next time, will we set INCLUDE_FEDORA_FILES to 0? I believe not, so from that use case we are fine here, in case we remove the fedora files on rhel/centos. so I think we are fine here for now.
From: Herton R. Krzesinski on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413#note_6905035...
Acked-by: Herton R. Krzesinski herton@redhat.com (via approve button)
From: Prarit Bhargava on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413#note_6905655...
Okay based on that I'm resolving the thread.
From: Justin M. Forbes on gitlab.com https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1413#note_6914107...
Acked-by: Justin M. Forbes jforbes@fedoraproject.org (via approve button)
kernel@lists.fedoraproject.org