diff --git a/SPECS/kernel.spec b/SPECS/kernel.spec index d3b5aaa..db25b07 100644 --- a/SPECS/kernel.spec +++ b/SPECS/kernel.spec @@ -19,7 +19,7 @@ %global distro_build 305 # Sign the x86_64 kernel for secure boot authentication -%ifarch x86_64 aarch64 +%ifarch x86_64 aarch64 s390x ppc64le %global signkernel 1 %else %global signkernel 0 @@ -211,6 +211,10 @@ %define with_ipaclones 0 %endif +%if %{?rhel}<=7 +%define with_kabichk 0 +%endif + # turn off kABI DUP check and DWARF-based check if kABI check is disabled %if !%{with_kabichk} %define with_kabidupchk 0 @@ -247,6 +251,10 @@ %define all_arch_configs %{name}-%{version}-*.config %endif +%if 0%{?rhel} == 7 +%define with_bootwrapper 0 +%endif + # sparse blows up on ppc %ifnarch ppc64le %define with_sparse 0 @@ -276,6 +284,9 @@ %define make_target vmlinux %define kernel_image vmlinux %define kernel_image_elf 1 +%if 0%{?rhel} == 7 +%define with_bootwrapper 1 +%endif %define all_arch_configs %{name}-%{version}-ppc64le*.config %define kcflags -O3 %endif @@ -323,7 +334,11 @@ # Packages that need to be installed before the kernel is, because the %%post # scripts use them. # +%if 0%{?rhel} == 7 +%define kernel_prereq fileutils, module-init-tools >= 3.16-2, initscripts >= 8.11.1-1, grubby >= 8.28-2 +%else %define kernel_prereq coreutils, systemd >= 203-2, /usr/bin/kernel-install +%endif %define initrd_prereq dracut >= 027 @@ -355,8 +370,19 @@ Requires: rt-setup # List the packages used during the kernel build # BuildRequires: kmod, patch, bash, coreutils, tar, git, which +%if 0%{?rhel} == 7 +BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl, make, diffutils, gawk, python-devel, python2-rpm-macros +%else BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk +%endif BuildRequires: gcc, binutils, redhat-rpm-config, hmaccalc, python3-devel +%if 0%{?rhel} == 7 +BuildRequires: devtoolset-8-build +BuildRequires: devtoolset-8-binutils +BuildRequires: devtoolset-8-gcc +BuildRequires: devtoolset-8-make +BuildRequires: python3-rpm-macros +%endif BuildRequires: net-tools, hostname, bc, bison, flex, elfutils-devel, dwarves %if %{with_doc} BuildRequires: xmlto, asciidoc, python3-sphinx @@ -381,12 +407,20 @@ BuildRequires: pciutils-devel %endif %endif %if %{with_bpftool} +%if %{?rhel}>7 BuildRequires: python3-docutils +%else +BuildRequires: python-docutils +%endif BuildRequires: zlib-devel binutils-devel %endif %if %{with_selftests} +%if 0%{?rhel} == 7 +BuildRequires: libcap-devel libcap-ng-devel llvm-toolset-7.0 numactl-devel rsync +%else BuildRequires: libcap-devel libcap-ng-devel clang llvm numactl-devel rsync libmnl-devel %endif +%endif BuildConflicts: rhbuildsys(DiskFree) < 500Mb %if %{with_debuginfo} BuildRequires: rpm-build, elfutils @@ -577,7 +611,7 @@ Requires(pre): linux-firmware >= 20200619-99.git3890db36\ Requires(preun): systemd >= 200\ Conflicts: xfsprogs < 4.3.0-1\ Conflicts: xorg-x11-drv-vmmouse < 13.0.99\ -Conflicts: kexec-tools < 2.0.20-8\ +Conflicts: kexec-tools < 2.0.15-42\ %{expand:%%{?kernel%{?1:_%{1}}_conflicts:Conflicts: %%{kernel%{?1:_%{1}}_conflicts}}}\ %{expand:%%{?kernel%{?1:_%{1}}_obsoletes:Obsoletes: %%{kernel%{?1:_%{1}}_obsoletes}}}\ %{expand:%%{?kernel%{?1:_%{1}}_provides:Provides: %%{kernel%{?1:_%{1}}_provides}}}\ @@ -659,29 +693,60 @@ This package provides debug information for the perf package. # the leading .*, because of find-debuginfo.sh's buggy handling # of matching the pattern against the symlinks file. %{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_bindir}/perf(\.debug)?|.*%%{_libexecdir}/perf-core/.*|.*%%{_libdir}/traceevent/plugins/.*|.*%%{_libdir}/libperf-jvmti.so(\.debug)?|XXX' -o perf-debuginfo.list} - +%if 0%{?rhel} == 7 +%package -n python-perf +%else %package -n python3-perf +%endif Summary: Python bindings for apps which will manipulate perf events Group: Development/Libraries +%if 0%{?rhel} == 7 +%description -n python-perf +The python-perf package contains a module that permits applications +%else %description -n python3-perf The python3-perf package contains a module that permits applications +%endif written in the Python programming language to use the interface to manipulate perf events. - +%if 0%{?rhel} == 7 +%package -n python-perf-debuginfo +%else %package -n python3-perf-debuginfo +%endif Summary: Debug information for package perf python bindings Group: Development/Debug Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release} AutoReqProv: no +%if 0%{?rhel} == 7 +%description -n python-perf-debuginfo +%else %description -n python3-perf-debuginfo +%endif This package provides debug information for the perf python bindings. # the python_sitearch macro should already be defined from above +%if 0%{?rhel} == 7 +%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{python_sitearch}/perf.*so(\.debug)?|XXX' -o python-perf-debuginfo.list} +%else %{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{python3_sitearch}/perf.*so(\.debug)?|XXX' -o python3-perf-debuginfo.list} +%endif # with_perf %endif +%if 0%{?rhel} == 7 +%if %{with_bootwrapper} +%package bootwrapper +Summary: Boot wrapper files for generating combined kernel + initrd images +Group: Development/System +Requires: gzip binutils +%description bootwrapper +kernel-bootwrapper contains the wrapper code which makes bootable "zImage" +files combining both kernel and initial ramdisk. +%endif +%endif + %if %{with_tools} %package -n %{name}-tools Summary: Assortment of tools for the Linux kernel @@ -1030,6 +1095,10 @@ input and output, etc. %endif %prep +%if 0%{?rhel} == 7 +source scl_source enable devtoolset-8 || : +source scl_source enable llvm-toolset-7.0 || : +%endif # do a few sanity-checks for --with *only builds %if %{with_baseonly} %if !%{with_up} @@ -1113,6 +1182,7 @@ mv COPYING COPYING-%{version} # This Prevents scripts/setlocalversion from mucking with our version numbers. touch .scmversion +%if 0%{?rhel}>7 # Do not use "ambiguous" python shebangs. RHEL 8 now has a new script # (/usr/lib/rpm/redhat/brp-mangle-shebangs), which forces us to specify a # "non-ambiguous" python shebang for scripts we ship in buildroot. This @@ -1123,10 +1193,11 @@ pathfix.py -i %{__python3} -p -n \ scripts/show_delta \ scripts/diffconfig \ scripts/bloat-o-meter \ - tools/perf/tests/attr.py \ + tools/perf/tests/attr.py tools/perf/scripts/python/stat-cpi.py \ tools/perf/scripts/python/stat-cpi.py \ tools/perf/scripts/python/sched-migration.py \ Documentation +%endif %define make make %{?cross_opts} HOSTCFLAGS="%{?build_hostcflags}" HOSTLDFLAGS="%{?build_hostldflags}" @@ -1195,6 +1266,10 @@ cd .. ### build ### %build +%if 0%{?rhel} == 7 +source scl_source enable devtoolset-8 || : +source scl_source enable llvm-toolset-7.0 || : +%endif %if %{with_sparse} %define sparse_mflags C=1 @@ -1791,8 +1866,13 @@ InitBuildVars %endif %endif +%if 0%{?rhel} == 7 +%global perf_make \ + make EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBBPF_DYNAMIC=1 prefix=%{_prefix} PYTHON=%{__python} +%else %global perf_make \ make EXTRA_CFLAGS="${RPM_OPT_FLAGS}" LDFLAGS="%{__global_ldflags}" %{?cross_opts} -C tools/perf V=1 NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBBPF_DYNAMIC=1 prefix=%{_prefix} PYTHON=%{__python3} +%endif %if %{with_perf} # perf # make sure check-headers.sh is executable @@ -1957,6 +2037,10 @@ find Documentation -type d | xargs chmod u+w ### %install +%if 0%{?rhel} == 7 +source scl_source enable devtoolset-8 || : +source scl_source enable llvm-toolset-7.0 || : +%endif cd linux-%{KVERREL} @@ -2084,6 +2168,8 @@ popd pushd tools/iio %{tools_make} DESTDIR=%{buildroot} install popd + +%if 0%{?rhel} > 7 pushd tools/gpio %{tools_make} DESTDIR=%{buildroot} install popd @@ -2093,6 +2179,7 @@ make INSTALL_ROOT=%{buildroot} install-tools make INSTALL_ROOT=%{buildroot} install-man install -m644 -D kvm_stat.service %{buildroot}%{_unitdir}/kvm_stat.service popd +%endif # install VM tools pushd tools/vm/ install -m755 slabinfo %{buildroot}%{_bindir}/slabinfo @@ -2185,6 +2272,12 @@ HEADERS_CHKSUM=$(export LC_ALL=C; find $RPM_BUILD_ROOT/usr/include -type f -name echo "#define KERNEL_HEADERS_CHECKSUM \"$HEADERS_CHKSUM\"" >> $RPM_BUILD_ROOT/usr/include/linux/version.h %endif +%if 0%{?rhel} == 7 +%if %{with_bootwrapper} +make %{?cross_opts} ARCH=%{hdrarch} DESTDIR=$RPM_BUILD_ROOT bootwrapper_install WRAPPER_OBJDIR=%{_libdir}/kernel-wrapper WRAPPER_DTSDIR=%{_libdir}/kernel-wrapper/dts +%endif +%endif + ### ### clean ### @@ -2281,6 +2374,18 @@ fi\ # %%kernel_variant_posttrans [] # More text can follow to go at the end of this variant's %%post. # + +%if 0%{?rhel} == 7 +%define kernel_variant_posttrans() \ +%{expand:%%posttrans %{?1:%{1}-}core}\ +if [ -x %{_sbindir}/weak-modules ]\ +then\ + %{_sbindir}/weak-modules --add-kernel %{KVERREL}%{?1:.%{1}} || exit $?\ +fi\ +%{_sbindir}/new-kernel-pkg --package kernel%{?-v:-%{-v*}} --mkinitrd --dracut --depmod --update %{KVERREL}%{?-v:.%{-v*}} || exit $?\ +%{_sbindir}/new-kernel-pkg --package kernel%{?1:-%{1}} --rpmposttrans %{KVERREL}%{?1:.%{1}} || exit $?\ +%{nil} +%else %define kernel_variant_posttrans() \ %{expand:%%posttrans %{?1:%{1}-}core}\ %if !%{with_realtime}\ @@ -2291,6 +2396,7 @@ fi\ %endif\ /bin/kernel-install add %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\ %{nil} +%endif # # This macro defines a %%post script for a kernel package and its devel package. @@ -2309,12 +2415,32 @@ if [ `uname -i` == "x86_64" -o `uname -i` == "i386" ] &&\ [ -f /etc/sysconfig/kernel ]; then\ /bin/sed -r -i -e 's/^DEFAULTKERNEL=%{-r*}$/DEFAULTKERNEL=kernel%{?-v:-%{-v*}}/' /etc/sysconfig/kernel || exit $?\ fi}\ +%if 0%{?rhel} == 7 \ +%{expand:\ +if [ -f /etc/sysconfig/kernel ]; then\ + /bin/sed -r -i -e 's/^DEFAULTKERNEL=kernel%{?-v:-%{-v*}}-core$/DEFAULTKERNEL=kernel%{?-v:-%{-v*}}/' /etc/sysconfig/kernel || exit $?\ +fi}\ +%{expand:\ +%{_sbindir}/new-kernel-pkg --package kernel%{?-v:-%{-v*}} --install %{KVERREL}%{?-v:.%{-v*}} || exit $?\ +}\ +%endif \ %{nil} # # This macro defines a %%preun script for a kernel package. # %%kernel_variant_preun # + +%if 0%{?rhel} == 7 +%define kernel_variant_preun() \ +%{expand:%%preun %{?1:%{1}-}core}\ +%{_sbindir}/new-kernel-pkg --rminitrd --rmmoddep --remove %{KVERREL}%{?1:.%{1}} || exit $?\ +if [ -x %{_sbindir}/weak-modules ]\ +then\ + %{_sbindir}/weak-modules --remove-kernel %{KVERREL}%{?1:.%{1}} || exit $?\ +fi\ +%{nil} +%else %define kernel_variant_preun() \ %{expand:%%preun %{?1:%{1}-}core}\ /bin/kernel-install remove %{KVERREL}%{?1:+%{1}} /lib/modules/%{KVERREL}%{?1:+%{1}}/vmlinuz || exit $?\ @@ -2325,6 +2451,7 @@ then\ fi\ %endif\ %{nil} +%endif %kernel_variant_preun %kernel_variant_post -r kernel-smp @@ -2402,15 +2529,24 @@ fi %doc linux-%{KVERREL}/tools/perf/Documentation/examples.txt %{_docdir}/perf-tip/tips.txt +%if 0%{?rhel} == 7 +%files -n python-perf +%defattr(-,root,root) +%{python_sitearch}/* +%else %files -n python3-perf %defattr(-,root,root) %{python3_sitearch}/* +%endif %if %{with_debuginfo} %files -f perf-debuginfo.list -n perf-debuginfo %defattr(-,root,root) - +%if 0%{?rhel} == 7 +%files -f python-perf-debuginfo.list -n python-perf-debuginfo +%else %files -f python3-perf-debuginfo.list -n python3-perf-debuginfo +%endif %defattr(-,root,root) %endif # with_perf @@ -2446,6 +2582,7 @@ fi %{_bindir}/iio_event_monitor %{_bindir}/iio_generic_buffer %{_bindir}/lsiio +%if 0%{?rhel} > 7 %{_bindir}/lsgpio %{_bindir}/gpio-hammer %{_bindir}/gpio-event-mon @@ -2453,6 +2590,7 @@ fi %{_bindir}/kvm_stat %{_unitdir}/kvm_stat.service %config(noreplace) %{_sysconfdir}/logrotate.d/kvm_stat +%endif %{_bindir}/page_owner_sort %{_bindir}/slabinfo @@ -2505,6 +2643,16 @@ fi %{_libexecdir}/kselftests %endif +%if 0%{?rhel} == 7 +%if %{with_bootwrapper} +%files bootwrapper +%defattr(-,root,root) +/usr/sbin/* +%exclude /usr/sbin/bpftool +%{_libdir}/kernel-wrapper +%endif +%endif + # empty meta-package %ifnarch %nobuildarches noarch %files @@ -2535,20 +2683,35 @@ fi %{!?_licensedir:%global license %%doc}\ %license linux-%{KVERREL}/COPYING-%{version}\ /lib/modules/%{KVERREL}%{?3:+%{3}}/%{?-k:%{-k*}}%{!?-k:vmlinuz}\ +%if 0%{?rhel} == 7\ +/%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}\ +/lib/modules/%{KVERREL}%{?3:+%{3}}/.vmlinuz.hmac \ +/%{image_install_path}/.vmlinuz-%{KVERREL}%{?3:+%{3}}.hmac \ +%else\ %ghost /%{image_install_path}/%{?-k:%{-k*}}%{!?-k:vmlinuz}-%{KVERREL}%{?3:+%{3}}\ /lib/modules/%{KVERREL}%{?3:+%{3}}/.vmlinuz.hmac \ %ghost /%{image_install_path}/.vmlinuz-%{KVERREL}%{?3:+%{3}}.hmac \ +%endif\ %ifarch aarch64\ /lib/modules/%{KVERREL}%{?3:+%{3}}/dtb \ %ghost /%{image_install_path}/dtb-%{KVERREL}%{?3:+%{3}} \ %endif\ %attr(0600, root, root) /lib/modules/%{KVERREL}%{?3:+%{3}}/System.map\ +%if 0%{?rhel} == 7\ +/boot/System.map-%{KVERREL}%{?3:+%{3}}\ +%else\ %ghost %attr(0600, root, root) /boot/System.map-%{KVERREL}%{?3:+%{3}}\ +%endif\ /lib/modules/%{KVERREL}%{?3:+%{3}}/symvers.gz\ /lib/modules/%{KVERREL}%{?3:+%{3}}/config\ +%if 0%{?rhel} == 7\ +/boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\ +/boot/config-%{KVERREL}%{?3:+%{3}}\ +%else\ %ghost %attr(0600, root, root) /boot/symvers-%{KVERREL}%{?3:+%{3}}.gz\ -%ghost %attr(0600, root, root) /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\ %ghost %attr(0644, root, root) /boot/config-%{KVERREL}%{?3:+%{3}}\ +%endif\ +%ghost %attr(0600, root, root) /boot/initramfs-%{KVERREL}%{?3:+%{3}}.img\ %dir /lib/modules\ %dir /lib/modules/%{KVERREL}%{?3:+%{3}}\ %dir /lib/modules/%{KVERREL}%{?3:+%{3}}/kernel\