kernel-5.15/kernel.spec

1609 lines
55 KiB
RPMSpec
Raw Normal View History

# _get_email() in %%build contains bashisms for regexping
%define _buildshell /bin/bash
# brp-python-bytecompile uses /usr/bin/python,
# but it is a different python version in different ROSA
# releases; there is no good way to tell brp-python-bytecompile
# which iterpreter to use; so just disable it to avoid problems
%define _python_bytecompile_build 0
2020-06-19 23:42:50 +03:00
# Probably dwz bug, on i686 only file is not packaged:
# /usr/lib/debug/usr/bin/trace-5.4.40-3.i386.debug.#dwz#.b5xuKG
# dwz compresses only debuginfo from perf, cpupower, uml,
# not the kernel itself (because it is stripped not by RPM),
# so we do not loose much by disabling it.
%global _find_debuginfo_dwz_opts %{nil}
# Put everything into one non-standard debuginfo subpackage
# TODO: make multiple debuginfo packages coinstallable as installonlypkg,
# to achive this, there must be no conflicting files.
# Probably signing and compressing of kernel modules
# has to be moved to %%_spec_install_post.
%global _debuginfo_subpackages %{nil}
%global _debuginfo_template %{nil}
%undefine _debugsource_packages
# Hack: flavour and major version are variable, make %%_build_pkgcheck_* always detect and use this config
%global _build_pkgcheck_set %(echo "%{_build_pkgcheck_set}" | sed -e 's,/%{name}.rpmlintrc,/kernel.rpmlintrc,')
%global _build_pkgcheck_srpm %(echo "%{_build_pkgcheck_srpm}" | sed -e 's,/%{name}.rpmlintrc,/kernel.rpmlintrc,')
%define kernelversion 5
%define patchlevel 10
[bot] upd: 5.10.50 -> 5.10.51 Changelog: arm64: dts: rockchip: add rk3328 dwc3 usb controller node arm64: dts: rockchip: Enable USB3 for rk3328 Rock64 arm64: tlb: fix the TTL value of tlb_get_level ASoC: tegra: Set driver_name=tegra for all machine drivers ata: ahci_sunxi: Disable DIPM ath11k: unlock on error path in ath11k_mac_op_add_interface() atm: iphase: fix possible use-after-free in ia_module_exit() atm: nicstar: Fix possible use-after-free in nicstar_cleanup() atm: nicstar: register the interrupt handler in the right place atm: nicstar: use 'dma_free_coherent' instead of 'kfree' Bluetooth: btusb: Add a new QCA_ROME device (0cf3:e500) Bluetooth: btusb: Add support USB ALT 3 for WBS Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc. Bluetooth: btusb: Fixed too many in-token issue for Mediatek Chip. Bluetooth: Fix alt settings for incoming SCO with transparent coding format Bluetooth: Fix the HCI to MGMT status conversion table Bluetooth: L2CAP: Fix invalid access if ECRED Reconfigure fails Bluetooth: L2CAP: Fix invalid access on ECRED Connection response Bluetooth: mgmt: Fix the command returns garbage parameter value Bluetooth: Shutdown controller after workqueues are flushed or cancelled bpf: Fix false positive kmemleak report in bpf_ringbuf_area_alloc() bpf: Fix up register-based shifts in interpreter to silence KUBSAN cfg80211: fix default HE tx bitrate mask in 2G band clk: renesas: r8a77995: Add ZA2 clock clk: renesas: rcar-usb2-clock-sel: Fix error handling in .probe() clk: tegra: Ensure that PLLU configuration is applied properly clk: tegra: Fix refcounting of gate clocks clocksource/arm_arch_timer: Improve Allwinner A64 timer workaround coresight: Propagate symlink failure coresight: tmc-etf: Fix global-out-of-bounds in tmc_update_etf_buffer() cpu/hotplug: Cure the cpusets trainwreck cw1200: add missing MODULE_DEVICE_TABLE dm btree remove: assign new_root only when removal succeeds dm: Fix dm_accept_partial_bio() relative to zone management commands dm space maps: don't reset space map allocation cursor when committing dm writecache: commit just one block, not a full page dm writecache: don't split bios when overwriting contiguous cache content dm writecache: flush origin device when writing and cache is full dm writecache: write at least 4k when committing dm zoned: check zone capacity drm/amd/amdgpu/sriov disable all ip hw status by default drm/amd/display: Avoid HDCP over-read and corruption drm/amd/display: Fix DCN 3.01 DSCCLK validation drm/amd/display: fix HDCP reset sequence on reinitialize drm/amd/display: fix incorrrect valid irq check drm/amd/display: Fix off-by-one error in DML drm/amd/display: fix use_max_lb flag for 420 pixel formats drm/amd/display: Reject non-zero src_y and src_x for video planes drm/amd/display: Release MST resources on switch from MST to SST drm/amd/display: Set DISPCLK_MAX_ERRDET_CYCLES to 7 drm/amd/display: Update scaling settings on modeset drm/amd/display: Verify Gamma & Degamma LUT sizes in amdgpu_dm_atomic_check drm/amdgpu: enable sdma0 tmz for Raven/Renoir(V2) drm/amdgpu: fix bad address translation for sienna_cichlid drm/amdgpu: remove unsafe optimization to drop preamble ib drm/amdgpu: Update NV SIMD-per-CU to 2 drm/amdkfd: fix circular locking on get_wave_state drm/amdkfd: Fix circular lock in nocpsch path drm/amdkfd: use allowed domain for vmbo validation drm/amdkfd: Walk through list with dqm lock hold drm/arm/malidp: Always list modifiers drm/ast: Fixed CVE for DP501 drm/ast: Remove reference to struct drm_device.pdev drm/bridge: cdns: Fix PM reference leak in cdns_dsi_transfer() drm: bridge: cdns-mhdp8546: Fix PM reference leak in drm/bridge: lt9611: Add missing MODULE_DEVICE_TABLE drm/bridge: nwl-dsi: Force a full modeset when crtc_state->active is changed to be true drm/dp: Handle zeroed port counts in drm_dp_read_downstream_info() drm/i915/display: Do not zero past infoframes.vsc drm/mediatek: Fix PM reference leak in mtk_crtc_ddp_hw_init() drm/msm/mdp4: Fix modifier support enabling drm/mxsfb: Don't select DRM_KMS_FB_HELPER drm/nouveau: Don't set allow_fb_modifiers explicitly drm/radeon: Add the missed drm_gem_object_put() in radeon_user_framebuffer_create() drm/radeon: Call radeon_suspend_kms() in radeon_pci_shutdown() for Loongson64 drm: rockchip: add missing registers for RK3066 drm: rockchip: add missing registers for RK3188 drm/rockchip: dsi: remove extra component_del() call drm/sched: Avoid data corruptions drm/scheduler: Fix hang when sched_entity released drm/tegra: Don't set allow_fb_modifiers explicitly drm/vc4: crtc: Skip the TXP drm/vc4: fix argument ordering in vc4_crtc_get_margins() drm/vc4: Fix clock source for VEC PixelValve on BCM2711 drm/vc4: hdmi: Fix PM reference leak in vc4_hdmi_encoder_pre_crtc_co() drm/vc4: hdmi: Prevent clock unbalance drm/vc4: txp: Properly set the possible_crtcs mask drm/virtio: Fix double free on probe failure drm/zte: Don't select DRM_KMS_FB_HELPER e100: handle eeprom as little endian ext4: fix memory leak in ext4_fill_super extcon: intel-mrfld: Sync hardware and software state on init f2fs: fix to avoid racing on fsync_entry_slab by multi filesystem instances fjes: check return value after calling platform_get_resource() flow_offload: action should not be NULL when it is referenced fpga: stratix10-soc: Add missing fpga_mgr_free() call hugetlb: clear huge pte during flush function on mips platform i40e: fix PTP on 5Gb links IB/isert: Align target max I/O size to initiator size ice: fix clang warning regarding deadcode.DeadStores ice: fix incorrect payload indicator on PTYPE ice: mark PTYPE 2 as reserved ice: set the value of global config lock timeout longer igb: fix assignment on big endian machines igb: handle vlan types with checker enabled io_uring: convert io_buffer_idr to XArray io_uring: Convert personality_idr to XArray io_uring: fix clear IORING_SETUP_R_DISABLED in wrong function io_uring: fix false WARN_ONCE io_uring: simplify io_remove_personalities() ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe ipmi/watchdog: Stop watchdog timer when the current action is 'none' ipv6: use prandom_u32() for ID generation iwlwifi: mvm: don't change band on bound PHY contexts iwlwifi: mvm: fix error print when session protection ends iwlwifi: pcie: fix context info freeing iwlwifi: pcie: free IML DMA memory allocation jfs: fix GPF in diFree lkdtm/bugs: XFAIL UNALIGNED_LOAD_STORE_WRITE loop: fix I/O error on fsync() in detached loop devices mac80211: consider per-CPU statistics if present mac80211_hwsim: add concurrent channels scanning support over virtio media, bpf: Do not copy more entries than user space requested media: dtv5100: fix control-request directions media: gspca/sq905: fix control-request direction media: gspca/sunplus: fix zero-length control requests media: subdev: disallow ioctl for saa6588/davinci media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K media: zr364xx: fix memory leak in zr364xx_start_readpipe mfd: syscon: Free the allocated name field of struct regmap_config MIPS: add PMD table accounting into MIPS'pmd_alloc_one MIPS: cpu-probe: Fix FPU detection on Ingenic JZ4760(B) MIPS: ingenic: Select CPU_SUPPORTS_CPUFREQ && MIPS_EXTERNAL_TIMER MIPS: loongsoon64: Reserve memory below starting pfn to prevent Oops MIPS: MT extensions are not available on MIPS32r1 MIPS: set mips32r5 for virt extensions mISDN: fix possible use-after-free in HFC_cleanup() mmc: core: Allow UHS-I voltage switch for SDSC cards if supported mmc: core: clear flags before allowing to retune mmc: sdhci-acpi: Disable write protect detection on Toshiba Encore 2 WT8-B mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode mm,hwpoison: return -EBUSY when migration fails mt76: mt7615: fix fixed-rate tx status reporting mt76: mt7915: fix IEEE80211_HE_PHY_CAP7_MAX_NC for station mode net: bcmgenet: check return value after calling platform_get_resource() net: bridge: mrp: Update ring transitions. net: fec: add ndo_select_queue to fix TX bandwidth fluctuations net: fix mistake path for netdev_features_strings net: ipa: Add missing of_node_put() in ipa_firmware_load() net: ip: avoid OOM kills with large UDP sends over loopback net: mdio: ipq8064: add regmap config to disable REGCACHE net: mdio: provide shim implementation of devm_of_mdiobus_register net: micrel: check return value after calling platform_get_resource() net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet net/mlx5: Fix lag port remapping logic net: moxa: Use devm_platform_get_and_ioremap_resource() net: mscc: ocelot: check return value after calling platform_get_resource() net: mvpp2: check return value after calling platform_get_resource() net: pch_gbe: Use proper accessors to BE data in pch_ptp_match() net: phy: realtek: add delay to fix RXC generation issue net/sched: cls_api: increase max_reclassify_loop net: sched: fix error return code in tcf_del_walker() net: sgi: ioc3-eth: check return value after calling platform_get_resource() net: stmmac: the XPCS obscures a potential "PHY not found" error net: tcp better handling of reordering then loss cases net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT nvmem: core: add a missing of_node_put PCI: aardvark: Fix checking for PIO Non-posted Request PCI: aardvark: Implement workaround for the readback value of VEND_ID PCI: Leave Apple Thunderbolt controllers on for s2idle or standby pinctrl/amd: Add device HID for new AMD GPIO controller pinctrl: equilibrium: Add missing MODULE_DEVICE_TABLE pinctrl: mcp23s08: Fix missing unlock on error in mcp23s08_irq() pinctrl: mcp23s08: fix race condition in irq handler powerpc/barrier: Avoid collision with clang's __lwsync macro powerpc/mm: Fix lockup on kernel exec fault powerpc/powernv/vas: Release reference to tgid during window close power: supply: ab8500: Fix an old bug qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute r8169: avoid link-up interrupt issue on RTL8106e if user enables ASPM RDMA/cma: Fix rdma_resolve_route() memory leak RDMA/cxgb4: Fix missing error code in create_qp() RDMA/rtrs: Change MAX_SESS_QUEUE_DEPTH RDMA/rxe: Don't overwrite errno from ib_umem_get() reiserfs: add check for invalid 1st journal block rq-qos: fix missed wake-ups in rq_qos_throttle try two rtl8xxxu: Fix device info for RTL8192EU devices sched/fair: Ensure _sum and _avg values stay consistent scsi: iscsi: Fix iSCSI cls conn state scsi: iscsi: Fix race condition between login and sync thread sctp: add size validation when walking chunks sctp: validate from_addr_param return selftests: Clean forgotten resources as part of cleanup() selftests/lkdtm: Fix expected text for CR4 pinning selftests/resctrl: Fix incorrect parsing of option "-t" selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC seq_buf: Fix overflow in seq_buf_putmem_hex() sfc: avoid double pci_remove of VFs sfc: error code if SRIOV cannot be disabled smackfs: restrict bytes count in smk_set_cipso() thermal/drivers/int340x/processor_thermal: Fix tcc setting tracing: Resize tgid_map to pid_max, not PID_MAX_DEFAULT tracing: Simplify & fix saved_tgids logic ubifs: Fix races between xattr_{set|get} and listxattr operations udf: Fix NULL pointer dereference in udf_symlink function virtio-net: Add validation for used length virtio_net: Remove BUG() to avoid machine dead vsock: notify server to shutdown when client has pending signal wireless: wext-spy: Fix out-of-bounds warning wl1251: Fix possible buffer overflow in wl1251_cmd_scan wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP xfrm: Fix error reporting in xfrm_state_construct. Updated by kernel-updater-bot (https://abf.io/mikhailnov/kernel-updater-bot)
2021-07-19 11:21:43 +03:00
%define sublevel 51
2013-11-16 00:27:01 +04:00
# Release number. Increase this before a rebuild.
%define rpmrel 1
%define fullrpmrel %{rpmrel}
2013-11-16 00:27:01 +04:00
%define rpmtag %{disttag}
# version defines
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
%define kverrel %{kversion}-%{fullrpmrel}
2013-11-16 00:27:01 +04:00
%define tar_ver %{kernelversion}.%{patchlevel}
%ifarch %{ix86}
%define arch_suffix i586
2020-11-26 21:09:27 +00:00
%endif
%ifarch %{x86_64}
2020-11-27 01:21:49 +03:00
%define arch_suffix x86_64
%endif
2020-11-26 21:09:27 +00:00
%ifarch aarch64
%define arch_suffix arm64
%endif
%define buildrpmrel %{fullrpmrel}%{rpmtag}-%{arch_suffix}
2013-11-16 00:27:01 +04:00
%define buildrel %{kversion}-%{buildrpmrel}
# Add not only the build time generated key to the trusted keyring,
# but also add public keys of private ROSA's keys
%bcond_without additional_keys
2021-05-22 12:08:22 +03:00
# Fail the build after "make oldconfig" to edit kernel configs
%bcond_with fail
2020-03-13 20:35:12 +03:00
# User Mode Linux, https://habr.com/ru/company/itsumma/blog/459558/
# Not buildable on aarch64
%ifarch %{x86_64}
2020-03-13 20:35:12 +03:00
%bcond_without uml
2020-11-26 21:09:27 +00:00
%else
%bcond_with uml
%endif
# "Nickel" is a special brand for certified distros
%if %{mdvver} == 201900 || %{mdvver} == 201905
%bcond_without nickel
# Require kernel modules to be signed
%bcond_without oblig_signed_modules
%else
%bcond_with nickel
%bcond_with oblig_signed_modules
%endif
2020-07-29 10:59:41 +03:00
%if %{mdvver} >= 201905
# Build binary out-of-tree kernel modules (experimental)
2020-07-29 10:59:41 +03:00
%bcond_without binary_extra_modules
# Sign kernel modules with GOST key (experimental)
%bcond_without gost_sign
2020-07-29 10:59:41 +03:00
%else
%bcond_with binary_extra_modules
%bcond_with gost_sign
2020-07-29 10:59:41 +03:00
%endif
%bcond_with ccache
%bcond_without flow_abi
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
# 1. VirtualBox is for x86_32 and x86_64 only
# 2. I do not know how to solve the problem that userspace part of VirtualBox
# will be updated ahead of these binary modules. So just off building them.
%bcond_with binary_virtualbox_host
# shredder-kernel works only on x86_64, makes manipulations with syscalls tables,
# loading/unloading of the module failed sometimes on kernel 5.4
# and it has not been adapted for kernel 5.10 (is not buildable)
%bcond_with binary_shredder
# compress modules with zstd (zstd is good compression and fast decompression)
%bcond_without compress_modules
# Spend more resources on compression, but make resulting size less;
# decompression speed will not be affected, but more memory will be required
# which should not a problem here (performance penalty from allocating more
# memory should not be big, I think, but I did not benchmark).
%define zstd_cmd zstd -q --format=zstd --ultra -22
# Kernel flavour
%if %{with nickel}
%define flavour nickel
%else
%define flavour generic
%endif
2013-11-16 00:27:01 +04:00
# The full kernel version
%define kver_full %{kversion}-%{flavour}-%{buildrpmrel}
############################################################################
%define top_dir_name kernel-%{_arch}
2013-11-16 00:27:01 +04:00
%define build_dir ${RPM_BUILD_DIR}/%{top_dir_name}
%define src_dir %{build_dir}/linux-%{tar_ver}
# Common target directories
%define _bootdir /boot
%define _modulesdir /lib/modules
%define devel_root /usr/src/linux-%{kver_full}
%define initrd_path %{_bootdir}/initrd-%{kver_full}.img
# Directories needed for building
%define temp_root %{build_dir}/temp-root
%define temp_boot %{temp_root}%{_bootdir}
%define temp_modules %{temp_root}%{_modulesdir}
%define temp_devel_root %{temp_root}%{devel_root}
# Directories definition needed for installing
%define target_boot %{buildroot}%{_bootdir}
%define target_modules %{buildroot}%{_modulesdir}
2019-11-11 17:47:53 +03:00
# Manual control of creating and deleting keys
# "rnd" is "random" and means that a key pair is generated at build time
# and is not saved anywhere.
%define certs_dir_rnd certs
2019-12-07 21:57:55 +03:00
%define certs_signing_key_priv_rnd %{certs_dir_rnd}/signing_key_priv.key
%define certs_signing_der %{certs_dir_rnd}/signing_key.x509
2019-11-11 17:47:53 +03:00
%define certs_key_config_rnd %{certs_dir_rnd}/x509.genkey
%define certs_public_keys %{certs_dir_rnd}/public.pem
%define certs_verify_tmp %{certs_dir_rnd}/verify.tmp
%define kernel_files %{_builddir}/kernel_files.list
%define debuginfo_files %{_builddir}/debuginfo_files.list
# Append list of files generate by find-debuginfo.sh to our custom list
%global __debug_install_post \
%{__debug_install_post} \
cat %{_builddir}/debugfiles.list >> %{debuginfo_files}
############################################################################
2013-11-16 00:27:01 +04:00
# Build defines
%define build_doc 0
2020-11-26 22:03:53 +00:00
%define build_devel 1
%define build_debug 1
2013-11-16 00:27:01 +04:00
# Build kernel-headers package
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
# Headers from LTS kernel 5.4 are default in rosa2019.1/05 for now
# and headers from 4.15 are default in rosa2016.1
%define build_headers 0
2013-11-16 00:27:01 +04:00
# build perf and cpupower tools
%if %{mdvver} > 201610
2016-01-06 17:46:38 +03:00
%define build_perf 1
2013-11-16 00:27:01 +04:00
%define build_cpupower 1
%else
# This is not the main kernel in rosa2016.1
# This one will be in contrib, not main, in rosa2016.1
%define build_perf 0
%define build_cpupower 0
%endif
2013-11-16 00:27:01 +04:00
# End of user definitions
# buildtime flags
%{?_without_doc: %global build_doc 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}
%{?_with_doc: %global build_doc 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}
%if %{with compress_modules}
%define kmod_suffix .zst
2020-07-29 10:59:41 +03:00
%else
%define kmod_suffix %{nil}
2020-07-29 10:59:41 +03:00
%endif
%if !%{build_debug}
# Disable debug rpms.
%define _enable_debug_packages %{nil}
%define debug_package %{nil}
%endif
# http://nickdesaulniers.github.io/blog/2018/06/02/speeding-up-linux-kernel-builds-with-ccache/
%if %{with ccache}
%define kmake KBUILD_BUILD_TIMESTAMP='' %make CC='ccache gcc' ARCH="%{arch_type}"
2013-11-16 00:27:01 +04:00
%else
%define kmake %make CC='gcc' ARCH="%{arch_type}"
2013-11-16 00:27:01 +04:00
%endif
2013-11-16 00:27:01 +04:00
# there are places where parallel make don't work
%define smake make
2020-11-26 18:48:55 +00:00
%ifarch %{ix86} %{x86_64}
%define arch_type x86
%endif
%ifarch aarch64
%define arch_type arm64
%endif
2014-01-22 18:31:57 +04:00
2013-11-16 00:27:01 +04:00
# 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")
#
# SRC RPM description
#
Summary: The Linux kernel
Name: kernel-%{kernelversion}.%{patchlevel}-%{flavour}
2013-11-16 00:27:01 +04:00
Version: %{kversion}
Release: %{fullrpmrel}
2013-11-16 00:27:01 +04:00
License: GPLv2
Group: System/Kernel and hardware
URL: http://www.kernel.org
####################################################################
#
# Sources
#
2018-01-10 22:20:13 +03:00
Source0: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.xz
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
2013-11-16 00:27:01 +04:00
# This is for disabling *config, mrproper, prepare, scripts on -devel rpms
# Needed, because otherwise the -devel won't build correctly.
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
Source2: 0001-disable-mrproper-prepare-scripts-configs-in-devel-rp.patch
2013-11-16 00:27:01 +04:00
2020-07-29 10:59:41 +03:00
# TODO: make a separate package "ksobirator" and BR it
# after testing these macros properly
Source3: macros.ksobirator
%{load:%{SOURCE3}}
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
# Kernel configuration files.
Source111: kernel-x86_64.config
Source112: kernel-i586.config
Source113: kernel-arm64.config
2013-11-16 00:27:01 +04:00
# Cpupower: the service, the config, etc.
2013-11-16 00:27:01 +04:00
Source50: cpupower.service
Source51: cpupower.config
Source52: cpupower-start.sh
Source53: cpupower.path
2013-11-16 00:27:01 +04:00
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
Source80: kernel.rpmlintrc
# Additional keys that can be used to sign kernel modules
# Generated by https://abf.io/soft/kernel-keys
# Source201..206: public_key_GOST_*.pem
%{expand:%(for i in `seq 1 6`; do echo "Source$((200+${i})): public_key_GOST_${i}.pem"; done)}
# Source207..212: public_key_RSA_*.pem
%{expand:%(for i in `seq 7 12`; do echo "Source$((200+${i})): public_key_RSA_${i}.pem"; done)}
####################################################################
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
2013-11-16 00:27:01 +04:00
# Patches
# The patch to make kernel x.y.z from x.y.0.
2018-01-10 22:20:13 +03:00
Patch1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kversion}.xz
# Patches from mainline
# none
2013-11-16 00:27:01 +04:00
# ROSA-specific patches
# Perf docs are built after all the kernels. To validate the xml files
# generated during that process, xmlto tries to get DTD files from the Net.
# If it fails, the whole build fails, which is unfortunate. Let us avoid
# this.
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
Patch101: 0001-perf-skip-xmlto-validation.patch
# http://bugs.rosalinux.ru/show_bug.cgi?id=6235
# http://bugs.rosalinux.ru/show_bug.cgi?id=6459
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
Patch102: 0001-audit-make-it-less-verbose.patch
2020-08-18 08:02:38 +03:00
# AUFS 5 from http://aufs.sourceforge.net/
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
Patch109: 0001-Apply-AUFS-5.patch
# Unofficial AUFS for kernel 5.10
# https://sourceforge.net/projects/lxpup/files/Other/huge-kernels/kernel-5.10-aufs-changes/
Patch110: aufs-k510.diff
2019-12-07 21:57:55 +03:00
2020-06-18 18:38:30 +03:00
# For kmod() generator of RPM Provides
# Changes version of aacraid.ko
2020-08-18 08:02:38 +03:00
Patch111: 0001-Remove-RPM-illegal-chars-from-module-version.patch
2020-06-18 18:38:30 +03:00
# AltHa LSM Module
# https://www.altlinux.org/AltHa
# http://git.altlinux.org/gears/k/kernel-image-un-def.git
# TODO: known problem: https://bugzilla.altlinux.org/show_bug.cgi?id=38225
Patch201: 0001-AltHa-LSM-module.patch
Patch202: 0002-Documentation-for-AltHa-LSM.patch
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
Patch203: 0003-security-altha-altha_lsm.c-build-fixed-with-kernel-5.patch
Patch204: 0004-altha-use-path-strings-instead-of-path-structs.patch
2020-03-20 11:27:35 +03:00
# sent to upstream, https://patchwork.kernel.org/patch/11446123/
Patch302: 0001-sign-file-full-functionality-with-modern-LibreSSL.patch
# Support loading GOST-signed modules
Patch305: 0001-crypto-support-loading-GOST-signed-kernel-modules.patch
# Allow to off modules signature check dynamically
Patch306: 0001-ROSA-ima-allow-to-off-modules-signature-check-dynami.patch
# Experimental patch to reduce freezes in low memory conditions
# Config values are the following:
# CONFIG_UNEVICTABLE_ACTIVEFILE=y
# CONFIG_UNEVICTABLE_ACTIVEFILE_KBYTES_LOW=102400 (100 MB)
# CONFIG_UNEVICTABLE_ACTIVEFILE_KBYTES_MIN=51200 (50 MB)
# + zswap is enabled by default
# 50 MB is default value of min_filelist_kbytes in Chromium OS
# https://chromium.googlesource.com/chromiumos/third_party/kernel-next/+/545e2917dbd863760a51379de8c26631e667c563%5E!/
# 256 and 512 MB values are too big as a distro default because many systems have 512MB-2GB RAM
# TODO: tune 50 and 100 MB to some not random and mathemetically explainable values
# https://www.linux.org.ru/news/kernel/16052362?cid=16075323
Patch307: le9pf.diff
Patch308: 0001-Revert-kallsyms-unexport-kallsyms_lookup_name-and-ka.patch
2013-11-16 00:27:01 +04:00
Add support of Baikal-M SoCs Information about config values was taken from: From 804820df7bcb3d53a33ecd074b1eac277e938f24 Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov <asheplyakov@altlinux.org> Date: Thu, 4 Feb 2021 19:35:14 +0400 Subject: [PATCH] config-aarch64: adjusted for Baikal-M (MBM1.0 board) * DW_APB_TIMER=y, DW_APB_TIMER_OF=y: SoC clocks * SERIAL_8250_DW=y: serial console * I2C_DESIGNWARE_CORE=y, I2C_DESIGNWARE_PLATFORM=y: BMC (board management controller) and RTC (Real Time Clock) are connected via I2C. * GPIO_DWAPB=y: device (PCIe, PHY, etc) reset/configuration * RTC_DRV_PCF2127=y: RTC compiled in so the kernel automatically sets the system time from the hardware clock * TP_BMC=y: amongst other things handles the power button * DRM_BAIKAL_VDU=m, DRM_BAIKAL_HDMI=m: video unit and HDMI transmitter * CMA_SIZE_MBYTES=256: video display unit and GPU use system RAM, hence CMA should reserve enough (contiguous) memory. Note: CMA reserves memory during very early init, hence the size has to be hard-coded into CONFIG * MALI_MIDGARD=m: GPU driver, kernel side of proprietary mali blob. Note: kernel mode code is GPLv2, so it's fine to distribute it. * SENSORS_BT1_PVT=m: hardware temperature/voltage sensors * PCI_BAIKAL=m: PCIe root complex. Compiled as a module since takes ages (60 seconds or so) to probe the hardware. If compiled in substantially increases the boot time, and machine is completely unresponsive during probing PCIe. When built as a module probing executes concurrently with other boot activities (unless booting from a PCIe device) * STMMAC_ETH=m, STMMAC_PLATFORM=m, DWMAC_BAIKAL=m: Ethernet driver
2021-06-22 16:12:03 +03:00
# Support SoC with Baikal-M (ARMv8) CPU
# From http://git.altlinux.org/gears/k/kernel-image-std-def.git (many thanks!)
# They are based on sources from official SDK with patched kernel from Baikal Electronics
Patch0601: 0601-Baikal-M-Kconfig-defconfig.patch
Patch0602: 0602-Baikal-M-clock-driver.patch
Patch0603: 0603-efi-rtc-avoid-calling-efi.get_time-on-Baikal-M-board.patch
Patch0604: 0604-efi-arm-runtime-print-EFI-mapping.patch
Patch0605: 0605-ethernet-stmmac-made-dwmac1000_-DMA-functions-availa.patch
Patch0606: 0606-stmmac-Baikal-M-dwmac-driver.patch
Patch0607: 0607-Fixed-secondary-CPUs-boot-on-BE-M1000-SoC.patch
Patch0608: 0608-Baikal-M-USB-driver.patch
# https://bugzilla.altlinux.org/show_bug.cgi?id=40269
Patch0609: 0609-Baikal-M-video-unit-driver.patch
Patch0610: 0610-Added-Baikal-T1-M-BMC-driver.patch
Patch0611: 0611-dw-hdmi-ahb-audio-support-BE-M1000-SoC.patch
Patch0612: 0612-bt1-pvt.c-access-registers-via-pvt_-readl-writel-hel.patch
Patch0613: 0613-bt1-pvt-define-pvt_readl-pvt_writel-for-BE-M1000-SoC.patch
Patch0614: 0614-bt1-pvt-adjust-probing-for-BE-M1000-SoC.patch
Patch0615: 0615-bt1-pvt-added-compatible-baikal-pvt.patch
Patch0616: 0616-Baikal-M-PCIe-driver-from-SDK-M-4.3.patch
Patch0617: 0617-Baikal-M-PCIe-driver-from-SDK-M-4.4.patch
Patch0618: 0618-baikal_vdu-avoid-using-SMC-calls-for-updating-frameb.patch
Patch0619: 0619-panfrost-compatibility-with-Baikal-M-firmware-from-S.patch
Patch0620: 0620-cpufreq-dt-don-t-load-on-BE-M1000-SoC.patch
Patch0621: 0621-baikal_clk-compatibility-with-SDK-M-5.1-firmware.patch
Patch0622: 0622-stmmac_mdio-implemented-reset-via-MAC-GP-out-pin.patch
Patch0623: 0623-dwmac_baikal-clear-PHY-reset-before-calling-generic-.patch
Patch0624: 0624-BROKEN-dwc-i2s-support-BE-M1000-SoC.patch
Patch0625: 0625-baikal_vdu_drm-LVDS-panel-support.patch
Patch0626: 0626-Serial-82550_dw-Fix-clock-rate-setting-in-dw8250_set.patch
Patch0627: 0627-drm-panfrost-Fix-memory-attributes-for-Mali-T620.patch
Patch0628: 0628-drm-panfrost-Trim-affinity-for-Mali-T620.patch
Patch0629: 0629-baikal_vdu_drm-_plane_atomic_check-actually-re-enabl.patch
Patch0630: 0630-baikal_vdu-figure-out-LVDS-endpoint-count.patch
Patch0631: 0631-panfrost-disable-devfreq-on-BE-M1000-SoC.patch
Add support of Baikal-M SoCs Information about config values was taken from: From 804820df7bcb3d53a33ecd074b1eac277e938f24 Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov <asheplyakov@altlinux.org> Date: Thu, 4 Feb 2021 19:35:14 +0400 Subject: [PATCH] config-aarch64: adjusted for Baikal-M (MBM1.0 board) * DW_APB_TIMER=y, DW_APB_TIMER_OF=y: SoC clocks * SERIAL_8250_DW=y: serial console * I2C_DESIGNWARE_CORE=y, I2C_DESIGNWARE_PLATFORM=y: BMC (board management controller) and RTC (Real Time Clock) are connected via I2C. * GPIO_DWAPB=y: device (PCIe, PHY, etc) reset/configuration * RTC_DRV_PCF2127=y: RTC compiled in so the kernel automatically sets the system time from the hardware clock * TP_BMC=y: amongst other things handles the power button * DRM_BAIKAL_VDU=m, DRM_BAIKAL_HDMI=m: video unit and HDMI transmitter * CMA_SIZE_MBYTES=256: video display unit and GPU use system RAM, hence CMA should reserve enough (contiguous) memory. Note: CMA reserves memory during very early init, hence the size has to be hard-coded into CONFIG * MALI_MIDGARD=m: GPU driver, kernel side of proprietary mali blob. Note: kernel mode code is GPLv2, so it's fine to distribute it. * SENSORS_BT1_PVT=m: hardware temperature/voltage sensors * PCI_BAIKAL=m: PCIe root complex. Compiled as a module since takes ages (60 seconds or so) to probe the hardware. If compiled in substantially increases the boot time, and machine is completely unresponsive during probing PCIe. When built as a module probing executes concurrently with other boot activities (unless booting from a PCIe device) * STMMAC_ETH=m, STMMAC_PLATFORM=m, DWMAC_BAIKAL=m: Ethernet driver
2021-06-22 16:12:03 +03:00
2020-03-09 10:50:38 +03:00
# Disable AutoReq
AutoReq: 0
# but keep autoprov for kmod(xxx)
AutoProv: 1
2013-11-16 00:27:01 +04:00
2020-03-09 10:46:18 +03:00
BuildRequires: bash
BuildRequires: bc
BuildRequires: binutils
BuildRequires: gcc
# ./scripts/mkcompile_h
2020-12-03 15:12:38 +03:00
# in net-tools in rosa2016.1, already installed
%if %{mdvver} > 201610
BuildRequires: hostname
2020-12-03 15:12:38 +03:00
%endif
# For power tools
BuildRequires: pkgconfig(ncurses)
2013-11-16 00:27:01 +04:00
BuildRequires: kmod-devel kmod-compat
BuildRequires: bison
BuildRequires: flex
BuildRequires: bzip2
2019-09-24 11:56:44 +03:00
BuildRequires: rsync
2020-11-26 21:21:05 +00:00
%ifarch x86_64 aarch64
BuildRequires: numa-devel
%endif
# for perf, cpufreq and all other tools
# for cpupower
%if %{build_cpupower}
BuildRequires: pciutils-devel
%endif
# for perf
%if %{build_perf}
BuildRequires: asciidoc
BuildRequires: audit-devel
2013-11-16 00:27:01 +04:00
BuildRequires: binutils-devel
BuildRequires: elfutils-devel
BuildRequires: libunwind-devel
2013-11-16 00:27:01 +04:00
BuildRequires: newt-devel
BuildRequires: perl-devel
BuildRequires: python3
BuildRequires: pkgconfig(python3)
2013-11-16 00:27:01 +04:00
BuildRequires: xmlto
BuildRequires: zlib-devel
BuildRequires: pkgconfig(libcrypto)
%endif
%if %{with uml}
BuildRequires: vde-devel
%endif
2019-12-01 02:03:15 +03:00
# (To generate keys)
2019-12-07 21:57:55 +03:00
# LibreSSL has GOST support without editing openssl.cnf
# or dlopen()-ing external library
BuildRequires: libressl libressl-devel
# To verify signatures (find, xargs, hexdump)
BuildRequires: findutils util-linux
2019-11-11 17:47:53 +03:00
2020-07-29 10:59:41 +03:00
%if %{with binary_extra_modules}
BuildRequires: kernel-source-rtl8821ce
BuildRequires: kernel-source-tripso
BuildRequires: kernel-source-ipt-so
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%if %{with binary_virtualbox_host}
2020-07-29 10:59:41 +03:00
BuildRequires: kernel-source-virtualbox
2020-11-26 18:58:01 +00:00
%endif
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%if %{with binary_shredder}
BuildRequires: kernel-source-shredder-kernel
%endif
# rosa-test-suite is maintained in certified branches only
# nlkm, memfreetest, pcietest
%if %{with nickel}
BuildRequires: kernel-source-rosa-test-suite
2020-07-29 10:59:41 +03:00
%endif
%endif #with binary_extra_modules
2020-07-29 10:59:41 +03:00
%if %{with ccache}
BuildRequires: ccache
%endif
%if %{with compress_modules}
BuildRequires: zstd
%endif
Provides: kernel = %{EVRD}
Provides: kernel-%{flavour} = %{EVRD}
# dnf config-manager --dump | grep installonly
Provides: installonlypkg(kernel) = %{EVRD}.image
Provides: installonlypkg(kernel) = %{EVRD}.modules
# >= because of added support of zstd-compressed modules
Requires(posttrans): dracut >= 053-0.git5eb736.5
Requires(posttrans): kmod >= 28-3
# Usually necessary, but sometimes user may want to not install them
Recommends: linux-firmware
Recommends: wireless-regdb
Recommends: crda
Recommends: microcode
# Set BFQ as default scheduler for HDDs
# https://www.phoronix.com/scan.php?page=article&item=linux-50hdd-io
Recommends: udev-rules-ioschedulers
%if %{with flow_abi}
Requires: kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
2013-11-16 00:27:01 +04:00
%endif
%ifarch %{ix86}
Conflicts: arch(x86_64)
2013-11-16 00:27:01 +04:00
%endif
2016-07-21 15:58:13 +03:00
Obsoletes: kernel-%{flavour}-%{kernelversion}.%{patchlevel}-latest < 5.10.34-2
%description
The kernel package contains the Linux kernel (vmlinuz), the core of your
operating system. The kernel handles the basic functions
of the operating system: memory allocation, process allocation, device
input and output, etc. This is a general-purpose kernel.
%posttrans
# We always regenerate initrd here, even if it already exists. This may
# happen if kernel-<...>-devel is installed first, triggers rebuild of
# DKMS modules and some of these request remaking of initrd. The initrd
# that is created then will be non-functional. But when the user installs
# kernel-<...> package, that defunct initrd will be replaced with a working
# one here.
2013-11-16 00:27:01 +04:00
#
# depmod is also needed, because some DKMS-modules might have been installed
# when the devel package was installed but that was before the main modules
# were installed.
# This is also the reason the devel package is in Requires(post) for this
# package now: it must be installed completely before we call depmod here.
/sbin/depmod -a %{kver_full}
/sbin/dracut -f %{initrd_path} %{kver_full}
2013-11-16 00:27:01 +04:00
# File triggers from grub packages will handle this.
#/usr/sbin/update-grub2
2013-11-16 00:27:01 +04:00
%files -f %{kernel_files}
%{_bootdir}/System.map-%{kver_full}
%{_bootdir}/symvers-%{kver_full}.zst
%{_bootdir}/config-%{kver_full}
%{_bootdir}/vmlinuz-%{kver_full}
%ghost %{initrd_path}
%ifarch %{armx}
%{_bootdir}/dtb-%{kver_full}
%endif
%{_modulesdir}/%{kver_full}/modules.*
%if %{with flow_abi}
%{_modulesdir}/%{kver_full}/kernel/zzz-%{kernelversion}.%{patchlevel}-rosa-flow-abi
%endif
%if %{with binary_extra_modules}
# 8821ce.ko.debug will not be excluded and will be in the main debug subpackage
%exclude %{_modulesdir}/%{kver_full}/kernel/net/wireless/8821ce.ko%{kmod_suffix}
%if %{with binary_shredder}
%exclude %{_modulesdir}/%{kver_full}/kernel/extra/shredder-kernel.ko%{kmod_suffix}
%endif
%if %{with binary_virtualbox_host}
# vbox host modules may be built here (vboxnetflt vboxnetadp vboxdrv vboxpci)
# vbox guest modules are in the mainline kernel now (vboxvideo vboxguest vboxsf)
%exclude %{_modulesdir}/%{kver_full}/kernel/misc/vbox*.ko%{kmod_suffix}
%endif
%exclude %{_modulesdir}/%{kver_full}/kernel/net/xt_TRIPSO.ko%{kmod_suffix}
%exclude %{_modulesdir}/%{kver_full}/kernel/net/xt_so.ko%{kmod_suffix}
%if %{with nickel}
%exclude %{_modulesdir}/%{kver_full}/kernel/misc/nlkm.ko%{kmod_suffix}
%exclude %{_modulesdir}/%{kver_full}/kernel/misc/memfreetest.ko%{kmod_suffix}
%exclude %{_modulesdir}/%{kver_full}/kernel/misc/pcietest.ko%{kmod_suffix}
%endif
%endif #with binary_extra_modules
############################################################################
%if %build_devel
%package devel
Summary: Development files for %{name}
Group: Development/Kernel
Requires: glibc-devel
Requires: ncurses-devel
Requires: make
Requires: gcc
Requires: perl
Provides: kernel-devel = %{kverrel}
Provides: kernel-%{flavour}-devel = %{kverrel}
Provides: installonlypkg(kernel) = %{EVRD}.devel
Obsoletes: kernel-%{flavour}-%{kernelversion}.%{patchlevel}-devel-latest < 5.10.34-2
# Have dkms updated/installed before the kernel, scriptlet here checks if dkms exists
OrderWithRequires(post): dkms
# Try to remove the main kernel package after removing this devel package
# because there may be dkms-built kernel modules inside directories owned
# by the main package, try to get rid of such files before RPM starts to
# deal with directories owned in the main package
# (note that the devel package does not explicitly require the main package,
# there is no need to do so, a kernel module may be built using just the devel part).
OrderWithRequires(postun): %{name} = %{EVRD}
%ifarch %{ix86}
Conflicts: arch(x86_64)
2013-11-16 00:27:01 +04:00
%endif
%description devel
This package contains the kernel files (headers and build tools)
that should be enough to build additional drivers for
use with %{name}.
%post devel
2020-08-03 21:07:52 +03:00
if command -v dkms_autoinstaller >/dev/null 2>&1; then
dkms_autoinstaller start %{kver_full}
fi
%preun devel
# If any DKMS modules with REMAKE_INITRD=yes in their configs have been
# uninstalled, initrd has been regenerated for the given kernel. However,
# the kernel itself might have been uninstalled before, so that (defunct)
# initrd image files would be left behind. Remove them if the kernel itself
# is no longer installed. Should work if they are uninstalled in parallel
# too.
if ! test -f /boot/vmlinuz-%{kver_full}; then
rm -f /boot/initrd-%{kver_full}.img
rm -f /boot/initrd-%{kver_full}_old.img
fi
if ! command -v dkms >/dev/null 2>&1; then exit 0; fi
for ii in $(/usr/sbin/dkms status -k %{kver_full} | awk '{ print $1 $2; }'); do
mod=$(echo $ii | awk -v FS=',' '{ print $1; }')
ver=$(echo $ii | awk -v FS=',' '{ print $2; }')
/usr/sbin/dkms --rpm_safe_upgrade uninstall -m $mod -v $ver -k %{kver_full} || :
done
%files devel
2020-11-26 21:33:48 +00:00
%{devel_root}/Documentation
%dir %{devel_root}
%dir %{devel_root}/arch
%dir %{devel_root}/include
%{devel_root}/arch/um
2020-11-26 21:33:48 +00:00
%{devel_root}/arch/x86
%{devel_root}/arch/arm
%{devel_root}/arch/arm64
%{devel_root}/block
%{devel_root}/certs
%{devel_root}/crypto
%{devel_root}/drivers
%{devel_root}/fs
2020-11-26 21:33:48 +00:00
%{devel_root}/include/soc
%{devel_root}/include/acpi
%{devel_root}/include/asm-generic
%{devel_root}/include/clocksource
%{devel_root}/include/config
%{devel_root}/include/crypto
%{devel_root}/include/drm
%{devel_root}/include/dt-bindings
%{devel_root}/include/generated
%{devel_root}/include/keys
%{devel_root}/include/kvm
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%{devel_root}/include/kunit
%{devel_root}/include/linux
%{devel_root}/include/math-emu
%{devel_root}/include/media
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%{devel_root}/include/memory
%{devel_root}/include/misc
%{devel_root}/include/net
%{devel_root}/include/pcmcia
%{devel_root}/include/ras
%{devel_root}/include/rdma
%{devel_root}/include/scsi
%{devel_root}/include/sound
%{devel_root}/include/target
%{devel_root}/include/trace
%{devel_root}/include/uapi
%{devel_root}/include/vdso
%{devel_root}/include/video
%{devel_root}/include/xen
%{devel_root}/init
%{devel_root}/ipc
%{devel_root}/kernel
%{devel_root}/lib
%{devel_root}/mm
%{devel_root}/net
%{devel_root}/samples
%{devel_root}/scripts
%{devel_root}/security
%{devel_root}/sound
%{devel_root}/tools
%{devel_root}/usr
%{devel_root}/virt
%{devel_root}/.config
%{devel_root}/Kbuild
%{devel_root}/Kconfig
%{devel_root}/Makefile
%{devel_root}/Module.symvers
%{devel_root}/arch/Kconfig
%{_modulesdir}/%{kver_full}/build
%{_modulesdir}/%{kver_full}/source
%endif # /build_devel
############################################################################
%if %build_debug
%package debuginfo
Summary: Debuginfo for %{name}
Group: Development/Debug
Provides: kernel-debug = %{kverrel}
AutoReq: 0
AutoProv: 0
%description debuginfo
This package contains the files with debuginfo for %{name}.
%files debuginfo -f %{debuginfo_files}
%{_bootdir}/vmlinux-%{kver_full}
%endif # /build_debug
############################################################################
2013-11-16 00:27:01 +04:00
%if %build_doc
%package doc
Summary: Various documentation bits found in the kernel source
2013-11-16 00:27:01 +04:00
Group: Documentation
Buildarch: noarch
%description doc
This package contains documentation files from the kernel source.
%files doc
%doc linux-%{tar_ver}/Documentation/*
2013-11-16 00:27:01 +04:00
%endif
############################################################################
2013-11-16 00:27:01 +04:00
%if %{build_perf}
%package -n perf
Summary: perf tool and the supporting documentation
Group: System/Kernel and hardware
%description -n perf
The package contains perf tool and the supporting documentation.
%files -n perf
%{_bindir}/perf
%ifarch x86_64
%{_bindir}/perf-read-vdso32
2013-11-16 00:27:01 +04:00
%endif
%{_bindir}/trace
%dir %{_prefix}/libexec/perf-core
%dir %{_libdir}/traceevent
%dir %{_libdir}/traceevent/plugins
%{_libdir}/traceevent/plugins/*
%{_prefix}/libexec/perf-core/*
%{_mandir}/man[1-8]/perf*
%{_sysconfdir}/bash_completion.d/perf
%{_datadir}/perf-core/strace/groups/*
%{_datadir}/doc/perf-tip/*.txt
/usr/lib/perf/examples/bpf/*
/usr/lib/perf/include/bpf/*
%endif
############################################################################
2013-11-16 00:27:01 +04:00
%if %{build_cpupower}
%package -n cpupower
Summary: The cpupower tools
2013-11-16 00:27:01 +04:00
Group: System/Kernel and hardware
%description -n cpupower
The cpupower tools.
2013-11-16 00:27:01 +04:00
%post -n cpupower
if [ $1 -ge 0 ]; then
# Do not enable/disable cpupower.service directly, because it should start
# when cpupower.path triggers it.
/bin/systemctl enable cpupower.path >/dev/null 2>&1 || :
/bin/systemctl start cpupower.path >/dev/null 2>&1 || :
2014-04-01 15:25:39 +04:00
fi
2013-11-16 00:27:01 +04:00
%preun -n cpupower
2014-04-01 15:25:39 +04:00
if [ $1 -eq 0 ]; then
/bin/systemctl --no-reload disable cpupower.path > /dev/null 2>&1 || :
/bin/systemctl stop cpupower.path > /dev/null 2>&1 || :
2014-04-01 15:25:39 +04:00
fi
2013-11-16 00:27:01 +04:00
%files -n cpupower -f cpupower.lang
%{_bindir}/cpupower
%{_bindir}/cpupower-start.sh
%{_libdir}/libcpupower.so.0
%{_libdir}/libcpupower.so.0.0.1
%{_unitdir}/cpupower.service
%{_unitdir}/cpupower.path
%{_datadir}/bash-completion/completions/cpupower
%{_mandir}/man[1-8]/cpupower*
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
############################################################################
2013-11-16 00:27:01 +04:00
%package -n cpupower-devel
Summary: Development files for cpupower
2013-11-16 00:27:01 +04:00
Group: Development/Kernel
Requires: cpupower = %{EVRD}
2013-11-16 00:27:01 +04:00
Conflicts: %{_lib}cpufreq-devel
%description -n cpupower-devel
This package contains the development files for cpupower.
%files -n cpupower-devel
%{_libdir}/libcpupower.so
%{_includedir}/cpufreq.h
2020-03-21 12:28:56 +03:00
%{_includedir}/cpuidle.h
2013-11-16 00:27:01 +04:00
%endif
############################################################################
%if %{build_headers}
%package -n kernel-headers
2013-11-16 00:27:01 +04:00
Summary: Linux kernel header files mostly used by your C library
Group: System/Kernel and hardware
Epoch: 1
Provides: linux-userspace-headers = %{EVRD}
Provides: kernel-release-headers = %{EVRD}
2013-11-16 00:27:01 +04:00
%description -n kernel-headers
2013-11-16 00:27:01 +04:00
C header files from the Linux kernel. The header files define
structures and constants that are needed for building most
standard programs, notably the C library.
This package is not suitable for building kernel modules, you
should use the 'kernel-devel' package instead.
%files -n kernel-headers
2020-03-21 12:28:56 +03:00
%{_includedir}/*
2013-11-16 00:27:01 +04:00
# Don't conflict with cpupower-devel
%if %{build_cpupower}
2020-03-21 12:28:56 +03:00
%exclude %{_includedir}/cpufreq.h
%exclude %{_includedir}/cpuidle.h
2013-11-16 00:27:01 +04:00
%endif
%endif
2013-11-16 00:27:01 +04:00
############################################################################
2020-03-13 20:35:12 +03:00
%if %{with uml}
%package uml
2020-03-13 20:35:12 +03:00
Summary: User Mode Linux binary
Group: System/Kernel and hardware
Provides: kernel-uml = %{kverrel}
Provides: kernel-uml-%{flavour} = %{kverrel}
Provides: installonlypkg(kernel) = %{EVRD}.uml
Obsoletes: kernel-uml-%{flavour}-%{kernelversion}.%{patchlevel}-latest < 5.10.34-2
2020-03-13 20:35:12 +03:00
%description uml
User Mode Linux binary.
Stripped, debug is in %{name}-debuginfo.
2020-03-13 20:35:12 +03:00
%files uml
2020-03-13 20:35:12 +03:00
%{_bindir}/linux-uml-%{kver_full}
#------------------------------------------------
%package uml-modules
2020-03-13 20:35:12 +03:00
Summary: User Mode Linux (UML) kernel modules
Group: System/Kernel and hardware
Provides: kernel-uml-modules = %{kverrel}
Provides: kernel-uml-modules-%{flavour} = %{kverrel}
Provides: installonlypkg(kernel-module) = %{EVRD}.uml
Obsoletes: kernel-uml-modules-%{flavour}-%{kernelversion}.%{patchlevel}-latest < 5.10.34-2
2020-03-13 20:35:12 +03:00
%description uml-modules
2020-03-13 20:35:12 +03:00
User Mode Linux (UML) kernel modules
- not compressed
- not stripped
- signed
%files uml-modules
2020-03-13 20:35:12 +03:00
/lib/modules-uml/%{kver_full}
%endif #endif uml
2020-07-29 10:59:41 +03:00
#------------------------------------------------
%if %{with binary_extra_modules}
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%ksob_mk_module_pkg -n 8821ce -s net/wireless -r rtl8821ce-blacklist
2020-07-29 10:59:41 +03:00
%ksob_mk_module_pkg -n xt_TRIPSO -s net -r tripso
%ksob_mk_module_pkg -n xt_so -s net -r ipt-so
2020-07-29 10:59:41 +03:00
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%if %{with binary_shredder}
%ksob_mk_module_pkg -n shredder-kernel -s extra -r rosa-shredder-user
%endif
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
#------------------------------------------------
2020-07-29 10:59:41 +03:00
# virtualbox host
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%if %{with binary_virtualbox_host}
2020-07-29 10:59:41 +03:00
%ksob_mk_module_pkg -n vboxnetflt -s misc
%ksob_mk_module_pkg -n vboxnetadp -s misc
%ksob_mk_module_pkg -n vboxdrv -s misc
%ksob_mk_module_pkg -n vboxpci -s misc
# a package which will pull all those modules
%package -n kernel-modules-virtualbox-host-%{ksob_kernel}
2020-07-29 10:59:41 +03:00
Summary: Meta package to pull VirtualBox host kernel modules for kernel-%{flavour}-%{kernelversion}.%{patchlevel}
Group: System/Kernel and hardware
Requires: kernel-module-vboxnetflt-%{ksob_kernel}
Requires: kernel-module-vboxnetadp-%{ksob_kernel}
Requires: kernel-module-vboxdrv-%{ksob_kernel}
Requires: kernel-module-vboxpci-%{ksob_kernel}
Obsoletes: kernel-modules-virtualbox-host-%{flavour}-%{kernelversion}.%{patchlevel}-latest < 5.10.34-2
2020-07-29 10:59:41 +03:00
%description -n kernel-modules-virtualbox-host-%{ksob_kernel}
Meta package to pull VirtualBox host kernel modules for %{name}
2020-07-29 10:59:41 +03:00
%files -n kernel-modules-virtualbox-host-%{ksob_kernel}
2020-07-29 10:59:41 +03:00
# empty
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%endif #ifarch x86
2020-07-29 10:59:41 +03:00
#------------------------------------------------
%if %{with nickel}
%ksob_mk_module_pkg -n nlkm -s misc
%ksob_mk_module_pkg -n memfreetest -s misc
%ksob_mk_module_pkg -n pcietest -s misc
%endif
2020-07-29 10:59:41 +03:00
%endif #binary_extra_modules
############################
%if %{with flow_abi}
%package -n kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
Summary: Directory to install third-party binary kernel modules for kernels %{kernelversion}.%{patchlevel}.x
Group: System/Kernel and hardware
%description -n kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
This package contains a directory to install third-party binary kernel modules for kernels %{kernelversion}.%{patchlevel}.x.
Some vendors provide binary-only kernel modules. They can put them into /lib/modules/%{kernelversion}.%{patchlevel}-rosa-flow-abi.
kmod tools will find them for kernels 5.4.x of "generic" and "nickel" flavours,
but there is no guarantee that these modules will load and work correctly on newer
or older kernels then the ones they were build against.
We call this "flow ABI" because most ABIs are not changed between %{kernelversion}.%{patchlevel}.x releases,
but there are no specific guarantees. ABI may evolve and change.
We highly recommend to use DKMS and build third-party kernel modules from source for every kernel!
This package does nothing, just owns a directory for third-party binary kernel modules.
%files -n kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
/lib/modules/%{kernelversion}.%{patchlevel}-rosa-flow-abi
%endif #with flow_abi
################################################
2020-03-13 20:35:12 +03:00
2013-11-16 00:27:01 +04:00
%prep
# avoid accidental merge
%if 0%{?rpm5}
%{error:Package structure is for dnf, not for urpmi!}
%endif
2013-11-16 00:27:01 +04:00
%setup -q -n %top_dir_name -c
2020-03-13 20:35:12 +03:00
%if %{with uml}
cp -r %{src_dir} %{src_dir}.uml
%endif
2013-11-16 00:27:01 +04:00
cd %src_dir
2020-11-26 18:48:55 +00:00
%autopatch -p1
2013-11-16 00:27:01 +04:00
#
# Setup Begin
#
# Kernel configuration
echo "Creating the kernel configuration file."
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
# Configs
cp %{SOURCE111} .
cp %{SOURCE112} .
cp %{SOURCE113} .
cp kernel-%{arch_suffix}.config .config
touch %{build_dir}/.config.append
2020-11-26 21:17:21 +00:00
# get rid of unwanted files
find . -name '*~' -o -name '*.orig' -o -name '*.append' -delete
# wipe all .gitignore/.get_maintainer.ignore files
find . -name "*.g*ignore" -delete
# Enable debug info if requested.
sed -i '/CONFIG_DEBUG_INFO/d' .config
2013-11-16 00:27:01 +04:00
%if %build_debug
echo 'CONFIG_DEBUG_INFO=y' >> %{build_dir}/.config.append
echo 'CONFIG_DEBUG_INFO_DWARF4=y' >> %{build_dir}/.config.append
echo 'CONFIG_GDB_SCRIPTS=y' >> %{build_dir}/.config.append
%else
echo 'CONFIG_DEBUG_INFO=n' >> %{build_dir}/.config.append
2013-11-16 00:27:01 +04:00
%endif
sed -i '/CONFIG_MODULE_SIG_FORCE/d' .config
%if %{with oblig_signed_modules}
2019-11-11 17:47:53 +03:00
# Disallow loading not signed modules
# But 0001-ROSA-ima-allow-to-off-modules-signature-check-dynami.patch allows to override this in cmdline
2020-03-13 20:35:12 +03:00
echo CONFIG_MODULE_SIG_FORCE=y >> %{build_dir}/.config.append
%else
2020-03-13 20:35:12 +03:00
echo CONFIG_MODULE_SIG_FORCE=n >> %{build_dir}/.config.append
%endif
sed -i '/CONFIG_MODULE_SIG_KEY/d' .config
2019-12-01 02:03:15 +03:00
# Set path to the key that will be generated later by openssl/libressl
2020-03-13 20:35:12 +03:00
echo CONFIG_MODULE_SIG_KEY=\"%{certs_signing_key_priv_rnd}\" >> %{build_dir}/.config.append
# Set path to one PEM file with all keys that the kernel must trust
sed -i '/CONFIG_SYSTEM_TRUSTED_KEYS/d' .config
2020-03-13 20:35:12 +03:00
echo CONFIG_SYSTEM_TRUSTED_KEYS=\"%{certs_public_keys}\" >> %{build_dir}/.config.append
# Memory wiping
# Introduced in kernel 5.3 by commit 6471384af2a6530696fc0203bafe4de41a23c9ef
# Estimated performance impact is described in the commit
# "Fill newly allocated pages and heap objects with zeroes."
# To enable, add to cmdline: init_on_alloc=1
sed -i '/CONFIG_INIT_ON_ALLOC_DEFAULT_ON/d' .config
echo CONFIG_INIT_ON_ALLOC_DEFAULT_ON=n >> %{build_dir}/.config.append
# "Fill freed pages and heap objects with zeroes"
# To disable, add to cmdline: init_on_free=0
sed -i '/CONFIG_INIT_ON_FREE_DEFAULT_ON/d' .config
%if %{with nickel}
2020-03-13 20:35:12 +03:00
echo CONFIG_INIT_ON_FREE_DEFAULT_ON=y >> %{build_dir}/.config.append
%else
echo CONFIG_INIT_ON_FREE_DEFAULT_ON=n >> %{build_dir}/.config.append
%endif
# Here enabling only either only init_on_free or only init_on_alloc
# makes sense; init_on_alloc is not about protecting information.
2020-03-13 20:35:12 +03:00
# To load kernel keyring in UML
for i in STREEBOG SHA1 SHA256 SHA512 ECRDSA RSA ; do
if ! grep -q "^CONFIG_CRYPTO_${i}=y$" .config; then
sed -i "/CONFIG_CRYPTO_${i}/d" .config
echo "CONFIG_CRYPTO_${i}=y" >> %{build_dir}/.config.append
fi
done
2020-03-13 20:35:12 +03:00
cat %{build_dir}/.config.append >> .config
# Store the config file in the appropriate directory.
2020-11-26 18:48:55 +00:00
CONFIG_DIR=arch/%{arch_type}/configs
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
mkdir -p "${CONFIG_DIR}"
2020-11-26 18:48:55 +00:00
cfg_file=arch/%{arch_type}/configs/%{arch_suffix}_defconfig-%{flavour}
2021-05-22 12:08:22 +03:00
make ARCH=%{arch_type} oldconfig
# When it is needed to edit kernel configs, run:
2021-06-01 07:01:02 +03:00
# abf fetch
# rpmbuild --define "_sourcedir $PWD" --with=fail -bb kernel.spec
2021-05-22 12:08:22 +03:00
# and then work with the config in the buildroot with applied patches etc.
%{?_with_fail:exit 1}
mv .config ${cfg_file}
echo "Created ${cfg_file}."
2013-11-16 00:27:01 +04:00
# make sure the kernel has the sublevel we know it has...
LC_ALL=C sed -ri "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile
2013-11-16 00:27:01 +04:00
# get rid of unwanted files
find . -name '*~' -o -name '*.orig' -o -name '*.append' | %kxargs rm -f
find . -name '.get_maintainer.ignore' | %kxargs rm -f
2013-11-16 00:27:01 +04:00
############################################################################
2013-11-16 00:27:01 +04:00
%build
2019-11-11 22:27:50 +03:00
# Ensure that build time generated private keys don't get published
# as e.g. "RPM build root" on ABF!
# Note that ABF sends SIGKILL to rpm-build.sh when the build is terminated;
# in this case trap will not work, but RPM build root also will not be
# saved because rpm-build.sh saves it, but it is SIGKILLed.
# For best security we could store private keys in RAM (not reachable from
# filesystem, so not in /tmp!) and override sth like fopen() by LD_PRELOAD
# to give the content of keys from RAM when a virtual address of a key file
# is accessed, but currently I don't know how to implement this (TODO: ).
_cleanup(){
2020-03-14 13:49:15 +03:00
# Show resulting kernel public keys for debugging
cat "%{src_dir}/%{certs_dir_rnd}/x509_certificate_list" | base64 -d || :
2020-03-14 13:49:15 +03:00
rm -fvr "%{src_dir}/%{certs_dir_rnd}"
2020-03-13 20:35:12 +03:00
%if %{with uml}
cat "%{src_dir}.uml/%{certs_dir_rnd}/x509_certificate_list" | base64 -d || :
2020-03-13 20:35:12 +03:00
rm -fvr "%{src_dir}.uml/%{certs_dir_rnd}"
%endif
2019-11-11 22:27:50 +03:00
}
# Make a trap to delete keys even if %%build fails in the middle
trap "_cleanup" EXIT
rm -rf %{temp_root}
install -d %{temp_root}
2013-11-16 00:27:01 +04:00
cd %src_dir
2013-11-16 00:27:01 +04:00
2019-11-11 17:47:53 +03:00
### Keys for signing kernel modules
# Keys can be generated both manually and automatically,
# let's generate them by ourselves to take full control of the process
# https://www.ibm.com/support/knowledgecenter/en/SSB23S_1.1.0.13/gtps7/cfgcert.html
# See also certs/Makefile in kernel source
2019-11-11 17:47:53 +03:00
mkdir -p "%{certs_dir_rnd}"
# On ABF, %%packager == $username <$email>
# Try to extract email from %%packager if it is set
_get_email(){
# Check that macro %%packager was set and is not empty
if echo '%{packager}' | grep -q 'packager}$' || [ -z "%{packager}" ]
# If was not set or is empty, use default email
then echo 'rpmbuild@rosa.unknown' && return
# Otherwise try to extract email from 'name <email>' or sth else
else temp="$(echo '%{packager}' | tr '[:upper:]' '[:lower:]' | tr ' ' '\n' | tr -d '<>' | grep -E '@.*\..*' | head -n 1)"
fi
# Validate that what we have now is a valid email
# https://stackoverflow.com/a/2138832, https://stackoverflow.com/a/41192733
# Note that we set %%_buildshell to /bin/bash to guarantee the work of this bashism
regex_email="^[a-z0-9!#\$%&'*+/=?^_\`{|}~-]+(\.[a-z0-9!#$%&'*+/=?^_\`{|}~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]*[a-z0-9])?\$"
if [[ "$temp" =~ ${regex_email} ]]
# If it is, use it
then echo "$temp" && return
# Otherwise use default email
else echo 'rpmbuild@rosa.unknown' && return
fi
# If script above has not return'ed for any reason,
# e.g. because of non-bash shell being not able to
# process regexp, use default email
echo 'rpmbuild@rosa.unknown'
}
email="$(_get_email)"
2019-11-11 17:47:53 +03:00
cat <<EOF > "%{certs_key_config_rnd}"
[ req ]
prompt = no
string_mask = utf8only
#default_keyfile = %{certs_signing_key_priv_rnd}
2019-11-11 17:47:53 +03:00
distinguished_name = req_distinguished_name
x509_extensions = myexts
2019-11-11 17:47:53 +03:00
[ req_distinguished_name ]
organizationName = %{vendor} rpmbuild
commonName = Build time autogenerated @ALGO@ kernel key
emailAddress = ${email}
[ myexts ]
basicConstraints=critical,CA:FALSE
keyUsage=digitalSignature
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid
2019-11-11 17:47:53 +03:00
EOF
cat "%{certs_key_config_rnd}"
sed -e 's,@ALGO@,RSA,g' "%{certs_key_config_rnd}" > "%{certs_key_config_rnd}.RSA"
sed -e 's,@ALGO@,GOST R 34.10-2012,g' "%{certs_key_config_rnd}" > "%{certs_key_config_rnd}.GOST"
# avoid using the template
rm -f "%{certs_key_config_rnd}"
_libressl_gen_key(){
if [ "$GOST_KEY" = 1 ]
then
lssl_req_gost_args="\
-newkey gost2001 \
-pkeyopt dgst:streebog512 -pkeyopt paramset:A \
-streebog512"
OUT="%{certs_signing_key_priv_rnd}.GOST"
CONFIG="%{certs_key_config_rnd}.GOST"
else
lssl_req_gost_args=""
OUT="%{certs_signing_key_priv_rnd}.RSA"
CONFIG="%{certs_key_config_rnd}.RSA"
fi
libressl req -new -nodes -utf8 -batch \
$lssl_req_gost_args \
-days 109500 \
-x509 -config "$CONFIG" \
-out "$OUT" \
-keyout "$OUT"
# Verify
if [ "$GOST_KEY" = 1 ]; then
libressl x509 -in "%{certs_signing_key_priv_rnd}.GOST" -text -noout \
| grep -E 'Signature Algorithm:.*GOST R 34.10-2012'
libressl x509 -in "%{certs_signing_key_priv_rnd}.GOST" -text -noout \
| grep -E 'Digest Algorithm:.*GOST R 34-11-2012'
libressl x509 -in "%{certs_signing_key_priv_rnd}.GOST" -text -noout \
| grep -E 'Public Key Algorithm:.*GOST R 34.10-2012'
fi
}
2019-11-11 17:47:53 +03:00
GOST_KEY=0 _libressl_gen_key
GOST_KEY=1 _libressl_gen_key
# Fake CONFIG_MODULE_SIG_KEY to make build scripts happy
cp -v "%{certs_signing_key_priv_rnd}.RSA" "%{certs_signing_key_priv_rnd}"
# Strip public parts from the generated PEMs
sed -n \
'/^-----BEGIN CERTIFICATE-----$/,/^-----END CERTIFICATE-----$/p' \
"%{certs_signing_key_priv_rnd}.GOST" \
"%{certs_signing_key_priv_rnd}.RSA" \
> "%{certs_public_keys}"
2019-12-07 21:57:55 +03:00
# link sign-file and extract-cert with LibreSSL instead of OpenSSL
if [ $? != 0 ] ; then exit $? ; fi
sed -i %{src_dir}/scripts/Makefile \
2020-03-13 20:35:12 +03:00
%if %{with uml}
%{src_dir}.uml/scripts/Makefile \
%endif
-e "s, libcrypto , libressl-libcrypto ,g"
%if %{with additional_keys}
# Add additional public RSA keys to the list of trusted keys for kernel modules
# Build kernel --without additional_keys if you do not want to trust them
cat %{expand:%(for i in `seq 1 12`; do echo "%%SOURCE$((200+${i}))" | tr "\n" " "; done)} \
>> "%{certs_public_keys}"
%endif #endif additional_keys
cat %{certs_public_keys}
2019-11-11 17:47:53 +03:00
# .config
%smake -s mrproper
2020-11-26 18:48:55 +00:00
cp arch/%{arch_type}/configs/%{arch_suffix}_defconfig-%{flavour} .config
2013-11-16 00:27:01 +04:00
# make sure EXTRAVERSION says what we want it to say
LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{flavour}-%{buildrpmrel}/" Makefile
2013-11-16 00:27:01 +04:00
# build the kernel
echo "Building kernel %{kver_full}"
2013-11-16 00:27:01 +04:00
2020-11-26 21:09:27 +00:00
TARGETS="all"
# need to install dtbs to proper boot arm64 devices
%ifarch %{armx}
2020-11-26 21:09:27 +00:00
TARGETS="$TARGETS dtbs"
%endif
2021-02-23 17:35:52 +03:00
%kmake V=1 -s $TARGETS
2015-04-23 12:11:47 +03:00
2020-07-29 10:59:41 +03:00
# Install modules
mkdir -p %{temp_modules}/%{kver_full}
%smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{kver_full} modules_install
%if %{with binary_extra_modules}
# Build and install procedure is specific to each Makefile from kernmel-source-* packages
# See also: https://www.kernel.org/doc/html/latest/kbuild/modules.html
# Copy directory because write permissions are required
# `make modules_install` must be done before this, otherwise these copied files will be deleted
cp -r "$(rpm -q --qf '/usr/src/rtl8821ce-%%{VERSION}-%%{RELEASE}' kernel-source-rtl8821ce)" kernel-source-rtl8821ce
pushd kernel-source-rtl8821ce
%kmake KSRC=%{src_dir} M="$PWD"
mkdir -p %{temp_modules}/%{kver_full}/kernel/net/wireless/
cp 8821ce.ko %{temp_modules}/%{kver_full}/kernel/net/wireless/8821ce.ko
popd
rm -fr kernel-source-rtl8821ce
cp -r "$(rpm -q --qf '/usr/src/tripso-%%{VERSION}-%%{RELEASE}' kernel-source-tripso)" kernel-source-tripso
pushd kernel-source-tripso
%kmake KDIR=%{src_dir}
mkdir -p %{temp_modules}/%{kver_full}/kernel/net
cp xt_TRIPSO.ko %{temp_modules}/%{kver_full}/kernel/net/
popd
rm -fr kernel-source-tripso
cp -r "$(rpm -q --qf '/usr/src/ipt-so-%%{VERSION}-%%{RELEASE}' kernel-source-ipt-so)" kernel-source-ipt-so
pushd kernel-source-ipt-so
%kmake KDIR=%{src_dir}
mkdir -p %{temp_modules}/%{kver_full}/kernel/net
cp xt_so.ko %{temp_modules}/%{kver_full}/kernel/net/
popd
rm -fr kernel-source-ipt-so
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%if %{with binary_shredder}
2020-11-26 21:09:27 +00:00
cp -r "$(rpm -q --qf '/usr/src/shredder-kernel-%%{VERSION}-%%{RELEASE}' kernel-source-shredder-kernel)" kernel-source-shredder-kernel
pushd kernel-source-shredder-kernel
%kmake KERNEL_PATH=%{src_dir}
mkdir -p %{temp_modules}/%{kver_full}/kernel/extra/
cp shredder-kernel.ko %{temp_modules}/%{kver_full}/kernel/extra/
popd
rm -fr kernel-source-shredder-kernel
%endif
2020-11-26 21:09:27 +00:00
Update from 5.4 to 5.10.1 - rediffed most of patches, renamed files to easify further rediffs by git format-patch - thanks to abf.io/kernels_stable for some patches for kernel 5.9 - using unofficial patch for AUFS for kernel 5.10, there may be issues with stability, try to avoid using AUFS (I would have dropped it, but MagOS wants it very much) - pulled updates of AltHa from http://git.altlinux.org/gears/k/kernel-image-un-def.git?p=kernel-image-un-def.git;a=history;f=security/altha;hb=HEAD - dropped patch adding sysctl to disable disk-based swap because it has not found any usage - bpf is now in the list of LSM modules (ability to write LSM modules as BPF programs), enable it, it is potentially useful and does not seem to be harmful - keeping kernel libc headers in older kernels for now - dropped building external virtualbox guest modules because they are now included into the mainline kernel - offed building VirtualBox host modules, I do not know how to keep these binary modules in sync with userspace part of VirtualBox, users can continue using dkms - offed building kernel-shredder because it is not buildable on kernel 5.10 - updated rtl8821ce and added a dependency from its "blacklist" subpackage here (see https://github.com/tomaspinho/rtl8821ce/commit/14b536f0) It is not clear if kernel 5.10 will receive an LTS support longer than 5.4 or not. Support until Dec, 2022 is declared right now at https://www.kernel.org/category/releases.html for 5.10 and until Dec, 2025 - for 5.4. TODO: update kernel configs TODO: solve problems with version of virtualbox host modules not matching version of the virtualbox package after virtualbox is updated but kernel is not rebuilt
2020-12-20 18:49:24 +03:00
%if %{with binary_virtualbox_host}
2020-11-26 21:09:27 +00:00
# build commands for virtualbox are based on the ones from the virtualbox package
2020-07-29 10:59:41 +03:00
cp -r "$(rpm -q --qf '/usr/src/virtualbox-%%{VERSION}-%%{RELEASE}' kernel-source-virtualbox)" kernel-source-virtualbox
mkdir -p %{temp_modules}/%{kver_full}/kernel/misc/
pushd kernel-source-virtualbox
make -C vboxdrv KERN_DIR=%{src_dir} KERN_VER=%{kver_full}
cp -fv vboxdrv/Module.symvers vboxnetflt
cp -fv vboxdrv/Module.symvers vboxnetadp
make -C vboxnetflt KERN_DIR=%{src_dir} KERN_VER=%{kver_full}
make -C vboxnetadp KERN_DIR=%{src_dir} KERN_VER=%{kver_full}
cp -fv vboxnetadp/Module.symvers vboxpci/
make -C vboxpci KERN_DIR=%{src_dir} KERN_VER=%{kver_full}
for i in vboxnetflt vboxnetadp vboxdrv vboxpci
do
cp -v "${i}/${i}.ko" %{temp_modules}/%{kver_full}/kernel/misc/
done
popd
2020-11-26 18:58:01 +00:00
%endif
2020-07-29 10:59:41 +03:00
%if %{with nickel}
# rosa-test-suite uses /sr/src/xxx-version, not /usr/src/xxx-version-release
cp -r "$(rpm -q --qf '/usr/src/rosa-test-suite-%%{VERSION}' kernel-source-rosa-test-suite)" kernel-source-rosa-test-suite
pushd kernel-source-rosa-test-suite
mkdir -p %{temp_modules}/%{kver_full}/kernel/misc/
for i in nlkm memfreetest pcietest
do
cat << EOF > Makefile
obj-m := ${i}.o
all:
make -C %{src_dir} M=\$(PWD) modules
EOF
%kmake
cp -fv ${i}.ko %{temp_modules}/%{kver_full}/kernel/misc/
done
popd
%endif #with nickel <- with binary_extra_modules
%endif #with binary_extra_modules
2020-07-29 10:59:41 +03:00
2020-03-13 20:35:12 +03:00
%if %{with uml}
cp -rv %{certs_dir_rnd} %{src_dir}.uml/
pushd %{src_dir}.uml
%kmake ARCH=um defconfig
2020-03-13 20:35:12 +03:00
%kmake ARCH=um linux
install -Dm0755 linux %{temp_root}%{_bindir}/linux-uml-%{kver_full}
#rm -fv linux
%kmake V=1 ARCH=um modules
mkdir -p %{temp_root}/lib/modules-uml/%{kver_full}/
%kmake ARCH=um INSTALL_MOD_PATH=%{temp_root}/lib/modules-uml/%{kver_full}/ modules_install
popd
%endif
install -d %{temp_boot}
install -m 644 System.map %{temp_boot}/System.map-%{kver_full}
install -m 644 .config %{temp_boot}/config-%{kver_full}
%{zstd_cmd} Module.symvers
install -m 644 Module.symvers.zst %{temp_boot}/symvers-%{kver_full}.zst
2013-11-16 00:27:01 +04:00
2021-04-06 19:36:12 +00:00
%ifarch %{armx}
%make_build ARCH=%{arch_type} V=1 INSTALL_DTBS_PATH=%{temp_boot}/dtb-%{kver_full} dtbs_install
2021-04-06 19:36:12 +00:00
%endif
2020-11-26 21:09:27 +00:00
%ifarch aarch64
cp -f arch/arm64/boot/Image.gz %{temp_boot}/vmlinuz-%{kver_full}
%else
cp -f arch/%{arch_type}/boot/bzImage %{temp_boot}/vmlinuz-%{kver_full}
%endif
2013-11-16 00:27:01 +04:00
# headers
%if %{build_headers}
%make INSTALL_HDR_PATH=%{temp_root}%{_prefix} KERNELRELEASE=%{kver_full} headers_install
find %{temp_root}%{_prefix} -name .install -or -name ..install.cmd | %kxargs rm -f
2013-11-16 00:27:01 +04:00
%endif
# remove /lib/firmware, we use a separate linux-firmware package
rm -rf %{temp_root}/lib/firmware
# Prepare the files for kernel*-devel
%if %build_devel
mkdir -p %{temp_devel_root}
for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel_root}; done
for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*'); do cp -R --parents $i %{temp_devel_root}; done
2013-11-16 00:27:01 +04:00
cp -fR include %{temp_devel_root}
cp -fR scripts %{temp_devel_root}
cp -fR kernel/bounds.c %{temp_devel_root}/kernel
cp -fR kernel/time/timeconst.bc %{temp_devel_root}/kernel/time
cp -fR tools %{temp_devel_root}/
2020-11-26 18:48:55 +00:00
cp -fR arch/%{arch_type}/kernel/asm-offsets.{c,s} %{temp_devel_root}/arch/%{arch_type}/kernel/
2020-11-26 21:09:27 +00:00
%ifarch %{ix86} %{x86_64}
2020-11-26 18:48:55 +00:00
cp -fR arch/%{arch_type}/kernel/asm-offsets_{32,64}.c %{temp_devel_root}/arch/%{arch_type}/kernel/
cp -fR arch/%{arch_type}/purgatory/* %{temp_devel_root}/arch/%{arch_type}/purgatory/
2020-11-26 21:09:27 +00:00
# needed for arch/x86/purgatory
cp -fR lib/*.h lib/*.c %{temp_devel_root}/lib/
2020-11-26 18:48:55 +00:00
cp -fR arch/%{arch_type}/entry/syscalls/syscall* %{temp_devel_root}/arch/%{arch_type}/entry/syscalls/
cp -fR arch/%{arch_type}/tools %{temp_devel_root}/arch/%{arch_type}/
2020-11-26 21:09:27 +00:00
# needed for kexec
cp -fR arch/%{arch_type}/boot/*.h %{temp_devel_root}/arch/%{arch_type}/boot/
cp -fR arch/%{arch_type}/boot/*.c %{temp_devel_root}/arch/%{arch_type}/boot/
%endif
cp -fR arch/%{arch_type}/include %{temp_devel_root}/arch/%{arch_type}/
cp -fR .config Module.symvers %{temp_devel_root}
# Needed for truecrypt build (Danny)
cp -fR drivers/md/dm.h %{temp_devel_root}/drivers/md/
2013-11-16 00:27:01 +04:00
# Needed for lirc_gpio (#39004)
cp -fR drivers/media/pci/bt8xx/bttv{,p}.h %{temp_devel_root}/drivers/media/pci/bt8xx/
cp -fR drivers/media/pci/bt8xx/bt848.h %{temp_devel_root}/drivers/media/pci/bt8xx/
cp -fR drivers/media/common/btcx-risc.h %{temp_devel_root}/drivers/media/common/
# add acpica header files, needed for fglrx build
cp -fR drivers/acpi/acpica/*.h %{temp_devel_root}/drivers/acpi/acpica/
2013-11-16 00:27:01 +04:00
# aufs2 has a special file needed
cp -fR fs/aufs/magic.mk %{temp_devel_root}/fs/aufs
2013-11-16 00:27:01 +04:00
# SELinux needs security/selinux/include
cp -fR security/selinux/include %{temp_devel_root}/security/selinux
2013-11-16 00:27:01 +04:00
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 %{temp_devel_root}/arch/$i
done
2013-11-16 00:27:01 +04:00
# Clean the scripts tree, and make sure everything is ok (sanity check)
# running prepare+scripts (tree was already "prepared" in build)
2020-03-14 13:49:15 +03:00
pushd %{temp_devel_root}
2020-11-26 21:09:27 +00:00
%smake V=1 -s clean ARCH=%{arch_type}
2020-03-14 13:49:15 +03:00
popd
2020-11-26 21:09:27 +00:00
rm -f %{temp_devel_root}/.config.old
2013-11-16 00:27:01 +04:00
# fix permissions
chmod -R a+rX %{temp_devel_root}
2013-11-16 00:27:01 +04:00
# disable mrproper in -devel rpms
patch -p1 --fuzz=0 -d %{temp_devel_root} -i %{SOURCE2}
# endif build_devel
2013-11-16 00:27:01 +04:00
%endif
# TODO: maybe move to /usr/lib/debug?
%if %build_debug
find %{temp_modules}/%{kver_full}/kernel \
-name "*.ko" | \
%kxargs -I '{}' objcopy --only-keep-debug '{}' '{}'.debug
find %{temp_modules}/%{kver_full}/kernel \
-name "*.ko" | %kxargs -I '{}' \
sh -c 'cd `dirname {}`; \
objcopy --add-gnu-debuglink=`basename {}`.debug \
--strip-debug `basename {}`'
%endif # /build_debug
2020-07-29 10:59:41 +03:00
# https://patchwork.kernel.org/patch/11446123/
2019-12-07 21:57:55 +03:00
_libressl_sign(){
if [ ! -f "$1" ]; then
echo "No file $1"
return 0
fi
f="$1"
%if %{with gost_sign}
%{src_dir}/scripts/sign-file streebog512 \
"%{certs_signing_key_priv_rnd}.GOST" "%{certs_signing_key_priv_rnd}.GOST" "$f"
%else
%{src_dir}/scripts/sign-file sha512 \
2020-03-20 11:27:35 +03:00
"%{certs_signing_key_priv_rnd}.RSA" "%{certs_signing_key_priv_rnd}.RSA" "$f"
%endif
2019-12-07 21:57:55 +03:00
unset f
}
export -f _libressl_sign
2020-03-13 20:35:12 +03:00
find %{temp_modules}/%{kver_full}/kernel \
%if %{with uml}
%{temp_root}/lib/modules-uml/%{kver_full} \
%endif
-name '*.ko' -print0 | sort -u | \
2019-12-07 21:57:55 +03:00
xargs --null -P "$(nproc)" -I {} "$SHELL" -e -x -c 'if ! _libressl_sign "{}"; \
then echo Failed _libressl_sign on "{}" && exit 1; fi'
2019-11-13 17:35:59 +03:00
# set extraversion to match srpm to get nice version reported by the tools
LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{fullrpmrel}/" Makefile
2013-11-16 00:27:01 +04:00
%if %{build_perf}
%smake -C tools/perf -s PYTHON=%{__python3} HAVE_CPLUS_DEMANGLE=1 WERROR=0 prefix=%{_prefix} lib=%{_lib} NO_GTK2=1 all
2020-11-27 01:21:49 +03:00
%smake -C tools/perf -s prefix=%{_prefix} lib=%{_lib} NO_GTK2=1 man
2013-11-16 00:27:01 +04:00
%endif
%if %{build_cpupower}
# make sure version-gen.sh is executable.
chmod +x tools/power/cpupower/utils/version-gen.sh
%make -C tools/power/cpupower CPUFREQ_BENCH=false
2013-11-16 00:27:01 +04:00
%endif
2019-11-11 22:27:50 +03:00
_cleanup
############################################################################
2013-11-16 00:27:01 +04:00
%install
cd %src_dir
# We want to be able to test several times the install part
rm -rf %{buildroot}
cp -a %{temp_root} %{buildroot}
# Multithreaded verification that every kernel module
# has a signature attached to it
mkdir -p "%{certs_dir_rnd}"
touch %{certs_verify_tmp}
_verify_signature(){
if [ -z "$1" ] || [ ! -f "$1" ]; then return; fi
if hexdump -C "$1" | rev | cut -f 2 -d '|' | rev | tr -d '\n' | \
grep -q '~Module signature appended~'
then
if [ -f %{certs_verify_tmp} ]; then
rm -f %{certs_verify_tmp}
fi
else
echo "ERROR: Module $1 has no signature attached to it!"
exit 1
fi
}
export -f _verify_signature
2020-03-13 20:35:12 +03:00
find %{target_modules} \
%if %{with uml}
%{buildroot}/lib/modules-uml/%{kver_full} \
%endif
-name '*.ko' -print0 | sort -u | \
xargs --null -P "$(nproc)" -I {} "$SHELL" -c '_verify_signature "{}"'
if [ -f %{certs_verify_tmp} ]; then
echo "ERROR: seems that signatures of none modules were verified!"
exit 1
fi
rm -f %{certs_verify_tmp}
2013-11-16 00:27:01 +04:00
# compressing modules
%if %{with compress_modules}
# Tested on /lib/modules/5.10.34-generic-2rosa2019.1-x86_64, the results are the following:
# * decompressed: 266.3 MiB
# * xz -9 --extreme: 67.8 MiB
# * zstd --ultra -22 without training: 73.5 MiB
# * zstd -6 without training: 79.6 MiB
# * zstd --ultra -22 with training: 66.3 MiB (the winner!)
# Training takes only a few minutes, make it here in place with current zstd and kernel modules.
# But! Decompressing also requires a dictionary for zstd, that will be too complex, so not using training :(
# We already use zstd in dracut to compress initrds quickly and with good compression ration.
# Testing speed of loading modules:
# `time modinfo bcache.ko.xz` took 0,048s, `time modinfo bcache.ko.zstd` took 0,014s (for multiple times)
# find /lib/modules/5.10.34-generic-2rosa2019.1-x86_64 -type f -name '*.ko.zst' > /tmp/zst.list
# time { for i in `cat /tmp/zst.list`; do modinfo $i >/dev/null 2>&1; done ;}
# took ~31-40s, with disk cache (2+ runs) ~33s
# find /lib/modules/5.10.34-generic-1rosa2019.1-x86_64 -type f -name '*.ko.xz' > /tmp/xz.list
# time { for i in `cat /tmp/xz.list`; do modinfo $i >/dev/null 2>&1; done ;}
# took 43-47s, with disk cache (2+ runs) ~42s, +21%
# zstd-compressed initramfs image initrd-5.10.34-generic-1rosa2019.1-x86_64.img with *.ko.xz is 56,3 MiB
# zstd-compressed initramfs image initrd-5.10.34-generic-2rosa2019.1-x86_64.img with *.ko.zst is 58,4 MiB (+3.6%)
# /lib/modules/5.10.34-generic-1rosa2019.1-x86_64 (*.ko.xz) is 78,1 MiB
# /lib/modules/5.10.34-generic-2rosa2019.1-x86_64 (*.ko.zst) is 83,9 MiB (+7%)
# When zstd is compressing cpio (initrd image) with zstd-compressed kernel modules inside it, does it recompress data?
# It is not easy to make a choice between zstd and xz for kernel modules... Disk space (and so speed of installing
# RPM packages) is not much bigger, we do not try to support super low end devices, operation speed is a bit better.
# I have not seen measurable difference in startup time according to systemd-analyze.
# Note that decompression after zstd --ultra -22 will consume more memory than after zstd -6, see commit message in
# https://github.com/torvalds/linux/commit/73f3d1b48f5069d46b. I did not benchmark -6 vs -22 in runtime.
# Let's use zstd for now.
# zstd may also be used to compress linux-firmware to save a lot of space on disk,
# but upstream kernels still cannot decompress it.
#%%{zstd_cmd} -T0 --train $(find . -type f -name '*.ko')
#[ -f dictionary ]
# -T1 (one thread) because we run multiple zstd processes by xargs
find %{target_modules} -name "*.ko" | %kxargs %{zstd_cmd} --rm -T1 #-D dictionary
#rm -f dictionary
2013-11-16 00:27:01 +04:00
%endif
find %{buildroot}%{_modulesdir}/%{kver_full} -type f -name '*.ko%{kmod_suffix}' | sed -e 's,^%{buildroot},,' | sort -u >> %{kernel_files}
find %{buildroot}%{_modulesdir}/%{kver_full} -type d | sed -e 's,^%{buildroot},%dir ,' | sort -u >> %{kernel_files}
# We estimate the size of the initramfs because rpm needs to take this size
# into consideration when performing disk space calculations (See rhbz#530778)
# 65 MiB is a bit more than needed, but let's be more sure that there is enought space.
# On my PC, zstd-compressed initrds take 58,5 MiB.
# Real size of the RPM package should not increase because RPM compresses the payload.
# This file is %%ghost, so the real initrd will be deleted when uninstalling this package.
dd if=/dev/zero of=%{buildroot}%{initrd_path} bs=1M count=65
%if %build_debug
install -m 644 vmlinux %{buildroot}%{_bootdir}/vmlinux-%{kver_full}
find %{buildroot}%{_modulesdir} -type f -name '*.debug' | sed -e 's,^%{buildroot},,' | sort -u >> %{debuginfo_files}
%endif # /build_debug
pushd %{target_modules}
for i in *; do
rm -f $i/build $i/source
ln -sf /usr/src/linux-$i $i/build
ln -sf /usr/src/linux-$i $i/source
done
2013-11-16 00:27:01 +04:00
# sniff, if we compressed all the modules, we change the stamp :(
# we really need the depmod -ae here
for i in *; do
/sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i
echo $?
done
# We used to create modules.description files which contained the
# description strings for the modules as shown by modinfo. These files
# are unlikely to be used right now, so create them (in case some old tool
# checks for their existence) but keep them empty.
2013-11-16 00:27:01 +04:00
for i in *; do
touch $i/modules.description
2013-11-16 00:27:01 +04:00
done
popd
# need to set extraversion to match srpm again to avoid rebuild
LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{fullrpmrel}/" Makefile
2013-11-16 00:27:01 +04:00
%if %{build_perf}
# perf tool binary and supporting scripts/binaries
2020-12-11 19:39:08 +00:00
make -C tools/perf -s V=1 DESTDIR=%{buildroot} WERROR=0 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} lib=%{_lib} install
2013-11-16 00:27:01 +04:00
2020-05-11 09:33:18 +03:00
# Versionize shebang (#!/usr/bin/env python -> #!/usr/bin/python3)
sed -i -e '1 s,^.*$,#!%{__python3},' %{buildroot}%{_prefix}/libexec/perf-core/scripts/python/exported-sql-viewer.py
2013-11-16 00:27:01 +04:00
# perf man pages (note: implicit rpm magic compresses them later)
2020-12-11 19:39:08 +00:00
make -C tools/perf -s V=1 DESTDIR=%{buildroot} WERROR=0 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install-man
2013-11-16 00:27:01 +04:00
%endif
%if %{build_cpupower}
make -C tools/power/cpupower DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
2013-11-16 00:27:01 +04:00
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 %{SOURCE53} %{buildroot}%{_unitdir}/cpupower.path
2013-11-16 00:27:01 +04:00
install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
install -m755 %{SOURCE52} %{buildroot}%{_bindir}/cpupower-start.sh
2013-11-16 00:27:01 +04:00
%endif
2020-07-29 10:59:41 +03:00
# delete junk
rm -fr %{buildroot}%{_usr}/src/*/kernel-source-*
%if %{with flow_abi}
# Prefix with "zzz" to put this directory into the end of search list
# and avoid tricks with depmod configs
mkdir -p %{buildroot}/lib/modules/%{kernelversion}.%{patchlevel}-rosa-flow-abi
ln -s /lib/modules/%{kernelversion}.%{patchlevel}-rosa-flow-abi %{buildroot}%{_modulesdir}/%{kver_full}/kernel/zzz-%{kernelversion}.%{patchlevel}-rosa-flow-abi
%endif