# -*- Mode: rpm-spec -*- # # NOTE !!! # (tmb) Do NOT blindly backport this spec to Mageia 8 or older as packages # are renamed and spec is reworked in several incompatible ways... # # This Specfile is based on kernel-tmb spec done by # Thomas Backlund # # The mkflavour() macroization done by Anssi Hannula # # ---------------------------------------------------------------------------- # Consult this page for extra docs: # # https://wiki.mageia.org/en/Kernel_update_workflow # # (feel free to adjust the wiki-page when adding or removing features # to the spec file). # # After building a new kernel, remember to push the following packages # # kmod-virtualbox # kmod-xtables-addons # drakx-installer-images (both core and nonfree) # # and when a kernelversion or a patchlevel is bumped also update for newer modules: # # drakx/kernel/list_modules.pm # # ---------------------------------------------------------------------------- %define _binaries_in_noarch_packages_terminate_build 0 %define _unpackaged_files_terminate_build 0 # # Disable dwz to speed-up building %define _find_debuginfo_dwz_opts %{nil} # # Mageia kernels use kernel.org versioning # # Use %versionednamingscheme -> 1 to include versioning into package name, like in mga8 scheme %define versionednamingscheme 1 %if !%{versionednamingscheme} # kernel base name (for easy renaming of forked builds) %define kname kernel-mainline %endif %define kernelversion 6 # WARNING: when patchlevel is bumped, please update drakx/kernel/list_modules.pm for new modules!!! %define patchlevel 12 # sublevel is now used for -stable patches %define sublevel 0 # Package release %if %{versionednamingscheme} %define mgarel 0 %else %define rel 0 %endif # kernel Makefile extraversion is substituted by # rcX which are either 0 (empty), X (as in rcX) %define rcX 0 %if %{versionednamingscheme} # kernel base name (also name of srpm) %define kname kernel-mainline # Patch tarball tag %define ktag mga %define rpmtag %{distsuffix}%{mgaver} %endif %if %{versionednamingscheme} %if %{rcX} %define rpmrel %mkrel 0.rc%{rcX}.%{mgarel} %else %define rpmrel %mkrel %{mgarel} %endif %else %if %{rcX} %define rpmrel %mkrel 0.rc%{rcX}.%{rel} %else %define rpmrel %mkrel %{rel} %endif %endif %if %{versionednamingscheme} # fakerel and fakever never change, they are used to fool # rpm/urpmi/smart and ensure the kernels are installed, # not upgraded so old kernel is not overwritten or removed %define fakever 1 %define fakerel %mkrel 1 %endif # version defines %define kversion %{kernelversion}.%{patchlevel}.%{sublevel} %define kverrel %{kversion}-%{rpmrel} # When we are using a rcX patch, the tarball is a sublevel -1 %if %{rcX} %if %sublevel %define tar_ver %{kernelversion}.%{patchlevel} %else %define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1) %endif %else %define tar_ver %{kernelversion}.%{patchlevel} %endif %if %{versionednamingscheme} # Used for not making too long names for rpms or search paths %if %rcX %define buildrpmrel 0.rc%{rcX}.%{mgarel}%{rpmtag} %else %define buildrpmrel %{mgarel}%{rpmtag} %endif %define buildrel %{kversion}-%{buildrpmrel} %endif # Having different top level names for packges means that you have to remove # them by hard :( %define top_dir_name %{kname}-%{_arch} %define build_dir ${RPM_BUILD_DIR}/%{top_dir_name} %define src_dir %{build_dir}/linux-%{tar_ver} # Disable useless debug rpms... %global _enable_debug_packages %{nil} %global debug_package %{nil} %global __debug_package %{nil} %global __debug_install_post %{nil} %global _build_id_links none # no bytecompiling wanted as it breaks build on selftests we dont even ship # for older buildsystems %global _python_bytecompile_build 0 # for systems with >= rpm-mageia-setup-2.29-1.mga7 %global __brp_python_bytecompile %nil # Speed-up package building %global _binary_payload w9T0.zstdio #global _source_payload w7T0.zstdio # Build defines %define build_doc 1 %define build_uheaders 1 %define build_source 1 %define build_devel 1 %define build_debug 0 # Build desktop i586 / 4GB %ifarch %{ix86} %define build_desktop586 1 %endif # Build desktop (i686 / 64GB) / x86_64 / arm / aarch64 %define build_desktop 1 # Build server (i686 / 64GB)/x86_64 / aarch64 %ifnarch %{arm} %define build_server 0 %else %define build_server 0 %endif # build cpupower %ifnarch %{arm} aarch64 %define build_cpupower 0 %else %define build_cpupower 0 %endif # build perf %define build_perf 0 # bpf %define build_bpftool 1 %define build_libbpf 1 # compress modules with xz %ifnarch %{arm} %define build_modxz 1 %else %define build_modxz 0 %endif # End of user definitions # buildtime override flags %{?_without_desktop586: %global build_desktop586 0} %{?_without_desktop: %global build_desktop 0} %{?_without_server: %global build_server 0} %{?_without_doc: %global build_doc 0} %{?_without_uheaders: %global build_uheaders 0} %{?_without_source: %global build_source 0} %{?_without_devel: %global build_devel 0} %{?_without_debug: %global build_debug 0} %{?_without_perf: %global build_perf 0} %{?_without_cpupower: %global build_cpupower 0} %{?_without_bpftool: %global build_bpftool 0} %{?_without_libbpf: %global build_libbpf 0} %{?_without_modxz: %global build_modxz 0} %{?_with_desktop586: %global build_desktop586 1} %{?_with_desktop: %global build_desktop 1} %{?_with_server: %global build_server 1} %{?_with_doc: %global build_doc 1} %{?_with_uheaders: %global build_uheaders 1} %{?_with_source: %global build_source 1} %{?_with_devel: %global build_devel 1} %{?_with_debug: %global build_debug 1} %{?_with_perf: %global build_perf 1} %{?_with_cpupower: %global build_cpupower 1} %{?_with_bpftool: %global build_bpftool 1} %{?_with_libbpf: %global build_libbpf 1} %{?_with_modxz: %global build_modxz 1} # For the .nosrc.rpm %define build_nosrc 0 %{?_with_nosrc: %global build_nosrc 1} %if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi) %define kmake %make_build CC="$CC" %else %define kmake %make_build %endif # there are places where parallel make don't work %define smake make # Parallelize xargs invocations on smp machines %define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\ && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS") # arm(64) arch matching %define target_arch %(echo %{_arch} | sed -e 's/arm.*/arm/' -e 's/aarch64/arm64/') # # SRC RPM description # Summary: Linux kernel built for Mageia Name: %{kname} Version: %{kversion} Release: %{rpmrel} License: GPLv2 Group: System/Kernel and hardware ExclusiveArch: x86_64 #ExclusiveArch: %{ix86} x86_64 %{arm} aarch64 ExclusiveOS: Linux URL: https://www.kernel.org/ #################################################################### # # Sources # ### This is for full SRC RPM Source0: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.zst Source1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.sign ### This is for stripped SRC RPM %if %build_nosrc NoSource: 0 %endif # This is for disabling *config, mrproper, prepare, scripts on -devel rpms Source2: disable-mrproper-in-devel-rpms.patch Source4: README.kernel-sources # for creating stable queue patchlist Source5: generate-patchlist.sh # copy to patched source tree along with the defconfigs and run it Source10: defconfig-updater.sh Source09: defconfig-updater-simple.sh # x86_64 defconfigs Source11: defconfig-x86_64-desktop Source12: defconfig-x86_64-server # i386 defconfigs Source13: defconfig-i386-desktop586 Source14: defconfig-i386-desktop Source15: defconfig-i386-server # arm64 defconfigs Source16: defconfig-arm64-desktop Source17: defconfig-arm64-server # arm defconfigs Source18: defconfig-arm-desktop # config and systemd service file from fedora Source50: cpupower.service Source51: cpupower.config #################################################################### # # Patches # # Patch0 to Patch10 are for core kernel upgrades. # %if %sublevel Patch1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz %endif %if %{rcX} # (tmb) Created with: # wget https://git.kernel.org/torvalds/p/v5.10-rc7/v5.9 -O patch-5.10-rc7 # xz -6e patch-5.10-rc7 Patch2: patch-%{kernelversion}.%{patchlevel}-rc%{rcX}.xz %endif ### ### Stable Queue coalesced in one single Patch ### ### ### Stable Queue can be big ### Patches from 100-999 ### # # stable-queue coalesced into a single patch Patch100: stable-queue-coalesced-6.12-20241118.patch ### add patches here by copying contents of kernel matching queue-x.y from: ### https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/tree/ ### to SOURCES, generate patchlist with generate-patchlist.sh and paste it here ### Patch110: kernel-6.12-fix-btf.patch ### ### Arch ### Patches from 1000 ### # laptop needing pci=assign-busses (#18989, needs to be submitted upstream) Patch1000: x86-pci-toshiba-equium-a60-assign-busses.patch # If users choose a bad video mode, allow to jump to # a working one (TTL: forever) Patch1001: x86-boot-video-80x25-if-break.patch # Allow poweroff on UP machines running SMP kernels Patch1005: x86-default_poweroff_up_machines.patch # raise vmalloc to fix https://bugs.mageia.org/show_bug.cgi?id=904 Patch1010: x86-increase-default-minimum-vmalloc-area-by-64MB-to-192MB.patch # slows down boot Source1015: Revert-cpufreq-pcc-Enable-autoload-of-pcc-cpufreq-fo.patch # AMD #Patch1020: arch-x86-set-l2-cache-id-on-amd-processors.patch Patch1021: x86-documentation-add-documentation-about-cluster.patch # temporarily disabled (see bug#32082) Source1030: sched-fair-Multi-LLC-select_idle_sibling.patch # temporarily disabled (see bug#32082) Source1050: x86-fpu-xstate-Fix-PKRU-covert-channel.patch ### ### ACPI ### # CLEVO M360S acpi irq workaround Patch1100: acpi-CLEVO-M360S-disable_acpi_irq.patch # Clevo M720SR freezes with C3 Patch1105: acpi-processor-M720SR-limit-to-C2.patch ### ### Block ### # FIXME: Don't know know why this is needed Patch1200: scsi-megaraid-new-sysfs-name.patch # adds aliases to support upgrade from old dm-raid45 patch #Patch1215: dm-raid-aliases.patch # [disable floppy autoloading (mga #4696)] # apparently this breaks resume on certain hardware, weird (bug #31695) Source1220: block-floppy-disable-pnp-modalias.patch ### ### bpf ### ### ### Crypto ### ### ### cpufreq ### ### ### dma ### ### ### File-system ### # jbd2 ### ### FireWire ### # adding module aliases to ease upgrade from ieee1394 Patch1400: firewire-ieee1394-module-aliases.patch ### ### Firmware ### ### ### GPU/DRM ### # mga compat option #Patch1500: drm-gpu-drm-treat-nokmsboot-as-nomodeset.patch # Fix problems with DRM an libvibrant (https://bugs.mageia.org/show_bug.cgi?id=32235) #Patch1501: 0001-Revert-drm-amd-display-don-t-enable-DRM-CRTC-degamma.patch # amdgpu # switch SI and CIK from radeon to amdgpu Patch1520: drm-amdgpu-SI-and-CIK-enabled-by-default.patch # i915 # new Q57 Host Bridge id Patch1530: char-agp-intel-new-Q57-id.patch # https://bugzilla.kernel.org/show_bug.cgi?id=206653#c19 Patch1552: i2c_nvidia_gpu-change-err-into-info.patch # https://bugzilla.redhat.com/show_bug.cgi?id=2071209 Patch1553: 0003-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch # EVDI DisplayLink patchset (from https://github.com/DisplayLink/evdi) Patch1560: 0001-import-evdi-driver-1.14.7-kernel-6.12.patch Patch1561: 0001-Align-with-Linux-v6.11.patch ### ### gpio ### ### ### hwmon ### ### ### i2c ### ### ### io_uring ### ### ### iommu ### ### ### Input ### ### ### HID ### # surface bits # https://github.com/linux-surface/kernel/ #Patch1751: 0002-surface3-oemb-add-DMI-matches-for-Surface-3-with-bro.patch # amd_sfh Patch1800: hid-amd_sfh-check-that-sensors-are-enabled-before-set-get-report.patch ### ### kernel ### ### ### MFD ### ### ### misc ### ### ### MM ### ### ### Network ### # SiS 190 fixes Patch1900: net-sis190-fix-list-usage.patch # funziona ma per ora lo disabilitiamo # netfilter IFWLOG support Patch1910: net-netfilter-IFWLOG.patch Patch1911: net-netfilter-IFWLOG-mdv.patch Patch1912: net-netfilter-IFWLOG-2.6.35-buildfix.patch Patch1913: net-netfilter-IFWLOG-2.6.37-buildfix.patch Patch1914: net-ipv4-netfilter-ipt_IFWLOG-3.6-buildfix.patch Patch1915: net-netfilter-IFWLOG-3.7-buildfix.patch Patch1916: net-netfilter-IFWLOG-remove-unused-label.patch Patch1917: net-netfilter-ipt_IFWLOG-4.12-buildfix.patch Patch1918: net-netfilter-IFWLOG-5.0-buildfix.patch # funziona ma per ora lo disabilitiamo # netfilter psd support Patch1920: net-netfilter-psd.patch Patch1921: net-netfilter-psd-mdv.patch Patch1922: net-netfilter-psd-2.6.35-buildfix.patch Patch1923: net-netfilter-psd-fix-redefines.patch # rtw88 wifi # add alias for the replaced r8822be staging driver Patch1930: net-wireless-rtw88-add-r8822be-alias.patch # add alias for the replaced 8723de 3rdparty driver Patch1931: net-wireless-rtw88-add-8723de-alias.patch # iwlfiwi Patch1980: net-wireless-iwlwifi-add-new-pci-id-for-6235.patch Patch1981: wifi-iwlwifi-pcie-add-support-for-AX101NGW.patch ### ### PCI ### ### ### pinctrl ### ### ### Platform ### # Allow access to Shuttle WMI interface controls # (Mainly allow turning on/off webcam and wireless on Shuttle DA18IE and DA18IM) Source2050: platform-x86-add-shuttle-wmi-driver.patch Source2051: platform-x86-shuttle-wmi-drop-devinit-exit.patch Source2052: platform-x86-shuttle-wmi-4.2-buildfix.patch Source2053: platform-x86-shuttle-wmi-4.13-buildfix.patch Source2054: platform-x86-shuttle-wmi-kernel-5.5.patch ### ### PM ### ### ### Sound ### ### ### SPI ### ### ### Staging ### # add rtl8812 support (mga#21043) # from https://github.com/aircrack-ng/rtl8812au.git Patch2200: staging-rtl8812au.patch Patch2201: staging-rtl8812au-rename.patch Patch2202: staging-rtl8812au-Kconfig-Makefile.patch Patch2203: staging-rtl8812au-20231117.patch # bug mga#31965 Patch2204: 0001-Pull-device-0x0821-from-list-of-device-supported-by-.patch # Patch2205: 0122-Fix-change_beacon-for-kernel-6.7.patch Patch2206: 0123-Update-os_intfs.c-for-kernel-6.8.patch Patch2207: 0124-Update-usb_intf.c-for-kernel-6.8.patch Patch2208: 0128-Update-ioctl_cfg80211.c-support-for-kernel-6.9.patch # Patch2209: 0001-rtl8812au-add-missed-prototypes.patch Patch2210: 0005-rtl8812au-add-missed-prototypes.patch Patch2211: 0006-rtl8812au-add-suggested-braces-around-empty-body-in-.patch Patch2212: 0007-rtl8812au-add-suggested-braces-around-empty-body-in-.patch Patch2213: 0008-rtl8812au-add-suggested-braces-around-empty-body-in-.patch Patch2214: 0009-rtl8812au-add-suggested-braces-around-empty-body-in-.patch Patch2215: 0010-rtl8812au-add-missed-prototypes.patch Patch2216: 0002-rtl8812au-fix-warnings.patch ### ### Thermal ### ### ### Thunderbolt ### ### ### tpm ### ### ### USB ### Patch2300: hid-usbhid-IBM-BladeCenterHS20-quirk.patch Patch2310: usb-storage-unusual_devs-add-id.patch Patch2311: usb-storage-unusual_devs-add-id-2.6.37-buildfix.patch ### ### V4L ### # pwc driver name in /proc/bus/devices, /sys fix and "advertisement" removal Patch2400: media-usb-pwc-lie-in-proc-usb-devices.patch ### ### Video ### # Mageia framebuffer boot logo Patch2500: video-mageia-logo.patch ### ### Virt ### # fix gcc-10 build Patch2550: KVM-squelch-uninitialized-variable-warning.patch ### ### Tools ### # wipe powerpc reference so we can nuke dangling symlinks (mga#17676) #Patch2600: tools-testing-selftest-Makefile-remove-powerpc-reference.patch # fix perf build Patch2605: tools-perf-ui-include-slang.patch ### ### UAPI ### Patch2700: uapi-avoid-namespace-conflict-in-linux-posix_types.h.patch ### ### Python fixes ### Patch4000: linux-6.12-python3.patch ### ### TTY ### # broken rtla cleaner Patch6000: hack-broken-rtla-cleaner.patch # build binder_linux as module instead of builtin (from debian) Patch6001: android-enable-building-ashmem-and-binder-as-modules.patch Patch6002: export-symbols-needed-by-android-drivers.patch ### Fixes from FC kernel # Inspur Advantech PCI ids Patch7000: 0001-scsi-smartpqi-add-inspur-advantech-ids.patch # Vulcan AHCI PCI bar (aarch64) Patch7001: 0001-Vulcan-AHCI-PCI-bar-fix-for-Broadcom-Vulcan-early-si.patch ### ### Potpourri fixes from other distro kernels ### ### misc Patch20301: 0001-Use-BFQ-as-elevator-for-SQ-devices.patch ### from opensuse Patch29000: ACPI-video-Add-backlight-native-DMI-quirk-for-Lenovo.patch Patch29001: Input-elan_i2c-Add-deny-list-for-Lenovo-Yoga-Slim-7.patch Patch29002: Bluetooth-btmtk-Remove-resetting-mt7921-before-downl.patch Source29003: readahead-request-tunables.patch ### from debian/ubuntu Patch29900: x86-memtest-WARN-if-bad-RAM-found.patch # ### from fedora ### low latency ### # # ### BORE (https://github.com/firelzrd/bore-scheduler) Patch40000: 0001-linux6.12.y-bore5.7.3.patch # 500 Hz timer frequency Patch40001: 0001-add-500-Hz-timer-frequency.patch # # ### AMD P-State Patch41001: 0001-cpufreq-amd-pstate-Rename-MSR-and-shared-memory-spec.patch Patch41002: 0002-cpufreq-amd-pstate-Fix-non-kerneldoc-comment.patch Patch41003: 0003-cpufreq-amd-pstate-Don-t-update-CPPC-request-in-amd_.patch Patch41004: 0004-cpufreq-amd-pstate-Use-amd_pstate_update_min_max_lim.patch Patch41005: 0005-cpufreq-amd-pstate-Drop-needless-EPP-initialization.patch Patch41006: 0006-cpufreq-amd-pstate-Remove-the-redundant-verify-funct.patch Patch41007: 0007-cpufreq-amd-pstate-Set-the-initial-min_freq-to-lowes.patch Patch41008: 0008-cpufreq-amd-pstate-Call-amd_pstate_register-in-amd_p.patch Patch41009: 0009-cpufreq-amd-pstate-Call-amd_pstate_set_driver-in-amd.patch Patch41010: 0010-cpufreq-amd-pstate-Remove-the-switch-case-in-amd_pst.patch Patch41011: 0011-cpufreq-amd-pstate-Remove-the-redundant-amd_pstate_s.patch Patch41012: 0012-amd-pstate-Set-min_perf-to-nominal_perf-for-active-m.patch Patch41013: 0013-amd-pstate-Switch-to-amd-pstate-by-default-on-some-S.patch Patch41014: 0014-cpufreq-amd-pstate-ut-Add-fix-for-min-freq-unit-test.patch Patch41015: 0015-cpufreq-amd-pstate-Rename-functions-that-enable-CPPC.patch Patch41016: 0016-cpufreq-amd-pstate-Do-not-attempt-to-clear-MSR_AMD_C.patch Patch41017: 0017-cpufreq-amd-pstate-Call-cppc_set_epp_perf-in-the-ree.patch Patch41018: 0018-cpufreq-amd-pstate-Align-offline-flow-of-shared-memo.patch Patch41019: 0019-x86-mm-Don-t-disable-PCID-when-INVLPG-has-been-fixed.patch Patch41020: 0020-x86-cpufeatures-Rename-X86_FEATURE_FAST_CPPC-to-have.patch Patch41021: 0021-x86-cpufeatures-Add-X86_FEATURE_AMD_HETEROGENEOUS_CO.patch Patch41022: 0022-x86-cpu-Enable-SD_ASYM_PACKING-for-PKG-domain-on-AMD.patch Patch41023: 0023-x86-cpu-Add-CPU-type-to-struct-cpuinfo_topology.patch Patch41024: 0024-x86-amd-Use-heterogeneous-core-topology-for-identify.patch Patch41025: 0025-cpufreq-amd-pstate-Push-adjust_perf-vfunc-init-into-.patch Patch41026: 0026-cpufreq-amd-pstate-Move-registration-after-static-fu.patch Patch41027: 0027-x86-cpu-Enable-SD_ASYM_PACKING-for-PKG-domain-on-sys.patch ### AMD Cache Optimizer Patch41101: 0001-platform-x86-amd-amd_3d_vcache-Add-AMD-3D-V-Cache-op.patch Patch41102: 0002-platform-x86-amd-amd_3d_vcache-Add-sysfs-ABI-documen.patch ### Fix AMD DRM Patch41110: 0004-Partially-revert-drm-amd-amdgpu-add-pipe1-hardware-s.patch # custom # disable SMT at boot Source70000: 0001-disable-smt-at-boot.patch #END #################################################################### # Defines for the things that are needed for all the kernels # %define common_desc_kernel The kernel package contains the Linux kernel (vmlinuz), the core of your \ Mageia operating system. The kernel handles the basic functions \ of the operating system: memory allocation, process allocation, device \ input and output, etc. %define common_desc_kernel_smp This kernel relies on in-kernel smp alternatives to switch between up & smp \ mode depending on detected hardware. To force the kernel to boot in single \ processor mode, use the "nosmp" boot parameter. ### Global Requires/Provides %define requires1 bootloader-utils >= 1.16-1 %define requires2 dracut >= 046-2 %define requires3 kmod >= 12-2 %define requires4 sysfsutils >= 2.1.0-16 %define requires5 kernel-firmware >= 20190603-1 # ldetect-lst with SI/CIK swich from radeon to amdgpu %define requires6 ldetect-lst >= 0.6.25-1 %define kprovides1 %{kname} = %{kverrel} %define kprovides2 kernel = %{tar_ver} %define kprovides3 alsa = 1.0.26 %define kprovides_server drbd-api = 88 # conflict dkms packages that dont support kernel-6.2 %define kconflicts1 dkms-broadcom-wl < 6.30.223.271-66 %define kconflicts2 dkms-nvidia-current < 525.89.02-1 %define kconflicts3 dkms-nvidia470 < 470.161.03-2 # EOL upstream 12/2022 %define kconflicts4 dkms-nvidia390 < 390.157-2 %define kconflicts5 dkms-virtualbox < 7.0.6-1 %define kconflicts6 dkms-xtables-addons < 3.23-2 # (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd %define kconflicts7 btrfs-progs < 6.2.2-1 # (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd %define kconflicts8 radeon-firmware < 20230310-1 # (tmb) conflict old firmware to get the firmwares in initrd %define kconflicts9 kernel-firmware-nonfree < 20230320-1 # (tmb) conflict old microcode to get updated ones in initrd for early loading %define kconflicts10 microcode < 0.20230214-1 # (tmb) conflict old theme to get mga8 theme in initrd %define kconflicts11 mageia-gfxboot-theme < 4.5.14.11-2 # (tmb) conflict too old grub2(-efi) %define kconflicts12 grub2 < 2.02.0-15 %define kconflicts13 grub2-efi < 2.02.0-15 # (tmb) conflict too old efibootmgr %define kconflicts14 efibootmgr < 16-3 # (tmb) force new theme in initrd %define kconflicts15 mageia-theme < 8.0-2 Autoreqprov: no BuildRequires: gcc >= 12.2.1-0.20230121.1 BuildRequires: binutils >= 1:2.40-1 BuildRequires: kmod >= 12-2 BuildRequires: bc BuildRequires: gawk >= 5.2.0-4 # for crypto stuff BuildRequires: openssl BuildRequires: pkgconfig(openssl) # since 4.16 BuildRequires: bison BuildRequires: diffutils BuildRequires: dwarves BuildRequires: elfutils-devel BuildRequires: flex # for headers_install BuildRequires: rsync # for cpupower %if %{build_cpupower} BuildRequires: pkgconfig(libpci) %endif # for perf %if %{build_perf} BuildRequires: audit-devel BuildRequires: binutils-devel BuildRequires: gtk2-devel BuildRequires: libunwind-devel BuildRequires: newt-devel BuildRequires: python3-devel BuildRequires: zlib-devel BuildRequires: asciidoc BuildRequires: xmlto-notex BuildRequires: perl-devel BuildRequires: systemtap-sdt-devel BuildRequires: babeltrace-devel %ifarch %{ix86} x86_64 BuildRequires: numa-devel %endif %endif %if %{build_bpftool} BuildRequires: python3-docutils BuildRequires: cap-devel %endif %description %common_desc_kernel %ifnarch %{arm} %common_desc_kernel_smp %endif # mkflavour() name flavour processor # name: the flavour name in the package name # flavour: first parameter of CreateKernel() %define mkflavour() \ %if %{versionednamingscheme} \ %package -n %{kname}-%{1}-%{buildrel} \ Version: %{fakever} \ Release: %{fakerel} \ %else \ %package -n %{kname}-%{1} \ Version: %{kversion} \ Release: %{rpmrel} \ %endif \ Summary: %{expand:%{summary_%(echo %{1} | sed -e "s/-/_/")}} \ Group: System/Kernel and hardware \ Provides: should-restart = system \ Provides: installonlypkg(kernel) \ %if %{versionednamingscheme} \ Provides: %{kname}-%{1} \ Recommends: %{kname}-%{1}-latest \ %else \ Provides: %{kname}-%{1}-%{kverrel} \ %endif \ Provides: %kprovides1 %kprovides2 %kprovides3 \ %{expand:%%{?kprovides_%{1}:Provides: %{kprovides_%{1}}}} \ Requires(pre): %requires1 %requires2 %requires3 %requires4 \ Requires: %requires2 %requires5 %requires6 \ Conflicts: %kconflicts1 %kconflicts2 %kconflicts3 \ Conflicts: %kconflicts4 %kconflicts5 %kconflicts6 \ Conflicts: %kconflicts7 %kconflicts8 %kconflicts9 \ Conflicts: %kconflicts10 %kconflicts11 %kconflicts12 \ Conflicts: %kconflicts13 %kconflicts14 %kconflicts15 \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ Recommends: iw cpupower microcode \ %if %{versionednamingscheme} \ %description -n %{kname}-%{1}-%{buildrel} \ %else \ %description -n %{kname}-%{1} \ %endif \ %common_desc_kernel %{expand:%{info_%(echo %{1} | sed -e "s/-/_/")}} \ %ifnarch %{arm} \ %common_desc_kernel_smp \ %endif \ \ %if %build_devel \ %if %{versionednamingscheme} \ %package -n %{kname}-%{1}-devel-%{buildrel} \ Version: %{fakever} \ Release: %{fakerel} \ Summary: The kernel-devel files for %{kname}-%{1}-%{buildrel} \ %else \ %package -n %{kname}-%{1}-devel \ Version: %{kversion} \ Release: %{rpmrel} \ Summary: The kernel-devel files for %{kname}-%{1}-%{kverrel} \ %endif \ %if %{versionednamingscheme} \ Provides: %{kname}-devel = %{kverrel} \ Provides: %{kname}-%{1}-devel \ Recommends: %{kname}-%{1}-devel-latest \ %else \ Provides: installonlypkg(kernel) \ Provides: kernel-devel = %{kverrel} \ Provides: %{kname}-%{1}-devel-%{kverrel} \ %endif \ Group: Development/Kernel \ Requires: glibc-devel ncurses-devel make gcc perl \ Requires: gcc \ %ifarch x86_64 \ Requires: pkgconfig(libelf) \ %endif \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ %if %{versionednamingscheme} \ %description -n %{kname}-%{1}-devel-%{buildrel} \ %else \ %description -n %{kname}-%{1}-devel \ %endif \ This package contains the kernel files (headers and build tools) \ that should be enough to build additional drivers for \ %if %{versionednamingscheme} \ use with %{kname}-%{1}-%{buildrel}. \ %else \ use with %{kname}-%{1}-%{kverrel}. \ %endif \ \ If you want to build your own kernel, you need to install the full \ %if %{versionednamingscheme} \ %{kname}-source-%{buildrel} rpm. \ %else \ %{kname}-source rpm. \ %endif \ %endif \ \ %if %build_debug \ %if %{versionednamingscheme} \ %package -n %{kname}-%{1}-%{buildrel}-debuginfo \ Version: %{fakever} \ Release: %{fakerel} \ Summary: Files with debuginfo for %{kname}-%{1}-%{buildrel} \ %else \ %package -n %{kname}-%{1}-debuginfo \ Version: %{kversion} \ Release: %{rpmrel} \ Summary: Files with debuginfo for %{kname}-%{1}-%{kverrel} \ %endif \ Group: Development/Debug \ Provides: kernel-debug = %{kverrel} \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ %if %{versionednamingscheme} \ %description -n %{kname}-%{1}-%{buildrel}-debuginfo \ This package contains the files with debuginfo to aid in debug tasks \ when using %{kname}-%{1}-%{buildrel}. \ %else \ %description -n %{kname}-%{1}-debuginfo \ This package contains the files with debuginfo to aid in debug tasks \ when using %{kname}-%{1}-%{kverrel}. \ %endif \ \ If you need to look at debug information or use some application that \ needs debugging info from the kernel, this package may help. \ %endif \ \ %package -n %{kname}-%{1}-latest \ Version: %{kversion} \ Release: %{rpmrel} \ Summary: Virtual rpm for latest %{kname}-%{1} \ Group: System/Kernel and hardware \ %if %{versionednamingscheme} \ Requires: %{kname}-%{1}-%{buildrel} \ %else \ Requires: %{kname}-%{1}-%{kverrel} \ %endif \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ %if %{versionednamingscheme} \ Obsoletes: vboxadditions-kernel-%{1}-latest \ Obsoletes: kernel-tmb-%{1}-latest \ %endif \ %description -n %{kname}-%{1}-latest \ This package is a virtual rpm that aims to make sure you always have the \ latest %{kname}-%{1} installed... \ \ %if %build_devel \ %package -n %{kname}-%{1}-devel-latest \ Version: %{kversion} \ Release: %{rpmrel} \ Summary: Virtual rpm for latest %{kname}-%{1}-devel \ Group: Development/Kernel \ %if %{versionednamingscheme} \ Requires: %{kname}-%{1}-devel-%{buildrel} \ %else \ Requires: %{kname}-%{1}-devel-%{kverrel} \ %endif \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ %if %{versionednamingscheme} \ Provides: %{kname}-devel-latest \ %endif \ %description -n %{kname}-%{1}-devel-latest \ This package is a virtual rpm that aims to make sure you always have the \ latest %{kname}-%{1}-devel installed... \ %endif \ \ %if %{versionednamingscheme} \ %posttrans -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-posttrans \ %postun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-postun \ %else \ %posttrans -n %{kname}-%{1} -f kernel_files.%{1}-posttrans \ %postun -n %{kname}-%{1} -f kernel_files.%{1}-postun \ %endif \ \ %if %build_devel \ %if %{versionednamingscheme} \ %post -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-post \ %preun -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-preun \ %postun -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-postun \ %else \ %post -n %{kname}-%{1}-devel -f kernel_devel_files.%{1}-post \ %preun -n %{kname}-%{1}-devel -f kernel_devel_files.%{1}-preun \ %postun -n %{kname}-%{1}-devel -f kernel_devel_files.%{1}-postun \ %endif \ %endif \ \ %if %{versionednamingscheme} \ %files -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1} \ %else \ %files -n %{kname}-%{1} -f kernel_files.%{1} \ %endif \ %files -n %{kname}-%{1}-latest \ \ %if %build_devel \ %if %{versionednamingscheme} \ %files -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1} \ %else \ %files -n %{kname}-%{1}-devel -f kernel_devel_files.%{1} \ %endif \ %files -n %{kname}-%{1}-devel-latest \ %endif \ \ %if %build_debug \ %if %{versionednamingscheme} \ %files -n %{kname}-%{1}-%{buildrel}-debuginfo -f kernel_debug_files.%{1} \ %else \ %files -n %{kname}-%{1}-debuginfo -f kernel_debug_files.%{1} \ %endif \ %endif %ifarch %{ix86} # # kernel-desktop586: i586, smp-alternatives, 4GB # %if %build_desktop586 %define summary_desktop586 Linux kernel for desktop use with i586 and less than 4GB RAM %define info_desktop586 This kernel is compiled for desktop use, single or \ multiple i586 processor(s)/core(s) and less than 4GB RAM (usually 3-3.5GB \ detected, if you need/want to use all 4GB or more, install kernel-server), \ using HZ_1000, voluntary preempt, CFS cpu scheduler and cfq i/o scheduler. %mkflavour desktop586 %endif %endif # # kernel-desktop: i686, smp-alternatives, 64 GB / x86_64 / arm / aarch64 # %if %build_desktop %ifarch %{ix86} %define summary_desktop Linux Kernel for desktop use with i686 and up to 64GB RAM %define info_desktop This kernel is compiled for desktop use, single or \ multiple i686 processor(s)/core(s) and up to 64GB RAM, using HZ_1000, \ voluntary preempt, CFS cpu scheduler and cfq i/o scheduler. %else %define summary_desktop Linux Kernel for desktop use with %{_arch} %define info_desktop This kernel is compiled for desktop use, single or \ multiple %{_arch} processor(s)/core(s), using HZ_1000, voluntary preempt, \ CFS cpu scheduler and cfq i/o scheduler. %endif %mkflavour desktop %endif # # kernel-server: i686, smp-alternatives, 64 GB / x86_64 / aarch64 # %if %build_server %ifarch %{ix86} %define summary_server Linux Kernel for server use with i686 & 64GB RAM %define info_server This kernel is compiled for server use, single or \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using \ no preempt, HZ_100, CFS cpu scheduler and cfq i/o scheduler. %else %define summary_server Linux Kernel for server use with %{_arch} %define info_server This kernel is compiled for server use, single or \ multiple %{_arch} processor(s)/core(s), using no preempt, HZ_100, \ CFS cpu scheduler and cfq i/o scheduler. %endif %mkflavour server %endif # # kernel-source # %if %build_source %if %{versionednamingscheme} %package -n %{kname}-source-%{buildrel} Version: %{fakever} Release: %{fakerel} %else %package -n %{kname}-source Version: %{kversion} Release: %{rpmrel} Summary: The Linux source code for %{kname} Group: Development/Kernel Obsoletes: %{kname}-source-latest < %{kverrel} %endif Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils %if %{versionednamingscheme} Summary: The Linux source code for %{kname}-%{buildrel} Group: Development/Kernel Provides: kernel-source = %{kverrel} %endif Autoreqprov: no Buildarch: noarch %if %{versionednamingscheme} %description -n %{kname}-source-%{buildrel} %else %description -n %{kname}-source %endif The %{kname}-source package contains the source code files for the Mageia kernel. Theese source files are only needed if you want to build your own custom kernel that is better tuned to your particular hardware. If you only want the files needed to build 3rdparty (nVidia, Ati, dkms-*,...) drivers against, install the *-devel-* rpm that is matching your kernel. %if %{versionednamingscheme} # # kernel-source-latest: virtual rpm # %package -n %{kname}-source-latest Version: %{kversion} Release: %{rpmrel} Summary: Virtual rpm for latest %{kname}-source Group: Development/Kernel Requires: %{kname}-source-%{buildrel} Buildarch: noarch %description -n %{kname}-source-latest This package is a virtual rpm that aims to make sure you always have the latest %{kname}-source installed... %endif %endif # # kernel-doc: documentation for the Linux kernel # %if %build_doc %package -n %{kname}-doc Version: %{kversion} Release: %{rpmrel} Summary: Various documentation bits found in the %{kname} source Group: Documentation Buildarch: noarch %description -n %{kname}-doc This package contains documentation files from the %{kname} source. Various bits of information about the Linux kernel and the device drivers shipped with it are documented in these files. You also might want install this package if you need a reference to the options that can be passed to Linux kernel modules at load time. %endif # # kernel userspace-headers # %if %{build_uheaders} %package -n %{kname}-userspace-headers Version: %{kversion} Release: %{rpmrel} Summary: Linux kernel header files for userspace Group: System/Kernel and hardware %rename linux-userspace-headers Provides: kernel-headers = 1:%{version}-%{release} %description -n %{kname}-userspace-headers C header files from the Linux kernel. The header files define structures and constants that are needed for building most standard programs. This package is not suitable for building kernel modules. %endif # # kernel/tools # %if %{build_perf} %package -n perf Version: %{kversion} Release: %{rpmrel} Summary: perf tool and the supporting documentation Group: System/Kernel and hardware %description -n perf the perf tool and the supporting documentation. %endif %if %{build_cpupower} %package -n cpupower Version: %{kversion} Release: %{rpmrel} Summary: the cpupower tools Group: System/Kernel and hardware Requires(post): rpm-helper >= 0.24.8-1 Requires(preun): rpm-helper >= 0.24.8-1 %description -n cpupower the cpupower tools. %post -n cpupower %_post_service cpupower %preun -n cpupower %_preun_service cpupower %package -n cpupower-devel Version: %{kversion} Release: %{rpmrel} Summary: devel files for cpupower Group: Development/Kernel Requires: cpupower = %{kversion}-%{rpmrel} Conflicts: %{_lib}cpufreq-devel %description -n cpupower-devel This package contains the development files for cpupower. %endif %if %{build_bpftool} %package -n bpftool %if !%{versionednamingscheme} Version: %{kversion} Release: %{rpmrel} %endif Summary: Inspection and simple manipulation of eBPF programs and maps Group: System/Kernel and hardware %description -n bpftool This package contains the bpftool, which allows inspection and simple manipulation of eBPF programs and maps. %endif %if %{build_libbpf} %define bpfmajor 1 %package -n %{_lib}bpf%{bpfmajor} %if !%{versionednamingscheme} Version: %{kversion} Release: %{rpmrel} %endif Summary: The bpf library from kernel source Group: System/Libraries %description -n %{_lib}bpf%{bpfmajor} This package contains the kernel source bpf library. %package -n %{_lib}bpf-devel %if %{versionednamingscheme} Version: %{kversion} Release: %{rpmrel} %endif Summary: Developement files for the bpf library from kernel source Group: Development/Kernel Requires: %{_lib}bpf%{bpfmajor} %description -n %{_lib}bpf-devel This package includes libraries and header files needed for development of applications which use bpf library from kernel source. %endif # # End packages - here begins build stage # %prep %setup -q -n %top_dir_name -c cd %src_dir %autopatch -p1 # PATCH END # # Setup Begin # # install x86 defconfigs install -m 644 %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} %{SOURCE15} arch/x86/configs/ # install arm64 defconfigs install -m 644 %{SOURCE16} %{SOURCE17} arch/arm64/configs/ # install arm defconfigs install -m 644 %{SOURCE18} arch/arm/configs/ # make sure the kernel has the sublevel we know it has... LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile # get rid of unwanted files find . -name '*~' -o -name '*.orig' -o -name '*.append' | %kxargs rm -f # fix missing exec flag on file introduced in 4.14.10-rc1 chmod 755 tools/objtool/sync-check.sh %build # Common target directories %if %{versionednamingscheme} %define _kerneldir /usr/src/kernel-%{kversion}-%{buildrpmrel} %endif %define _bootdir /boot %define _modulesdir /lib/modules %if %{versionednamingscheme} %define _srcdir /usr/src/kernel-%{kversion}-%{buildrpmrel} %define _efidir %{_bootdir}/efi/mageia %else %define _srcdir /usr/src/kernel-%{kversion}-%{rpmrel} %endif # Directories definition needed for building %define temp_root %{build_dir}/temp-root %define temp_boot %{temp_root}%{_bootdir} %define temp_modules %{temp_root}%{_modulesdir} %define temp_source %{temp_root}%{_srcdir} PrepareKernel() { name=$1 extension=$2 %if %{versionednamingscheme} echo "Make config for kernel $extension" %else echo "Make config for kernel %{kversion}-$extension" %endif %smake ARCH=%{target_arch} -s mrproper if [ "%{target_arch}" == "i386" -o "%{target_arch}" == "x86_64" ]; then conf_dir=arch/x86/configs else conf_dir=arch/%{target_arch}/configs fi if [ -z "$name" ]; then cp $conf_dir/defconfig-%{target_arch}-desktop .config else cp $conf_dir/defconfig-%{target_arch}-$name .config fi # make sure EXTRAVERSION says what we want it to say LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -$extension/" Makefile %smake ARCH=%{target_arch} oldconfig } BuildKernel() { KernelVer=$1 echo "Building kernel $KernelVer" %kmake ARCH=%{target_arch} -s all # Start installing stuff install -d %{temp_boot} install -m 644 System.map %{temp_boot}/System.map-$KernelVer install -m 644 .config %{temp_boot}/config-$KernelVer xz -c Module.symvers > %{temp_boot}/symvers-$KernelVer.xz %ifarch %{arm} IMAGE=zImage %else %ifarch aarch64 IMAGE=Image.gz %else IMAGE=bzImage %endif %endif cp -f arch/%{target_arch}/boot/$IMAGE %{temp_boot}/vmlinuz-$KernelVer %ifarch %{arm} aarch64 %if %{versionednamingscheme} install -d %{temp_root}%{_libdir}/linux-$KernelVer/ find arch/%{target_arch}/boot/dts/ -name *.dtb -execdir install -D -m644 {} %{temp_root}%{_libdir}/linux-$KernelVer/{} \; %else install -d %{temp_modules}/$KernelVer/dtb %{make} ARCH=%{target_arch} dtbs INSTALL_DTBS_PATH=%{temp_modules}/$KernelVer/dtb %{make} ARCH=%{target_arch} dtbs_install INSTALL_DTBS_PATH=%{temp_modules}/$KernelVer/dtb %endif %endif # modules install -d %{temp_modules}/$KernelVer %smake ARCH=%{target_arch} INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install } SaveDevel() { devel_flavour=$1 %if %{versionednamingscheme} DevelRoot=/usr/src/kernel-%{kversion}-$devel_flavour-%{buildrpmrel} %else DevelRoot=/usr/src/kernel-%{kversion}-$devel_flavour-%{rpmrel} %endif TempDevelRoot=%{temp_root}$DevelRoot mkdir -p $TempDevelRoot for i in $(find . -name 'Makefile*'); do cp -R --parents $i $TempDevelRoot;done for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*'); do cp -R --parents $i $TempDevelRoot;done cp -fR include $TempDevelRoot cp -fR scripts $TempDevelRoot cp -fR kernel/bounds.c $TempDevelRoot/kernel cp -fR tools/include $TempDevelRoot/tools/ # needed for selinux cp -R --parents security/selinux/include/*.h $TempDevelRoot %ifarch %{arm} cp -fR arch/%{target_arch}/tools $TempDevelRoot/arch/%{target_arch}/ cp -fR arch/%{target_arch}/kernel/signal.h $TempDevelRoot/arch/%{target_arch}/kernel/ %endif %ifarch aarch64 cp -fR arch/x86/entry/syscalls/syscall_32.tbl $TempDevelRoot/arch/x86/entry/syscalls/ cp -fR arch/arm64/kernel/vdso/*.{S,sh} $TempDevelRoot/arch/arm64/kernel/vdso/ cp -fR arch/arm64/kernel/vdso/vgettimeofday.c $TempDevelRoot/arch/arm64/kernel/vdso/ # cp -fR arch/arm64/tools/{cpucaps,gen-cpucaps.awk,gen-sysreg.awk,sysreg} $TempDevelRoot/arch/arm64/tools/ # aarch64 build wants x86 syscall tables cp -fR arch/x86/entry/syscalls/syscall_{32,64}.tbl $TempDevelRoot/arch/x86/entry/syscalls/ cp -fR lib/vdso/gettimeofday.c $TempDevelRoot/lib/vdso/ %endif %ifarch %{ix86} x86_64 cp -fR arch/x86/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/x86/kernel/ cp -fR arch/x86/kernel/asm-offsets_{32,64}.c $TempDevelRoot/arch/x86/kernel/ mkdir -p $TempDevelRoot/arch/x86/kvm/vmx cp -fR arch/x86/kvm/vmx/*.h $TempDevelRoot/arch/x86/kvm/vmx/ cp -fR arch/x86/kvm/*.h $TempDevelRoot/arch/x86/kvm/ cp -fR arch/x86/lib/insn.c $TempDevelRoot/arch/x86/lib/ cp -fR arch/x86/purgatory/* $TempDevelRoot/arch/x86/purgatory/ cp -fR arch/x86/entry/syscalls/syscall* $TempDevelRoot/arch/x86/entry/syscalls/ cp -fR arch/x86/include $TempDevelRoot/arch/x86/ cp -fR arch/x86/tools $TempDevelRoot/arch/x86/ %else cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/%{target_arch}/kernel/ for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f $TempDevelRoot; done %endif cp -fR .config Module.symvers $TempDevelRoot # Needed for truecrypt build (Danny) cp -fR drivers/md/dm.h $TempDevelRoot/drivers/md/ # needed by include/generated/timeconst.h cp -fR kernel/time/timeconst.bc $TempDevelRoot/kernel/time/ # Needed for lirc_gpio (#39004) cp -fR drivers/media/pci/bt8xx/bttv{,p}.h $TempDevelRoot/drivers/media/pci/bt8xx/ cp -fR drivers/media/pci/bt8xx/bt848.h $TempDevelRoot/drivers/media/pci/bt8xx/ # rtl8812au mkdir -p $TempDevelRoot/drivers/staging/rtl8812au/hal/phydm/ cp -f drivers/staging/rtl8812au/hal/phydm/phydm.mk $TempDevelRoot/drivers/staging/rtl8812au/hal/phydm/ %ifarch x86_64 # orc unwinder needs theese cp -fR tools/build/Build.include $TempDevelRoot/tools/build cp -fR tools/build/fixdep.c $TempDevelRoot/tools/build cp -fR tools/lib/{rbtree.c,ctype.c,str_error_r.c,string.c} $TempDevelRoot/tools/lib cp -fR tools/lib/subcmd/* $TempDevelRoot/tools/lib/subcmd cp -fR tools/objtool/* $TempDevelRoot/tools/objtool cp -fR tools/scripts/utilities.mak $TempDevelRoot/tools/scripts mkdir -p $TempDevelRoot/tools/arch/x86/tools cp -fR tools/arch/x86/tools/gen-insn-attr-x86.awk $TempDevelRoot/tools/arch/x86/tools/ mkdir -p $TempDevelRoot/tools/arch/x86/lib cp -fR tools/arch/x86/lib/{inat.c,insn.c,x86-opcode-map.txt} $TempDevelRoot/tools/arch/x86/lib/ mkdir -p $TempDevelRoot/tools/arch/x86/include/asm cp -fR tools/arch/x86/include/asm/{asm.h,emulate_prefix.h,inat.h,inat_types.h,insn.h,nops.h,orc_types.h} $TempDevelRoot/tools/arch/x86/include/asm/ %endif for i in alpha arc avr32 blackfin c6x cris csky frv h8300 hexagon ia64 loongarch m32r m68k m68knommu metag microblaze \ mips mn10300 nds32 nios2 openrisc parisc powerpc riscv s390 score sh sparc tile unicore32 xtensa; do rm -rf $TempDevelRoot/arch/$i rm -rf $TempDevelRoot/scripts/dtc/include-prefixes/$i rm -rf $TempDevelRoot/tools/arch/$i done %ifnarch %{arm} aarch64 rm -rf $TempDevelRoot/arch/arm* rm -rf $TempDevelRoot/include/kvm/arm* rm -rf $TempDevelRoot/include/soc rm -rf $TempDevelRoot/scripts/dtc/include-prefixes/arm* rm -rf $TempDevelRoot/tools/arch/arm* %endif %ifnarch %{ix86} x86_64 rm -rf $TempDevelRoot/arch/x86 rm -rf $TempDevelRoot/tools/arch/x86 # arch/x86/ras/Kconfig is included by drivers/ras/Kconfig # and kconfig's source command seems to be evaluated even under a false conditional mkdir -p $TempDevelRoot/arch/x86/ras cp -fR arch/x86/ras/Kconfig $TempDevelRoot/arch/x86/ras %endif # (6.1 breakage) keep crypto Kconfig deps happy cp --parents arch/arm/crypto/Kconfig $TempDevelRoot cp --parents arch/arm64/crypto/Kconfig $TempDevelRoot cp --parents arch/loongarch/crypto/Kconfig $TempDevelRoot cp --parents arch/mips/crypto/Kconfig $TempDevelRoot cp --parents arch/powerpc/crypto/Kconfig $TempDevelRoot cp --parents arch/s390/crypto/Kconfig $TempDevelRoot cp --parents arch/sparc/crypto/Kconfig $TempDevelRoot cp --parents arch/x86/crypto/Kconfig $TempDevelRoot cp --parents arch/riscv/crypto/Kconfig $TempDevelRoot # Clean the scripts tree, and make sure everything is ok (sanity check) # running prepare+scripts (tree was already "prepared" in build) pushd $TempDevelRoot >/dev/null %smake ARCH=%{target_arch} -s prepare scripts %smake ARCH=%{target_arch} -s clean popd >/dev/null rm -f $TempDevelRoot/.config.old # fix permissions chmod -R a+rX $TempDevelRoot # disable mrproper in -devel rpms patch -p1 --fuzz=0 -d $TempDevelRoot -i %{SOURCE2} kernel_devel_files=../kernel_devel_files.$devel_flavour ### Create the kernel_devel_files.* cat > $kernel_devel_files < $kernel_devel_files-post < $kernel_devel_files-preun < $kernel_devel_files-postun </dev/null fi %else if [ -d /usr/src/kernel-%{kversion}-$devel_flavour-%{rpmrel} ]; then rm -rf /usr/src/kernel-%{kversion}-$devel_flavour-%{rpmrel} >/dev/null fi %endif EOF } SaveDebug() { debug_flavour=$1 install -m 644 vmlinux \ %if %{versionednamingscheme} %{temp_boot}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel} %else %{temp_boot}/vmlinux-%{kversion}-$debug_flavour-%{rpmrel} %endif kernel_debug_files=../kernel_debug_files.$debug_flavour %if %{versionednamingscheme} echo "%{_bootdir}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel}" \ %else echo "%{_bootdir}/vmlinux-%{kversion}-$debug_flavour-%{rpmrel}" \ %endif >> $kernel_debug_files %if %{versionednamingscheme} find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ %else find %{temp_modules}/%{kversion}-$debug_flavour-%{rpmrel}/kernel \ %endif -name "*.ko" | \ %kxargs -I '{}' objcopy --only-keep-debug '{}' '{}'.debug %if %{versionednamingscheme} find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ %else find %{temp_modules}/%{kversion}-$debug_flavour-%{rpmrel}/kernel \ %endif -name "*.ko" | %kxargs -I '{}' \ sh -c 'cd `dirname {}`; \ objcopy --add-gnu-debuglink=`basename {}`.debug \ --strip-debug `basename {}`' pushd %{temp_modules} %if %{versionednamingscheme} find %{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ %else find %{kversion}-$debug_flavour-%{rpmrel}/kernel \ %endif -name "*.ko.debug" > debug_module_list popd cat %{temp_modules}/debug_module_list | \ sed 's|\(.*\)|%{_modulesdir}/\1|' >> $kernel_debug_files cat %{temp_modules}/debug_module_list | \ sed 's|\(.*\)|%exclude %{_modulesdir}/\1|' \ >> ../kernel_exclude_debug_files.$debug_flavour rm -f %{temp_modules}/debug_module_list } CreateFiles() { kernel_flavour=$1 kernel_files=../kernel_files.$kernel_flavour ker="vmlinuz" ### Create the kernel_files.* cat > $kernel_files <> $kernel_files %endif ### Create kernel Posttrans script cat > $kernel_files-posttrans < /dev/null %if %{versionednamingscheme} if [ -e initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img ]; then ln -sf vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel} vmlinuz-$kernel_flavour ln -sf vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel} vmlinuz ln -sf initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img initrd-$kernel_flavour.img ln -sf initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img initrd.img %else if [ -e initrd-%{kversion}-$kernel_flavour-%{rpmrel}.img ]; then ln -sf vmlinuz-%{kversion}-$kernel_flavour-%{rpmrel} vmlinuz-$kernel_flavour ln -sf vmlinuz-%{kversion}-$kernel_flavour-%{rpmrel} vmlinuz ln -sf initrd-%{kversion}-$kernel_flavour-%{rpmrel}.img initrd-$kernel_flavour.img ln -sf initrd-%{kversion}-$kernel_flavour-%{rpmrel}.img initrd.img %endif fi popd > /dev/null EOF ### Create kernel Postun script on the fly cat > $kernel_files-postun < /dev/null %if %{versionednamingscheme} if [ -f "vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel}" ]; then %else if [ -f "vmlinuz-%{kversion}-$kernel_flavour-%{rpmrel}" ]; then %endif echo "The kernel is still installed in postun, probably a reinstall, skipping cleanup." >&2 exit fi if [ -L vmlinuz-$kernel_flavour ]; then %if %{versionednamingscheme} if [ "\$(readlink vmlinuz-$kernel_flavour)" = "vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel}" ]; then %else if [ "\$(readlink vmlinuz-$kernel_flavour)" = "vmlinuz-%{kversion}-$kernel_flavour-%{rpmrel}" ]; then %endif rm -f vmlinuz-$kernel_flavour fi fi if [ -L initrd-$kernel_flavour.img ]; then %if %{versionednamingscheme} if [ "\$(readlink initrd-$kernel_flavour.img)" = "initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img" ]; then %else if [ "\$(readlink initrd-$kernel_flavour.img)" = "initrd-%{kversion}-$kernel_flavour-%{rpmrel}.img" ]; then %endif rm -f initrd-$kernel_flavour.img fi fi popd > /dev/null %if %{versionednamingscheme} if [ -d /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel} ]; then rm -rf /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel} >/dev/null fi /sbin/kernel_remove_initrd %{kversion}-$kernel_flavour-%{buildrpmrel} /sbin/installkernel -R %{kversion}-$kernel_flavour-%{buildrpmrel} %else if [ -d /lib/modules/%{kversion}-$kernel_flavour-%{rpmrel} ]; then rm -rf /lib/modules/%{kversion}-$kernel_flavour-%{rpmrel} >/dev/null fi /sbin/kernel_remove_initrd %{kversion}-$kernel_flavour-%{rpmrel} /sbin/installkernel -R %{kversion}-$kernel_flavour-%{rpmrel} %endif if [ -d /var/lib/dkms ]; then %if %{versionednamingscheme} rm -f /var/lib/dkms/*/kernel-%{kversion}-$devel_flavour-%{buildrpmrel}-%{_target_cpu} >/dev/null rm -rf /var/lib/dkms/*/*/%{kversion}-$devel_flavour-%{buildrpmrel} >/dev/null rm -f /var/lib/dkms-binary/*/kernel-%{kversion}-$devel_flavour-%{buildrpmrel}-%{_target_cpu} >/dev/null rm -rf /var/lib/dkms-binary/*/*/%{kversion}-$devel_flavour-%{buildrpmrel} >/dev/null %else rm -f /var/lib/dkms/*/kernel-%{kversion}-$devel_flavour-%{rpmrel}-%{_target_cpu} >/dev/null rm -rf /var/lib/dkms/*/*/%{kversion}-$devel_flavour-%{rpmrel} >/dev/null rm -f /var/lib/dkms-binary/*/kernel-%{kversion}-$devel_flavour-%{rpmrel}-%{_target_cpu} >/dev/null rm -rf /var/lib/dkms-binary/*/*/%{kversion}-$devel_flavour-%{rpmrel} >/dev/null %endif fi EOF } CreateKernel() { flavour=$1 %if %{versionednamingscheme} PrepareKernel $flavour $flavour-%{buildrpmrel} BuildKernel %{kversion}-$flavour-%{buildrpmrel} %else PrepareKernel $flavour $flavour-%{rpmrel} BuildKernel %{kversion}-$flavour-%{rpmrel} %endif %if %build_devel SaveDevel $flavour %endif %if %build_debug SaveDebug $flavour %endif CreateFiles $flavour } ### # DO it... ### # Create a simulacro of buildroot rm -rf %{temp_root} install -d %{temp_root} # make sure we are in the directory cd %src_dir %ifarch %{ix86} %if %build_desktop586 CreateKernel desktop586 %endif %endif %if %build_desktop CreateKernel desktop %endif %if %build_server CreateKernel server %endif # set extraversion to match srpm to get nice version reported by the tools LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{rpmrel}/" Makefile # build perf %if %{build_perf} # perf %smake -s -C tools/perf NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 NO_LIBTRACEEVENT=1 \ HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 NO_JVMTI=1 prefix=%{_prefix} lib=%{_lib} all %smake -C tools/perf -s NO_LIBTRACEEVENT=1 prefix=%{_prefix} man %endif %if %{build_cpupower} # cpupower # make sure version-gen.sh is executable. chmod +x tools/power/cpupower/utils/version-gen.sh %make_build -C tools/power/cpupower CPUFREQ_BENCH=false %endif # build bpftool %if %{build_bpftool} pushd tools/bpf/bpftool make popd %endif #pushd tools #make all #popd # build libbpf %if %{build_libbpf} pushd tools/lib/bpf make V=1 popd %endif # We don't make to repeat the depend code at the install phase %if %build_source %if %{versionednamingscheme} PrepareKernel "" %{buildrpmrel}custom %else PrepareKernel "" %{rpmrel}custom %endif %smake ARCH=%{target_arch} -s mrproper %endif ### ### install ### %install install -m 644 %{SOURCE4} . cd %src_dir # Directories definition needed for installing %define target_boot %{buildroot}%{_bootdir} %define target_modules %{buildroot}%{_modulesdir} %define target_headers %{buildroot}%{_prefix} %if %{versionednamingscheme} %define target_source %{buildroot}%{_kerneldir} %else %define target_source %{buildroot}%{_srcdir} %endif # We want to be able to test several times the install part rm -rf %{buildroot} cp -a %{temp_root} %{buildroot} # Create directories infastructure %if %build_source install -d %{target_source} tar cf - . | tar xf - -C %{target_source} chmod -R a+rX %{target_source} ## we remove all the source files that we don't ship ## first architecture files for i in alpha arc avr32 blackfin c6x cris csky frv h8300 hexagon ia64 loongarch m32r m68k m68knommu metag microblaze \ mips nds32 nios2 openrisc parisc powerpc riscv s390 score sh sh64 sparc tile unicore32 v850 xtensa mn10300; do rm -rf %{target_source}/arch/$i rm -rf %{target_source}/scripts/dtc/include-prefixes/$i rm -rf %{target_source}/tools/arch/$i rm -rf %{target_source}/tools/testing/selftests/$i done #%ifnarch %{arm} aarch64 # rm -rf %{target_source}/include/kvm/arm* # rm -rf %{target_source}/scripts/dtc/include-prefixes/arm* ## rm -rf %{target_source}/tools/arch/arm* #%endif # # other misc files rm -f %{target_source}/{.clang-format,.cocciconfig,.editorconfig,.get_maintainer.ignore,.gitattributes,.mailmap,.config.cmd,.config.old,.gitignore,.tmp_gas_check,.missing-syscalls.d,arch/.gitignore,rust/.gitignore} #rm -rf %{target_source}/.tmp_depmod/ # # more cleaning pushd %{target_source} # lots of gitignore files find -iname ".gitignore" -delete # clean tools tree %smake -C tools clean %smake -C tools/build clean %smake -C tools/build/feature clean # dont ship generated vdso.so* %ifarch aarch64 rm -f arch/arm64/kernel/vdso/vdso.so* %endif popd # nuke last as it gets re-created rm -f %{target_source}/.cache.mk #endif %build_source %endif # compressing modules %if %{build_modxz} find %{target_modules} -name "*.ko" | %kxargs xz -6 %else find %{target_modules} -name "*.ko" | %kxargs gzip -9 %endif # We used to have a copy of PrepareKernel here # Now, we make sure that the thing in the linux dir is what we want it to be for i in %{target_modules}/*; do rm -f $i/build $i/source done # sniff, if we compressed all the modules, we change the stamp :( # we really need the depmod -ae here pushd %{target_modules} for i in *; do /sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i echo $? done for i in *; do pushd $i echo "Creating modules.description for $i" modules=`find . -name "*.ko.[g,x]z"` echo $modules | xargs /sbin/modinfo \ | perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description popd done popd # need to set extraversion to match srpm again to avoid rebuild LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{rpmrel}/" Makefile # install userspace-headers %if %{build_uheaders} %smake ARCH=%{target_arch} headers_install INSTALL_HDR_PATH=%{target_headers} # for drakx cp include/linux/pci_ids.h %{target_headers}/include/linux/ %endif %if %{build_perf} # perf tool binary and supporting scripts/binaries %smake -s -C tools/perf V=1 DESTDIR=%{buildroot} 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 NO_JVMTI=1 NO_LIBTRACEEVENT=1 prefix=%{_prefix} lib=%{_lib} install # perf man pages (note: implicit rpm magic compresses them later) make -C tools/perf V=1 NO_LIBTRACEEVENT=1 DESTDIR=%{buildroot} prefix=%{_prefix} install-man # remove perf files we dont ship rm -rf %{buildroot}/usr/lib/perf/examples rm -rf %{buildroot}/usr/lib/perf/include/bpf rm -rf %{buildroot}/usr/include/perf/perf_dlfilter.h %endif %if %{build_cpupower} make -C tools/power/cpupower DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install rm -f %{buildroot}%{_libdir}/*.{a,la} %find_lang cpupower mv cpupower.lang ../ chmod 0755 %{buildroot}%{_libdir}/libcpupower.so* mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig install -m644 %{SOURCE50} %{buildroot}%{_unitdir}/cpupower.service install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower %endif # install bpftool %if %{build_bpftool} pushd tools/bpf/bpftool make DESTDIR=%{buildroot} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install popd %endif # install libbpf %if %{build_libbpf} pushd tools/lib/bpf make DESTDIR=%{buildroot} prefix=%{_prefix} libdir=%{_libdir} V=1 install install_headers popd %endif # remove arch dependent files from noarch package rm -f %{buildroot}%{_srcdir}/tools/objtool/fixdep rm -f %{buildroot}%{_srcdir}/tools/objtool/libsubcmd/fixdep rm -f %{buildroot}%{_srcdir}/tools/objtool/objtool rm -f %{buildroot}%{_srcdir}/tools/testing/selftests/tc-testing/action-ebpf ### ### clean ### %clean rm -rf %{buildroot} # We don't want to remove this, the whole reason of its existence is to be # able to do several rpm --short-circuit -bi for testing install # phase without repeating compilation phase #rm -rf %{temp_root} ### ### source and doc file lists ### %if %build_source %if %{versionednamingscheme} %files -n %{kname}-source-%{buildrel} %else %files -n %{kname}-source %endif %doc %{_srcdir}/LICENSES %dir %{_srcdir} %dir %{_srcdir}/arch %dir %{_srcdir}/include %{_srcdir}/.rustfmt.toml %{_srcdir}/Documentation %{_srcdir}/arch/Kconfig %{_srcdir}/arch/arm %{_srcdir}/arch/arm64 %{_srcdir}/arch/um %{_srcdir}/arch/x86 %{_srcdir}/block %{_srcdir}/certs %{_srcdir}/crypto %{_srcdir}/drivers %{_srcdir}/fs %{_srcdir}/include/acpi %{_srcdir}/include/asm-generic %{_srcdir}/include/clocksource %{_srcdir}/include/crypto %{_srcdir}/include/cxl %{_srcdir}/include/drm %{_srcdir}/include/dt-bindings %{_srcdir}/include/keys %{_srcdir}/include/kunit %{_srcdir}/include/kvm %{_srcdir}/include/linux %{_srcdir}/include/math-emu %{_srcdir}/include/media %{_srcdir}/include/memory %{_srcdir}/include/misc %{_srcdir}/include/net %{_srcdir}/include/pcmcia %{_srcdir}/include/ras %{_srcdir}/include/rdma %{_srcdir}/include/rv %{_srcdir}/include/scsi %{_srcdir}/include/soc %{_srcdir}/include/sound %{_srcdir}/include/target %{_srcdir}/include/trace %{_srcdir}/include/uapi %{_srcdir}/include/ufs %dir %{_srcdir}/include/vdso %{_srcdir}/include/vdso/*.h %{_srcdir}/include/video %{_srcdir}/include/xen %{_srcdir}/init %{_srcdir}/io_uring %{_srcdir}/ipc %{_srcdir}/kernel %{_srcdir}/lib %{_srcdir}/mm %{_srcdir}/net %{_srcdir}/rust %{_srcdir}/samples %{_srcdir}/scripts %{_srcdir}/security %{_srcdir}/sound %{_srcdir}/tools %{_srcdir}/usr %{_srcdir}/virt %{_srcdir}/COPYING %{_srcdir}/CREDITS %{_srcdir}/Kbuild %{_srcdir}/Kconfig %{_srcdir}/MAINTAINERS %{_srcdir}/Makefile %{_srcdir}/README %doc README.kernel-sources %if %{versionednamingscheme} %files -n %{kname}-source-latest %endif %endif %if %build_doc %files -n %{kname}-doc %doc linux-%{tar_ver}/Documentation/* %endif %if %build_uheaders %files -n %{kname}-userspace-headers %defattr(0644,root,root,0755) %{_includedir}/asm/ %{_includedir}/asm-generic/ %{_includedir}/drm/ %{_includedir}/linux/ %{_includedir}/misc/ %{_includedir}/mtd/ %{_includedir}/rdma/ %{_includedir}/regulator/ %{_includedir}/scsi/ %{_includedir}/sound/ %{_includedir}/video/ %{_includedir}/xen/ %endif %if %{build_perf} %files -n perf %{_bindir}/perf %{_bindir}/trace %{_datadir}/perf-core/strace/groups/file %{_datadir}/perf-core/strace/groups/string %{_datadir}/doc/perf-tip/tips.txt #dir #{_libdir}/traceevent #dir #{_libdir}/traceevent/plugins #{_libdir}/traceevent/plugins/plugin_* %dir %{_prefix}/libexec/perf-core %{_prefix}/libexec/perf-core/* %{_mandir}/man[1-8]/perf* %{_sysconfdir}/bash_completion.d/perf %endif %if %{build_cpupower} %files -n cpupower -f cpupower.lang %config(noreplace) %{_sysconfdir}/sysconfig/cpupower %{_bindir}/cpupower %{_datadir}/bash-completion/completions/cpupower %{_libdir}/libcpupower.so.1 %{_libdir}/libcpupower.so.0.0.1 %{_unitdir}/cpupower.service %{_mandir}/man[1-8]/cpupower* %files -n cpupower-devel %{_libdir}/libcpupower.so %{_includedir}/cpuidle.h %{_includedir}/cpufreq.h %{_includedir}/powercap.h %endif %if %{build_bpftool} %files -n bpftool %{_sbindir}/bpftool %{_sysconfdir}/bash_completion.d/bpftool %{_mandir}/man8/bpftool-*.8* %{_mandir}/man8/bpftool.8* %endif %if %{build_libbpf} %files -n %{_lib}bpf%{bpfmajor} %{_libdir}/libbpf.so.%{bpfmajor}{,.*} %files -n %{_lib}bpf-devel %{_libdir}/libbpf.a %{_libdir}/libbpf.so %{_libdir}/pkgconfig/libbpf.pc %{_includedir}/bpf/bpf.h %{_includedir}/bpf/bpf_core_read.h %{_includedir}/bpf/bpf_endian.h %{_includedir}/bpf/bpf_helper_defs.h %{_includedir}/bpf/bpf_helpers.h %{_includedir}/bpf/bpf_tracing.h %{_includedir}/bpf/btf.h %{_includedir}/bpf/libbpf.h %{_includedir}/bpf/libbpf_common.h %{_includedir}/bpf/libbpf_legacy.h %{_includedir}/bpf/libbpf_version.h %{_includedir}/bpf/skel_internal.h %{_includedir}/bpf/usdt.bpf.h %endif