# -*- Mode: rpm-spec -*- # # 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: # # kmod-virtualbox # kmod-vboxadditions # kmod-xtables-addons # drakx-installer-images (both core and nonfree) # ---------------------------------------------------------------------------- # # Aarch64 still has problems with multithreaded rpmbuild 4.15-rc %if 0%{?mageia} >= 8 %ifarch aarch64 %global _smp_nthreads_max 1 %endif %endif # # Mageia kernels use kernel.org versioning # %define kernelversion 5 # WARNING: when patchlevel is bumped, please update drakx/kernel/list_modules.pm for new modules!!! %define patchlevel 15 # sublevel is now used for -stable patches %define sublevel 162 # Package release %define mgarel 2 # kernel Makefile extraversion is substituted by # rcX which are either 0 (empty), X (as in rcX) %define rcX 0 # kernel base name (also name of srpm) %define kname kernel # Patch tarball tag %define ktag mga %define rpmtag %{distsuffix}%{mgaver} %if %{rcX} %define rpmrel %mkrel 0.rc%{rcX}.%{mgarel} %else %define rpmrel %mkrel %{mgarel} %endif # 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 # 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 # 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} # 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 # 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 / 4GB) / x86_64 %define build_desktop 1 # Build server (i686 / 64GB)/x86_64 / sparc64 sets %define build_server 1 # build perf and cpupower tools %define build_perf 1 %define build_cpupower 1 # bpf %define build_bpftool 1 %define build_libbpf 1 # compress modules with xz %define build_modxz 1 # ARM builds %ifarch %{arm} %define build_server 0 # no cpupower tools on arm yet %define build_cpupower 0 # arm is currently not using xz %define build_modxz 0 %endif # Arm64 builds %ifarch aarch64 %define build_cpupower 0 %endif # End of user definitions # buildtime 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") # Sparc arch wants sparc64 kernels %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: %{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.xz 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 # breaks bpftool build on mga8 Source100: tools-build-remove-needless-libpython-version-feature-check-that-breaks-test-all-fast-path.patch # breaks cifs NTLM support Source101: fs-cifs-remove-support-for-NTLM-and-weaker-authenticati.patch # breaks plymouth (mga#29925) Source102: video-vga16fb-only-probe-for-ega-and-vga-16-color-graphic-cards.patch #################################################################### # # 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 into one single patch Patch099: stable-queue-coalesced-5.15-20240712.patch ### ### Stable Queue can be big ### Patches from 100-999 ### ### 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 ### ### ### 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 Patch1015: Revert-cpufreq-pcc-Enable-autoload-of-pcc-cpufreq-fo.patch # fixes new hw not being properly detected Patch1020: x86-pci-ignore-e820-reservations-for-bridge-windows-on-newer-systems.patch # Patch1035: x86-mm-Include-spinlock_t-definition-in-pgtable.patch # amd_nb Patch1040: x86-amd_nb-Add-AMD-Family-19h-Models-10h-1Fh-and-A0h-AFh-PCI-IDs.patch Patch1041: x86-amd_nb-Add-AMD-Family-17h-A0-AF-IDs.patch Patch1042: x86-amd_nb-Add-Family-19h-model-70h-7Fh-IDs.patch Patch1043: x86-amd_nb-Add-Family-19h-model-60h-6Fh-IDs.patch # xen Patch1050: x86-PAT-Have-pat_enabled-properly-reflect-state-when-running-on-Xen.patch Patch1051: x86-entry-Fix-entry_INT80_compat-for-Xen-PV-guests.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 # backlight fixes Patch1110: ACPI-video-Add-a-quirk-to-force-acpi-video-backlight.patch # ACPI PM fixes (TTL: 5.16) Patch1130: x86-ACPI-State-Optimize-C3-entry-on-AMD-CPUs.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) Patch1220: block-floppy-disable-pnp-modalias.patch # ahci Patch1240: Add-AHCI-support-for-ASM1062-JBM575-cards.patch ### ### bluetooth ### ### ### bpf ### ### ### Crypto ### ### ### dma ### ### ### File-system ### # aufs diffed from: https://github.com/sfjro/aufs5-linux/tree/aufs5.15 (mga#8314) Patch1310: fs-aufs5.15.patch # symbol exports needed for modular aufs Patch1311: fs-aufs5.15-symbol-exports.patch # set aufs tristate Patch1312: fs-aufs5.15-tristate.patch # adjust for __sync_filesystem() removal in 5.15.36 Patch1313: fs-aufs-replace-__sync_filesystem-by-sync_filesystem.patch # procfs Patch1360: fs-procfs-do-not-list-TID-0-in-proc-pid-task.patch ### ### FireWire ### # adding module aliases to ease upgrade from ieee1394 Patch1400: firewire-ieee1394-module-aliases.patch ### ### Firmware ### ### ### GPIO ### ### ### GPU/DRM ### # amdgpu # switch SI and CIK from radeon to amdgpu Patch1520: drm-amdgpu-SI-and-CIK-enabled-by-default.patch # revert upstream merged patchset that breaks AMD STONEY platform # (5.15.119 regression, mga #32150): Patch1522: 1522-Revert-drm-amd-display-Add-wrapper-to-call-planes-an.patch Patch1523: 1523-Revert-drm-amd-display-Use-dc_update_planes_and_stre.patch Patch1524: 1524-Revert-drm-amd-display-Add-minimal-pipe-split-transi.patch Patch1525: 1525-Revert-drm-amd-display-fix-the-system-hang-while-dis.patch # new Q57 Host Bridge id Patch1530: char-agp-intel-new-Q57-id.patch # i915 # DG1 Patch1540: drm-i915-Add-pci-ids-and-uapi-for-DG1.patch # Alder Lake S Patch1541: drm-i915-adl_s-Remove-require_force_probe-protection.patch # Raptor Lake S Patch1542: drm-i915-rpl-s-Add-PCI-IDS-for-Raptor-Lake-S.patch Patch1543: drm-i915-rpl-s-Add-PCH-Support-for-Raptor-Lake-S.patch Patch1544: drm-i915-rpl-s-Enable-guc-submission-by-default.patch # Alder Lake N Patch1545: drm-i915-adl-n-Enable-ADL-N-platform.patch # https://bugzilla.kernel.org/show_bug.cgi?id=206653#c19 Patch1552: i2c_nvidia_gpu-change-err-into-info.patch # nouveau # 5.15.17 regression Patch1560: Revert-drm-nouveau-pmu-gm200-avoid-touching-PMU-outs.patch ### ### hwmon ### # k10temp Patch1602: hwmon-k10temp-Add-support-for-AMD-Family-19h-Models-10h-1Fh-and-A0h-AFh.patch Patch1603: hwmon-k10temp-Support-up-to-12-CCDs-on-AMD-Family-of-processors.patch Patch1604: hwmon-k10temp-Add-support-for-family-17h-models-A0h-AFh.patch Patch1605: hwmon-k10temp-Add-support-for-family-19h-models-70h-7Fh.patch Patch1606: hwmon-k10temp-Add-support-for-family-19h-models-60h-6Fh.patch # asus Patch1610: hwmon-nct6775-Use-superio_-function-pointers-in-sio_.patch Patch1611: hwmon-nct6775-Use-nct6775_-function-pointers-in-nct6.patch Patch1612: hwmon-nct6775-Support-access-via-Asus-WMI.patch Patch1613: hwmon-nct6775-Add-additional-ASUS-motherboards.patch Patch1614: hwmon-nct6775-add-Pro-WS-X570-ACE.patch Patch1615: hwmon-nct6775-add-ProArt-X570-CREATOR-WIFI.patch Patch1616: hwmon-asus_wmi_ec_sensors-Support-B550-Asus-WMI.patch Patch1617: hwmon-asus_wmi_sensors-Support-X370-Asus-WMI.patch ### ### i2c ### ### ### Input ### Patch1700: input-i8042-quirks-for-Fujitsu-Lifebook-A544-and-Lif.patch ### ### HID ### Patch1750: hid-intel-ish-hid-ipc-Specify-no-cache-snooping-on-TGL-and-ADL.patch ### ### kernel ### # CVE-2021-4204 Patch1800: bpf-prevent-helper-argument-PTR_TO_ALLOC_MEM-to-have-offset-other-than-0.patch ### ### MFD ### ### ### MM ### ### ### Network ### # SiS 190 fixes Patch1900: net-sis190-fix-list-usage.patch # 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 # 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 # netfilter Patch1925: netfilter-conntrack-move-synack-init-code-to-helper.patch Patch1926: netfilter-conntrack-re-init-state-for-retransmitted-.patch Patch1927: netfilter-nf_conntrack_tcp-re-init-for-syn-packets-o.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 # TTL: 5.16 Patch1933: net-wireless-rtw88-8821c-correct-2.4G-tx-power-for-type-2-4-NIC.patch Patch1936: net-wireless-rtw88-dont-check-CRC-of-VHT-SIG-B-in-802.11ac-signal.patch # amd-xgbe Patch1945: net-amd-xgbe-Add-Support-for-Yellow-Carp-Ethernet-device.patch # rtw89 patchset v7 for 802.11ax hw (TTL: 5.16) Patch1960: net-wireless-rtw89-add-Realtek-802.11ax-driver.patch Patch1961: net-wireless-rtw89-Fix-two-spelling-mistakes-in-debug-messages.patch Patch1962: net-wireless-rtw89-Remove-redundant-check-of-ret-after-call-to-rt.patch Patch1963: net-wireless-rtw89-fix-return-value-check-in-rtw89_cam_send_sec_k.patch Patch1964: net-wireless-rtw89-remove-unneeded-semicolon.patch Patch1965: net-wireless-rtw89-fix-error-function-parameter.patch Patch1966: net-wireless-rtw89-remove-duplicate-register-definitions.patch Patch1967: net-wireless-rtw89-fix-return-value-in-hfc_pub_cfg_chk.patch Patch1968: net-wireless-rtw89-Fix-variable-dereferenced-before-check-sta.patch Patch1969: net-wireless-rtw89-update-partition-size-of-firmware-header-on-skb-data.patch Patch1970: net-wireless-rtw89-8852a-correct-bit-definition-of-dfs_en.patch # iwlfiwi Patch1980: net-wireless-iwlwifi-add-new-pci-id-for-6235.patch Patch1981: net-wireless-iwlwifi-add-new-killer-devices-to-the-driver.patch Patch1982: net-wireless-iwlwifi-add-new-device-id-7F70.patch Patch1983: net-wireless-iwlwifi-pcie-fix-killer-name-matching-for-AX200.patch Patch1984: net-wireless-iwlwifi-pcie-remove-two-duplicate-PNJ-device-entries.patch Patch1985: net-wireless-iwlwifi-add-missing-entries-for-Gf4-with-So-and-SoF.patch Patch1986: net-wireless-iwlwifi-swap-1650i-and-1650s-killer-struct-names.patch Patch1987: net-wireless-iwlwifi-add-new-Qu-Hr-device.patch Patch1988: net-wireless-iwlwifi-add-new-ax1650-killer-device.patch Patch1990: net-wireless-iwlwifi-mvm-check-if-SAR-GEO-is-supported-before-sending-command.patch ### ### PCI ### ### ### pinctrl ### ### ### Platform ### # Allow access to Shuttle WMI interface controls # (Mainly allow turning on/off webcam and wireless on Shuttle DA18IE and DA18IM) Patch2050: platform-x86-add-shuttle-wmi-driver.patch Patch2051: platform-x86-shuttle-wmi-drop-devinit-exit.patch Patch2052: platform-x86-shuttle-wmi-4.2-buildfix.patch Patch2053: platform-x86-shuttle-wmi-4.13-buildfix.patch Patch2054: platform-x86-shuttle-wmi-kernel-5.5.patch ### ### PM ### ### ### Sound ### Patch2150: sound-alsa-hda-fix-general-protection-fault-in-azx_runtime_idle.patch # 5.15.81 regression (mga# 31319) Patch2170: Revert-ASoC-soc-pcm-Don-t-zero-TDM-masks-in-__soc_pc.patch ### ### SPI ### ### ### Staging ### ### ### Thermal ### ### ### Thunderbolt ### ### ### 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 # mga compat option Patch2501: video-console-vgacon-treat-nokmsboot-as-nomodeset.patch ### ### Virt ### # fix gcc-10 build Patch2550: KVM-squelch-uninitialized-variable-warning.patch ### ### Tools ### # wipe powerpc refrence 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 ### ### 3rdparty ### Patch3000: 3rd-3rdparty-tree.patch Patch3001: 3rd-3rdparty-merge.patch # ndiswrapper Patch3100: 3rd-ndiswrapper-1.63.patch Patch3101: 3rd-ndiswrapper-Kconfig.patch Patch3102: 3rd-ndiswrapper-Makefile-build-fix.patch Patch3103: 3rd-niswrapper-Kconfig-Makefile.patch # add rtl8812 support (mga#21043) # from https://github.com/aircrack-ng/rtl8812au.git Patch3200: 3rd-rtl8812au.patch Patch3201: 3rd-rtl8812au-Kconfig-Makefile.patch Patch3202: 3rd-rtl8812au-rename.patch # add rtl8723de support (mga#22559) Patch3300: 3rd-rtl8723de.patch Patch3301: 3rd-rtl8723de-Kconfig-Makefile.patch Patch3302: 3rd-rtl8723de-fix-redefine.patch Patch3303: 3rd-rtl8723de-nodebug.patch Patch3304: 3rd-rtl8223de-kernel-5.6.patch Patch3305: 3rd-rtl8723de-add-kernel-5.8-support.patch # viahss Patch3400: 3rd-viahss-0.92.patch Patch3401: 3rd-viahss-config.patch Patch3402: 3rd-viahss-module-license.patch Patch3403: 3rd-viahss-2.6.35-buildfix.patch Patch3404: 3rd-viahss-3.0-buildfix.patch Patch3405: 3rd-viahss-Kconfig-Makefile.patch # rtl8821ce (mga#24605) -- https://github.com/tomaspinho/rtl8821ce Patch3500: 3rd-rtl8821ce.patch Patch3501: 3rd-rtl8821ce-Kconfig-Makefile.patch Patch3502: 3rd-rtl8821ce-5.8-fix.patch Patch3503: 3rd-rtl8821ce-kernel-5.10.patch Patch3504: 3rd-rtl8821ce-kernel-5.12.patch Patch3505: 3rd-rtl8821ce-kernel-5.15.patch # fix Kconfig files for 3rdparty: Patch3900: 3rd-fix-kconfig.patch ### ### Python fixes ### Patch4000: linux-5.15-python3.patch ### ### TTY ### ### ### Security fixes ### Patch5002: CVE-2019-12379.patch # # CVE-2020-16119 # https://bugzilla.redhat.com/show_bug.cgi?id=1886374 # https://bugzilla.redhat.com/show_bug.cgi?id=1888083 Patch5003: CVE-2020-16119-DCCP-CCID-structure-use-after-free.patch ### ### Cosmetic fixes (e.g. typos, spelling, etc.) ### ### 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 #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-5.10 %define kconflicts1 dkms-broadcom-wl < 6.30.223.271-58 %define kconflicts2 dkms-nvidia-current < 460.32.03-1 %define kconflicts3 dkms-nvidia390 < 390.141-1 %define kconflicts4 dkms-nvidia340 < 340.108-15 %define kconflicts5 dkms-nvidia304 < 304.137-3 %define kconflicts6 dkms-virtualbox < 6.1.18-1 %define kconflicts7 dkms-xtables-addons < 3.13-2 # (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd %define kconflicts8 btrfs-progs < 5.10-1 # (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd %define kconflicts9 radeon-firmware < 20201218-1 # (tmb) conflict old firmware to get the firmwares in initrd %define kconflicts10 kernel-firmware-nonfree < 20201230-1 # (tmb) conflict old microcode to get updated ones in initrd for early loading %define kconflicts11 microcode < 0.20201118-2 # (tmb) conflict old theme to get mga8 theme in initrd %define kconflicts12 mageia-gfxboot-theme < 4.5.14.11-2 # (tmb) conflict too old grub2(-efi) %define kconflicts13 grub2 < 2.02.0-15 %define kconflicts14 grub2-efi < 2.02.0-15 # (tmb) conflict too old efibootmgr %define kconflicts15 efibootmgr < 16-3 # (tmb) force new theme in initrd %define kconflicts16 mageia-theme < 8.0-2 Autoreqprov: no %if 0%{?mageia} >= 8 BuildRequires: gcc >= 10.4.0-3 BuildRequires: binutils >= 1:2.36.1-1.4 %else BuildRequires: gcc >= 8.4.0-1 BuildRequires: binutils >= 1:2.33.1-1 %endif BuildRequires: kmod >= 12-2 BuildRequires: bc # for crypto stuff BuildRequires: pkgconfig(openssl) # since 4.16 BuildRequires: bison BuildRequires: diffutils 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 %if 0%{?mageia} >= 8 BuildRequires: systemtap-sdt-devel BuildRequires: babeltrace-devel %else BuildRequires: libbabeltrace-devel %endif %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() \ %package -n %{kname}-%{1}-%{buildrel} \ Version: %{fakever} \ Release: %{fakerel} \ Provides: %kprovides1 %kprovides2 %kprovides3 \ %{expand:%%{?kprovides_%{1}:Provides: %{kprovides_%{1}}}} \ Provides: %{kname}-%{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 \ Conflicts: %kconflicts16 \ %if 0%{?mageia} >= 8 \ Obsoletes: crda \ Obsoletes: crda-devel \ Obsoletes: fuse-exfat \ %endif \ Provides: should-restart = system \ Provides: installonlypkg(kernel) \ Recommends: iw cpupower microcode \ Recommends: %{kname}-%{1}-latest \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ Summary: %{expand:%{summary_%(echo %{1} | sed -e "s/-/_/")}} \ Group: System/Kernel and hardware \ %description -n %{kname}-%{1}-%{buildrel} \ %common_desc_kernel %{expand:%{info_%(echo %{1} | sed -e "s/-/_/")}} \ %ifnarch %{arm} \ %common_desc_kernel_smp \ %endif \ \ %if %build_devel \ %package -n %{kname}-%{1}-devel-%{buildrel} \ Version: %{fakever} \ Release: %{fakerel} \ Requires: glibc-devel ncurses-devel make gcc perl \ Requires: gcc >= 5.5.0-1 \ %ifarch x86_64 \ Requires: pkgconfig(libelf) \ %endif \ Summary: The kernel-devel files for %{kname}-%{1}-%{buildrel} \ Group: Development/Kernel \ Provides: %{kname}-devel = %{kverrel} \ Provides: %{kname}-%{1}-devel \ Recommends: %{kname}-%{1}-devel-latest \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ %description -n %{kname}-%{1}-devel-%{buildrel} \ This package contains the kernel files (headers and build tools) \ that should be enough to build additional drivers for \ use with %{kname}-%{1}-%{buildrel}. \ \ If you want to build your own kernel, you need to install the full \ %{kname}-source-%{buildrel} rpm. \ \ %endif \ \ %if %build_debug \ %package -n %{kname}-%{1}-%{buildrel}-debuginfo \ Version: %{fakever} \ Release: %{fakerel} \ Summary: Files with debuginfo for %{kname}-%{1}-%{buildrel} \ Group: Development/Debug \ Provides: kernel-debug = %{kverrel} \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ %description -n %{kname}-%{1}-%{buildrel}-debuginfo \ This package contains the files with debuginfo to aid in debug tasks \ when using %{kname}-%{1}-%{buildrel}. \ \ 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 \ Requires: %{kname}-%{1}-%{buildrel} \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ Obsoletes: vboxadditions-kernel-%{1}-latest \ Obsoletes: kernel-tmb-%{1}-latest \ %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 \ Requires: %{kname}-%{1}-devel-%{buildrel} \ %ifarch %{ix86} \ Conflicts: arch(x86_64) \ %endif \ Provides: %{kname}-devel-latest \ Obsoletes: kernel-tmb-%{1}-devel-latest \ %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 \ \ %posttrans -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-posttrans \ %postun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-postun \ \ %if %build_devel \ %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 \ %endif \ \ %files -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1} \ %files -n %{kname}-%{1}-latest \ \ %if %build_devel \ %files -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1} \ %files -n %{kname}-%{1}-devel-latest \ %endif \ \ %if %build_debug \ %files -n %{kname}-%{1}-%{buildrel}-debuginfo -f kernel_debug_files.%{1} \ %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, 4 GB / x86_64 # %if %build_desktop %ifarch %{ix86} %define summary_desktop Linux Kernel for desktop use with i686 and less than 4GB RAM %define info_desktop This kernel is compiled for desktop use, single or \ multiple i686 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. %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 # %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 %package -n %{kname}-source-%{buildrel} Version: %{fakever} Release: %{fakerel} Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils Summary: The Linux source code for %{kname}-%{buildrel} Group: Development/Kernel Autoreqprov: no Provides: kernel-source = %{kverrel} Buildarch: noarch %description -n %{kname}-source-%{buildrel} 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. # # 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 # # 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 Obsoletes: cpufreq cpufrequtils %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 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} %package -n %{_lib}bpf0 Summary: The bpf library from kernel source Group: System/Libraries %description -n %{_lib}bpf0 This package contains the kernel source bpf library. %package -n %{_lib}bpf-devel Summary: Developement files for the bpf library from kernel source Group: Development/Kernel Requires: %{_lib}bpf0 %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 # breaks bpftool build on mga8 patch -p1 -R <%{SOURCE100} # breaks cifs NTLL on mga8 #patch -p1 -R <%{SOURCE101} # breaks plymouth patch -p1 -R <%{SOURCE102} # # 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 %define _kerneldir /usr/src/kernel-%{kversion}-%{buildrpmrel} %define _bootdir /boot %define _modulesdir /lib/modules %define _efidir %{_bootdir}/efi/mageia # Directories definition needed for building %define temp_root %{build_dir}/temp-root %define temp_source %{temp_root}%{_kerneldir} %define temp_boot %{temp_root}%{_bootdir} %define temp_modules %{temp_root}%{_modulesdir} PrepareKernel() { name=$1 extension=$2 echo "Make config for kernel $extension" %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 install -d %{temp_root}%{_libdir}/linux-$KernelVer/ find arch/%{target_arch}/boot/dts/ -name *.dtb -execdir install -D -m644 {} %{temp_root}%{_libdir}/linux-$KernelVer/{} \; %endif # modules install -d %{temp_modules}/$KernelVer %smake ARCH=%{target_arch} INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install } SaveDevel() { devel_flavour=$1 DevelRoot=/usr/src/kernel-%{kversion}-$devel_flavour-%{buildrpmrel} 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} $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/ 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/ cp -fR drivers/media/common/btcx-risc.h $TempDevelRoot/drivers/media/common/ # aufs has a special file needed cp -fR fs/aufs/magic.mk $TempDevelRoot/fs/aufs/ # rtl8821ce has special files needed cp -fR 3rdparty/rtl8821ce/halmac.mk $TempDevelRoot/3rdparty/rtl8821ce/ cp -fR 3rdparty/rtl8821ce/rtl8821c.mk $TempDevelRoot/3rdparty/rtl8821ce/ mkdir -p $TempDevelRoot/3rdparty/rtl8821ce/hal/phydm/ cp -fR 3rdparty/rtl8821ce/hal/phydm/phydm.mk $TempDevelRoot/3rdparty/rtl8821ce/hal/phydm/ mkdir -p $TempDevelRoot/3rdparty/rtl8812au/hal/phydm/ cp -fR 3rdparty/rtl8812au/hal/phydm/phydm.mk $TempDevelRoot/3rdparty/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 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 # 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 EOF } SaveDebug() { debug_flavour=$1 install -m 644 vmlinux \ %{temp_boot}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel} kernel_debug_files=../kernel_debug_files.$debug_flavour echo "%{_bootdir}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel}" \ >> $kernel_debug_files find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ -name "*.ko" | \ %kxargs -I '{}' objcopy --only-keep-debug '{}' '{}'.debug find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ -name "*.ko" | %kxargs -I '{}' \ sh -c 'cd `dirname {}`; \ objcopy --add-gnu-debuglink=`basename {}`.debug \ --strip-debug `basename {}`' pushd %{temp_modules} find %{kversion}-$debug_flavour-%{buildrpmrel}/kernel \ -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 [ -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 fi popd > /dev/null EOF ### Create kernel Postun script on the fly cat > $kernel_files-postun < /dev/null if [ -f "vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel}" ]; then echo "The kernel is still installed in postun, probably a reinstall, skipping cleanup." >&2 exit fi if [ -L vmlinuz-$kernel_flavour ]; then if [ "$(readlink vmlinuz-$kernel_flavour)" = "vmlinuz-%{kversion}-$kernel_flavour-%{buildrpmrel}" ]; then rm -f vmlinuz-$kernel_flavour fi fi if [ -L initrd-$kernel_flavour.img ]; then if [ "$(readlink initrd-$kernel_flavour.img)" = "initrd-%{kversion}-$kernel_flavour-%{buildrpmrel}.img" ]; then rm -f initrd-$kernel_flavour.img fi fi popd > /dev/null rm -rf /lib/modules/%{kversion}-$kernel_flavour-%{buildrpmrel} >/dev/null /sbin/kernel_remove_initrd %{kversion}-$kernel_flavour-%{buildrpmrel} /sbin/installkernel -R %{kversion}-$kernel_flavour-%{buildrpmrel} if [ -d /var/lib/dkms ]; then 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 fi EOF } CreateKernel() { flavour=$1 PrepareKernel $flavour $flavour-%{buildrpmrel} BuildKernel %{kversion}-$flavour-%{buildrpmrel} %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 \ 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 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 # 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 PrepareKernel "" %{buildrpmrel}custom %smake ARCH=%{target_arch} -s mrproper %endif ### ### install ### %install install -m 644 %{SOURCE4} . cd %src_dir # Directories definition needed for installing %define target_source %{buildroot}%{_kerneldir} %define target_boot %{buildroot}%{_bootdir} %define target_modules %{buildroot}%{_modulesdir} %define target_headers %{buildroot}%{_prefix} # 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 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,.config.old,.config.cmd,.lst,.mailmap,.get_maintainer.ignore} rm -f %{target_source}/{.missing-syscalls.d,.cocciconfig,.gitattributes} 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 prefix=%{_prefix} lib=%{_lib} install # perf man pages (note: implicit rpm magic compresses them later) make -C tools/perf V=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 ### ### 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 %files -n %{kname}-source-%{buildrel} %doc %{_kerneldir}/LICENSES %dir %{_kerneldir} %dir %{_kerneldir}/arch %dir %{_kerneldir}/include %{_kerneldir}/3rdparty %{_kerneldir}/Documentation %{_kerneldir}/arch/Kconfig %{_kerneldir}/arch/arm %{_kerneldir}/arch/arm64 %{_kerneldir}/arch/um %{_kerneldir}/arch/x86 %{_kerneldir}/block %{_kerneldir}/certs %{_kerneldir}/crypto %{_kerneldir}/drivers %{_kerneldir}/fs %{_kerneldir}/include/acpi %{_kerneldir}/include/asm-generic %{_kerneldir}/include/clocksource %{_kerneldir}/include/crypto %{_kerneldir}/include/drm %{_kerneldir}/include/dt-bindings %{_kerneldir}/include/keys %{_kerneldir}/include/kunit %{_kerneldir}/include/kvm %{_kerneldir}/include/linux %{_kerneldir}/include/math-emu %{_kerneldir}/include/media %{_kerneldir}/include/memory %{_kerneldir}/include/misc %{_kerneldir}/include/net %{_kerneldir}/include/pcmcia %{_kerneldir}/include/ras %{_kerneldir}/include/rdma %{_kerneldir}/include/scsi %{_kerneldir}/include/soc %{_kerneldir}/include/sound %{_kerneldir}/include/target %{_kerneldir}/include/trace %{_kerneldir}/include/uapi %{_kerneldir}/include/vdso/*.h %{_kerneldir}/include/video %{_kerneldir}/include/xen %{_kerneldir}/init %{_kerneldir}/io_uring %{_kerneldir}/ipc %{_kerneldir}/kernel %{_kerneldir}/lib %{_kerneldir}/mm %{_kerneldir}/net %{_kerneldir}/samples %{_kerneldir}/scripts %{_kerneldir}/security %{_kerneldir}/sound %{_kerneldir}/tools %{_kerneldir}/usr %{_kerneldir}/virt %{_kerneldir}/COPYING %{_kerneldir}/CREDITS %{_kerneldir}/Kbuild %{_kerneldir}/Kconfig %{_kerneldir}/MAINTAINERS %{_kerneldir}/Makefile %{_kerneldir}/README %doc README.kernel-sources %files -n %{kname}-source-latest %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}/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.0 %{_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 %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}bpf0 %{_libdir}/libbpf.so.0 %{_libdir}/libbpf.so.0.5.0 %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/skel_internal.h %{_includedir}/bpf/xsk.h %endif