%define coreplversion 6.11.9 %define tarballplversion 6.11.9 %define __spec_install_post /usr/lib/rpm/brp-compress || : %define debug_package %{nil} %undefine _disable_source_fetch %ifarch i686 %define pkgarch i686 %endif %ifarch x86_64 %define pkgarch x86_64 %endif %define releasever 1000%{?dist} %define plseries %(/bin/python3 -c 'print(".".join("%{coreplversion}".split(".")[:2]))') Name: kernel-palladium-legacy Summary: The Linux Kernel Version: %{coreplversion}_palladium_legacy Release: %{releasever} License: GPL Group: System Environment/Kernel Vendor: The Linux Community URL: http://www.kernel.org Source0: http://cdn.kernel.org/pub/linux/kernel/v6.x/linux-%{tarballplversion}.tar.xz Source1: http://universe2.us/collector/palladiumconfig-legacy.tar.xz #Patch1: http://universe2.us/collector/bfq_patch.patch %if "%{plseries}" == "6.1" %warn "Using old uarches patch" %define uarches_old 1 %endif %if %{defined uarches_old} Patch1: https://universe2.us/collector/uarches_old.patch %else Patch1: https://universe2.us/collector/uarches.patch %endif Provides: kernel = %{version} Provides: kernel-core = %{version} Provides: kernel-modules = %{version} Provides: kernel-modules-extra = %{version} Conflicts: kernel-palladium kernel-palladium-avx2 # Obsoletes: kernel-core kernel-modules kernel-modules-extra kernel ExclusiveArch: x86_64 Requires(pre): coreutils, systemd >= 203-2, /usr/bin/kernel-install, dracut >= 027 Requires(pre): /usr/bin/echo BuildRequires: kmod, patch, bash, tar, git, sed, clang, lld, llvm BuildRequires: bzip2, xz, findutils, gzip, m4, perl-interpreter, perl-Carp, perl-devel, perl-generators, make, diffutils, gawk BuildRequires: binutils, redhat-rpm-config, hmaccalc, bison, flex BuildRequires: net-tools, hostname, bc, elfutils-devel, wget, sparse, rpm-build, elfutils, openssl, openssl-devel, rsync %if "%{releasever}" != "fc40" && "${releasever}" != "fc39" BuildRequires: openssl-devel-engine %endif %description The Linux Kernel, the operating system core itself %package headers Summary: Header files for the Linux kernel for use by glibc Group: Development/System # Obsoletes: kernel-headers Provides: kernel-headers = %{version} Requires: kernel-palladium-legacy = %{version} %description headers Kernel-headers includes the C header files that specify the interface between the Linux kernel and userspace libraries and programs. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package. %package cross-headers Summary: Header files for the Linux kernel for use by cross-glibc Group: Development/System # Obsoletes: kernel-cross-headers Provides: kernel-cross-headers = %{version} Requires: kernel-palladium-legacy = %{version} %description cross-headers Kernel-cross-headers includes the C header files that specify the interface between the Linux kernel and userspace libraries and programs. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the cross-glibc package. %package devel Summary: Development package for building kernel modules to match the %{version} kernel Group: System Environment/Kernel AutoReqProv: no Requires: kernel-palladium-legacy = %{version} Provides: kernel-devel = %{version} # Obsoletes: kernel-devel %description devel This package provides kernel headers and makefiles sufficient to build modules against the %{version} kernel package. %prep %setup -q -n linux-%{tarballplversion} %patch 1 -p1 tar xvf %{SOURCE1} cp palladiumconfig-legacy.%{pkgarch} .config mv -fv logo_linux_clut224.ppm drivers/video/logo/ sed -e "s/_palladium_legacy/_palladium_legacy-%{releasever}.%{pkgarch}/" -i .config %build make %{!?nkjobs:%{?_smp_mflags}} %{?nkjobs} LLVM=1 LLVM_IAS=1 EXTRA_CFLAGS="-Wno-error -O3 -mtune=core2" KCFLAGS+="-Wno-error -O3 -mtune=core2" %install KBUILD_IMAGE=$(make image_name) mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= mod-fw= modules_install install -m 0755 $KBUILD_IMAGE $RPM_BUILD_ROOT/boot/vmlinuz-%{version}-%{releasever}.%{pkgarch} #Machine specific headers make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install find $RPM_BUILD_ROOT/usr/include \ \( -name .install -o -name .check -o \ -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f #Cross headers, for each non-x86_64 architecture for arch in arm arm64 powerpc s390; do make %{?_smp_mflags} ARCH=$arch INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr/${arch}-linux-gnu/ KBUILD_HEADERS=install headers_install find $RPM_BUILD_ROOT/usr/${arch}-linux-gnu/include \ \( -name .install -o -name .check -o \ -name ..install.cmd -o -name ..check.cmd \) | xargs rm -f done cp System.map $RPM_BUILD_ROOT/boot/System.map-%{version}-%{releasever}.%{pkgarch} cp .config $RPM_BUILD_ROOT/boot/config-%{version}-%{releasever}.%{pkgarch} rm -f $RPM_BUILD_ROOT/lib/modules/%{version}-%{releasever}.%{pkgarch}/build rm -f $RPM_BUILD_ROOT/lib/modules/%{version}-%{releasever}.%{pkgarch}/source mkdir -p $RPM_BUILD_ROOT/usr/src/kernels/%{version}-%{releasever}.%{pkgarch} EXCLUDES=" --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=firmware --exclude .config.old --exclude .missing-syscalls.d" tar $EXCLUDES -cf- . | (cd $RPM_BUILD_ROOT/usr/src/kernels/%{version}-%{releasever}.%{pkgarch};tar xvf -) cd $RPM_BUILD_ROOT/lib/modules/%{version}-%{releasever}.%{pkgarch} ln -sf /usr/src/kernels/%{version}-%{releasever}.%{pkgarch} build ln -sf /usr/src/kernels/%{version}-%{releasever}.%{pkgarch} source %clean rm -rf $RPM_BUILD_ROOT %pre if [ -d /lib/modules/%{version}-%{releasever}.%{pkgarch} ]; then umount -l /lib/modules/%{version}-%{releasever}.%{pkgarch} || true fi %posttrans if [ -x /usr/bin/kernel-install ]; then #new-kernel-pkg --install %{version}-%{releasever}.%{pkgarch} --mkinitrd --dracut --depmod --initrdfile=/boot/initramfs-%{version}-%{releasever}.%{pkgarch}.img kernel-install add %{version}-%{releasever}.%{pkgarch} /boot/vmlinuz-%{version}-%{releasever}.%{pkgarch} fi if ! test -f /boot/initramfs-%{version}-%{releasever}.%{pkgarch}.img; then #Bug in Fedora 30 with kernel initramfs generation dracut --kver %{version}-%{releasever}.%{pkgarch} fi if [ -f /etc/palladium.mksymlinks ]; then ln -sf /boot/vmlinuz-%{version}-%{releasever}.%{pkgarch} /boot/vmlinuz-pl.%{pkgarch} ln -sf /boot/initramfs-%{version}-%{releasever}.%{pkgarch}.img /boot/initramfs-pl.%{pkgarch}.img fi if [ -f /etc/palladium.easyefi ]; then /bin/cp /boot/vmlinuz-%{version}-%{releasever}.%{pkgarch} /boot/efi/vmlinuz /bin/cp /boot/initramfs-%{version}-%{releasever}.%{pkgarch}.img /boot/efi/initramfs.img fi %preun # Backup modules so we don't need to keep an outdated kernel installed and can remove the previous version. if [ `uname -r` = %{version}-%{releasever}.%{pkgarch} ]; then mkdir -p /tmp/modules-%{version}-%{releasever}.%{pkgarch} cp -a /lib/modules/%{version}-%{releasever}.%{pkgarch}/* /tmp/modules-%{version}-%{releasever}.%{pkgarch} fi if [ -x /usr/bin/kernel-install ]; then #new-kernel-pkg --remove %{version}-%{releasever}.%{pkgarch} --rminitrd --initrdfile=/boot/initramfs-%{version}-%{releasever}.%{pkgarch}.img kernel-install remove %{version}-%{releasever}.%{pkgarch} /boot/vmlinuz-%{version}-%{releasever}.%{pkgarch} fi %postun if [ -x /sbin/update-bootloader ]; then /sbin/update-bootloader --remove %{version}-%{releasever}.%{pkgarch} fi # Restore the modules into a tmpfs after we remove the package, until reboot. if [ `uname -r` = %{version}-%{releasever}.%{pkgarch} ]; then mkdir -p /lib/modules/%{version}-%{releasever}.%{pkgarch} mount -t tmpfs tmpfs /lib/modules/%{version}-%{releasever}.%{pkgarch} -o mode=0755 mv /tmp/modules-%{version}-%{releasever}.%{pkgarch}/* /lib/modules/%{version}-%{releasever}.%{pkgarch}/ rmdir /tmp/modules-%{version}-%{releasever}.%{pkgarch} restorecon -R /lib/modules/%{version}-%{releasever}.%{pkgarch} fi %files %defattr (-, root, root) /lib/modules/%{version}-%{releasever}.%{pkgarch} %exclude /lib/modules/%{version}-%{releasever}.%{pkgarch}/build %exclude /lib/modules/%{version}-%{releasever}.%{pkgarch}/source /boot/* %files headers %defattr (-, root, root) %{_includedir} %files cross-headers %defattr (-, root, root) /usr/*-linux-gnu/include/* %files devel %defattr (-, root, root) /usr/src/kernels/%{version}-%{releasever}.%{pkgarch} /lib/modules/%{version}-%{releasever}.%{pkgarch}/build /lib/modules/%{version}-%{releasever}.%{pkgarch}/source