kernel-5.15/kernel.spec
Mikhail Novosyolov 619bddc5ef [bot] upd: 5.10.48 -> 5.10.50
Changelog:

ACPI: APEI: fix synchronous external aborts in user-mode
ACPI: bgrt: Fix CFI violation
ACPI: bus: Call kobject_put() in acpi_init() error path
ACPICA: Fix memory leak caused by _CID repair function
ACPI: EC: Make more Asus laptops use ECDT _GPE
ACPI: EC: trust DSDT GPE for certain HP laptop
ACPI: PM / fan: Put fan device IDs into separate header file
ACPI: processor idle: Fix up C-state latency if not ordered
ACPI: resources: Add checks for ACPI IRQ override
ACPI: sysfs: Fix a buffer overrun problem with description_show()
ACPI: tables: Add custom DSDT file as makefile prerequisite
ACPI: Use DEVICE_ATTR_<RW|RO|WO> macros
ACPI: video: use native backlight for GA401/GA502/GA503
Add a reference to ucounts for each cred
ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found
ALSA: firewire-motu: fix stream format for MOTU 8pre FireWire
ALSA: hda/realtek: Add another ALC236 variant support
ALSA: hda/realtek: Apply LED fixup for HP Dragonfly G1, too
ALSA: hda/realtek: Fix bass speaker DAC mapping for Asus UM431D
ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook 830 G8 Notebook PC
ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook x360 830 G8
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 445 G8
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 450 G8
ALSA: hda/realtek: fix mute/micmute LEDs for HP ProBook 630 G8
ALSA: hda/realtek: Improve fixup for HP Spectre x360 15-df0xxx
ALSA: intel8x0: Fix breakage at ac97 clock measurement
ALSA: usb-audio: Fix OOB access at proc output
ALSA: usb-audio: fix rate on Ozone Z90 USB headset
ALSA: usb-audio: scarlett2: Fix wrong resume call
arm64: consistently use reserved_pg_dir
arm64: dts: marvell: armada-37xx: Fix reg for standard variant of UART
arm64/mm: Fix ttbr0 values stored in struct thread_info for software-pan
arm64: perf: Convert snprintf to sysfs_emit
ARM: dts: at91: sama5d4: fix pinctrl muxing
ARM: dts: ux500: Fix LED probing
arm_pmu: Fix write counter incorrect in ARMv7 big-endian mode
ASoC: atmel-i2s: Fix usage of capture and playback at the same time
ASoC: cs42l42: Correct definition of CS42L42_ADC_PDN_MASK
ASoC: fsl_spdif: Fix error handler with pm_runtime_enable
ASoC: fsl_spdif: Fix unexpected interrupt after suspend
ASoC: hisilicon: fix missing clk_disable_unprepare() on error in hi6210_i2s_startup()
ASoC: Intel: sof_sdw: add SOF_RT715_DAI_ID_FIX for AlderLake
ASoC: max98373-sdw: use first_hw_init flag on resume
ASoC: mediatek: mtk-btcvsd: Fix an error handling path in 'mtk_btcvsd_snd_probe()'
ASoC: rk3328: fix missing clk_disable_unprepare() on error in rk3328_platform_probe()
ASoC: rsnd: tidyup loop on rsnd_adg_clk_query()
ASoC: rt1308-sdw: use first_hw_init flag on resume
ASoC: rt5682: Disable irq on shutdown
ASoC: rt5682: fix getting the wrong device id when the suspend_stress_test
ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID
ASoC: rt5682-sdw: use first_hw_init flag on resume
ASoC: rt700-sdw: use first_hw_init flag on resume
ASoC: rt711-sdw: use first_hw_init flag on resume
ASoC: rt715-sdw: use first_hw_init flag on resume
ath10k: add missing error return code in ath10k_pci_probe()
ath10k: Fix an error code in ath10k_add_interface()
ath10k: go to path err_unsupported when chip id is not supported
ath11k: Fix an error handling path in ath11k_core_fetch_board_data_api_n()
ath11k: send beacon template after vdev_start/restart during csa
ath9k: Fix kernel NULL pointer dereference during ath_reset_internal()
backlight: lm3630a_bl: Put fwnode in error case during ->probe()
blk-mq: clear stale request in tags->rq[] before freeing one request pool
blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter
blk-mq: update hctx->dispatch_busy in case of real scheduler
blk-wbt: introduce a new disable state to prevent false positive by rwb_enabled()
blk-wbt: make sure throttle is enabled properly
block: avoid double io accounting for flush request
block_dump: remove block_dump feature in mark_inode_dirty()
block: fix discard request merge
block: fix race between adding/removing rq qos and normal IO
block: return the correct bvec when checking for gaps
Bluetooth: btqca: Don't modify firmware contents in-place
Bluetooth: Fix handling of HCI_LE_Advertising_Set_Terminated event
Bluetooth: Fix not sending Set Extended Scan Response
Bluetooth: Fix Set Extended (Scan Response) Data
Bluetooth: hci_qca: fix potential GPF
Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
Bluetooth: Remove spurious error message
bpf: Do not change gso_size during bpf_skb_change_proto()
bpf: Fix libelf endian handling in resolv_btfids
bpf: Fix null ptr deref with mixed tail calls and subprogs
bpfilter: Specify the log level for the kmsg message
brcmfmac: correctly report average RSSI in station info
brcmfmac: Fix a double-free in brcmf_sdio_bus_reset
brcmfmac: fix setting of station info chains bitmask
brcmsmac: mac80211_if: Fix a resource leak in an error handling path
btrfs: abort transaction if we fail to update the delayed inode
btrfs: clear defrag status of a root if starting transaction fails
btrfs: clear log tree recovering status if starting transaction fails
btrfs: compression: don't try to compress if we don't have enough pages
btrfs: disable build on platforms having page size 256K
btrfs: don't clear page extent mapped if we're not invalidating the full page
btrfs: fix error handling in __btrfs_update_delayed_inode
btrfs: send: fix invalid path for unlink operations after parent orphanization
btrfs: sysfs: fix format string for some discard stats
bus: mhi: Wait for M2 state during system resume
can: bcm: delay release of struct bcm_op after synchronize_rcu()
can: gw: synchronize rcu operations before removing gw job entry
can: isotp: isotp_release(): omit unintended hrtimer restart on socket release
can: j1939: j1939_sk_init(): set SOCK_RCU_FREE to call sk_destruct() after RCU is done
can: j1939: j1939_sk_setsockopt(): prevent allocation of j1939 filter for optlen == 0
can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path
char: pcmcia: error out if 'num_bytes_read' is greater than 4 in set_protocol()
cifs: fix missing spinlock around update to ses->status
cifs: improve fallocate emulation
clk: actions: Fix AHPPREDIV-H-AHB clock chain on Owl S500 SoC
clk: actions: Fix bisp_factor_table based clocks on Owl S500 SoC
clk: actions: Fix SD clocks factor table on Owl S500 SoC
clk: actions: Fix UART clock dividers on Owl S500 SoC
clk: agilex/stratix10: fix bypass representation
clk: agilex/stratix10/n5x: fix how the bypass_reg is handled
clk: agilex/stratix10: remove noc_clk
clk: imx8mq: remove SYS PLL 1/2 clock gates
clk: meson: g12a: fix gp0 and hifi ranges
clk: qcom: clk-alpha-pll: fix CAL_L write in alpha_pll_fabia_prepare
clk: si5341: Avoid divide errors due to bogus register contents
clk: si5341: Check for input clock presence and PLL lock on startup
clk: si5341: Update initialization magic
clk: si5341: Wait for DEVICE_READY on startup
clk: tegra30: Use 300MHz for video decoder by default
clk: vc5: fix output disabling when enabling a FOD
clocksource: Check per-CPU clock synchronization when marked unstable
clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG
clocksource: Retry clock read if long delays detected
configfs: fix memleak in configfs_release_bin_file
copy_page_to_iter(): fix ITER_DISCARD case
coresight: core: Fix use of uninitialized pointer
cpufreq: Make cpufreq_online() call driver->offline() on errors
cred: add missing return error code when set_cred_ucounts() failed
crypto: ccp - Annotate SEV Firmware file names
crypto: ccp - Fix a resource leak in an error handling path
crypto: hisilicon/sec - fixup 3des minimum key size declaration
crypto: ixp4xx - dma_unmap the correct address
crypto: ixp4xx - update IV after requests
crypto: nitrox - fix unchecked variable in nitrox_register_interrupts
crypto: nx - add missing MODULE_DEVICE_TABLE
crypto: nx - Fix memcpy() over-reading in nonce
crypto: nx - Fix RCU warning in nx842_OF_upd_status
crypto: omap-sham - Fix PM reference leak in omap sham ops
crypto: qat - check return code of qat_hal_rd_rel_reg()
crypto: qat - remove unused macro in FW loader
crypto: qce - fix error return code in qce_skcipher_async_req_handle()
crypto: qce: skcipher: Fix incorrect sg count for dma transfers
crypto: sa2ul - Fix leaks on failure paths with sa_dma_init()
crypto: sa2ul - Fix pm_runtime enable in sa_ul_probe()
crypto: shash - avoid comparing pointers to exported functions under CFI
crypto: sm2 - fix a memory leak in sm2
crypto: sm2 - remove unnecessary reset operations
crypto: ux500 - Fix error return code in hash_hw_final()
crypto: x86/curve25519 - fix cpu feature checking logic in mod_exit
csky: fix syscache.c fallthrough warning
csky: syscache: Fixup duplicate cache flush
cw1200: Revert unnecessary patches that fix unreal use-after-free bugs
dax: fix ENOMEM handling in grab_mapping_entry()
drivers: hv: Fix missing error code in vmbus_connect()
drivers/perf: fix the missed ida_simple_remove() in ddr_perf_probe()
drm/amd/dc: Fix a missing check bug in dm_dp_mst_detect()
drm/ast: Fix missing conversions to managed API
drm/bridge: Fix the stop condition of drm_bridge_chain_pre_enable()
drm/bridge/sii8620: fix dependency on extcon
drm/msm/dpu: Fix error return code in dpu_mdss_init()
drm/msm: Fix error return code in msm_drm_init()
drm/pl111: Actually fix CONFIG_VEXPRESS_CONFIG depends
drm/pl111: depend on CONFIG_VEXPRESS_CONFIG
drm: qxl: ensure surf.data is ininitialized
drm/rockchip: cdn-dp-core: add missing clk_disable_unprepare() on error in cdn_dp_grf_write()
drm/rockchip: cdn-dp: fix sign extension on an int multiply for a u64 result
drm/rockchip: dsi: move all lane config except LCDC mux to bind()
drm/rockchip: lvds: Fix an error handling path
drm: rockchip: set alpha_en to 0 if it is not used
drm/vc4: hdmi: Fix error path of hpd-gpios
drm/vmwgfx: Fix cpu updates of coherent multisample surfaces
drm/vmwgfx: Mark a surface gpu-dirty after the SVGA3dCmdDXGenMips command
e1000e: Check the PCIm state
EDAC/Intel: Do not load EDAC driver when running as a guest
EDAC/ti: Add missing MODULE_DEVICE_TABLE
eeprom: idt_89hpesx: Put fwnode in matching case during ->probe()
eeprom: idt_89hpesx: Restore printing the unsupported fwnode name
ehea: fix error return code in ehea_restart_qps()
erofs: fix error return code in erofs_read_superblock()
evm: Execute evm_inode_init_security() only when an HMAC key is loaded
evm: fix writing <securityfs>/evm overflow
evm: Refuse EVM_ALLOW_METADATA_WRITES only if an HMAC key is loaded
exfat: handle wrong stream entry size in exfat_readdir()
ext4: cleanup in-core orphan list if ext4_truncate() failed to get a transaction handle
ext4: correct the cache_nr in tracepoint ext4_es_shrink_exit
ext4: fix avefreec in find_group_orlov
ext4: fix kernel infoleak via ext4_extent_header
ext4: fix overflow in ext4_iomap_alloc()
ext4: remove check for zero nr_to_scan in ext4_es_scan()
ext4: return error code when ext4_fill_flex_info() fails
ext4: use ext4_grp_locked_error in mb_find_extent
extcon: extcon-max8997: Fix IRQ freeing at error path
extcon: max8997: Add missing modalias string
extcon: sm5502: Drop invalid register write in sm5502_reg_data
f2fs: Prevent swap file in LFS mode
firmware: stratix10-svc: Fix a resource leak in an error handling path
fscrypt: don't ignore minor_hash when hash is 0
fscrypt: fix derivation of SipHash keys on big endian CPUs
fs: dlm: cancel work sync othercon
fs: dlm: fix memory leak when fenced
fsi: core: Fix return of error values on failures
fsi: occ: Don't accept response from un-initialized OCC
fsi/sbefifo: Clean up correct FIFO when receiving reset request from SBE
fsi/sbefifo: Fix reset timeout
fsi: scom: Reset the FSI2PIB engine for any error
fuse: check connected before queueing on fpq->io
fuse: Fix crash if superblock of submount gets killed early
fuse: Fix crash in fuse_dentry_automount() error path
fuse: Fix infinite loop in sget_fc()
fuse: ignore PG_workingset after stealing
fuse: reject internal errno
gfs2: Fix error handling in init_statfs
gfs2: Fix underflow in gfs2_page_mkwrite
gve: Fix swapped vars when fetching max queues
habanalabs: Fix an error handling path in 'hl_pci_probe()'
Hexagon: add target builtins to kernel
Hexagon: change jumps to must-extend in futex_atomic_*
Hexagon: fix build errors
HID: do not use down_interruptible() when unbinding devices
HID: wacom: Correct base usage for capacitive ExpressKey status bits
hugetlb: remove prep_compound_huge_page cleanup
hv_utils: Fix passing zero to 'PTR_ERR' warning
hwmon: (lm70) Revert "hwmon: (lm70) Add support for ACPI"
hwmon: (lm70) Use device_get_match_data()
hwmon: (max31722) Remove non-standard ACPI device IDs
hwmon: (max31790) Fix fan speed reporting for fan7..12
hwmon: (max31790) Fix pwmX_enable attributes
hwmon: (max31790) Report correct current pwm duty cycles
hwrng: exynos - Fix runtime PM imbalance on error
i40e: Fix autoneg disabling for non-10GBaseT links
i40e: Fix error handling in i40e_vsi_open
i40e: Fix missing rtnl locking when setting up pf switch
ia64: mca_drv: fix incorrect array size calculation
ibmvnic: free tx_pool if tso_pool alloc fails
ibmvnic: set ltb->buff to NULL after freeing
ieee802154: hwsim: avoid possible crash in hwsim_del_edge_nl()
ieee802154: hwsim: Fix memory leak in hwsim_add_one
ieee802154: hwsim: Fix possible memory leak in hwsim_subscribe_all_others
iio: accel: bma180: Fix BMA25x bandwidth register values
iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: hid: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: mxc4005: Fix overread of data and alignment issue.
iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: adis16400: do not return ints in irq handlers
iio: adis16475: do not return ints in irq handlers
iio: adis_buffer: do not return ints in irq handlers
iio: chemical: atlas: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: cros_ec_sensors: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
iio: frequency: adf4350: disable reg and clk on error in adf4350_probe()
iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: light: tcs3472: do not free unallocated IRQ
iio: light: tcs3472: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: light: vcnl4000: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: ltr501: ltr501_read_ps(): add missing endianness conversion
iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR
iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too
iio: magn: bmc150: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: magn: hmc5843: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
include/linux/huge_mm.h: remove extern keyword
Input: goodix - platform/x86: touchscreen_dmi - Move upside down quirks to touchscreen_dmi.c
Input: hil_kbd - fix error return code in hil_dev_connect()
Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl
Input: usbtouchscreen - fix control-request directions
iommu/amd: Fix extended features logging
iommu/dma: Fix compile warning in 32-bit builds
iommu/dma: Fix IOVA reserve dma ranges
io_uring: fix blocking inline submission
iov_iter_fault_in_readable() should do nothing in xarray case
ip6_tunnel: fix GRE6 segmentation
ipv6: exthdrs: do not blindly use init_net
ipv6: fix out-of-bound access in ip6_parse_tlv()
iwlwifi: increase PNVM load timeout
kbuild: Fix objtool dependency for 'OBJECT_FILES_NON_STANDARD_<obj> := n'
kthread_worker: fix return value when kthread_mod_delayed_work() races with kthread_cancel_delayed_work_sync()
KVM: arm64: Don't zero the cycle count register when PMCR_EL0.P is set
KVM: nVMX: Don't clobber nested MMU's A/D status on EPTP switch
KVM: nVMX: Ensure 64-bit shift when checking VMFUNC bitmap
KVM: nVMX: Handle split-lock #AC exceptions that happen in L2
KVM: nVMX: Sync all PGDs on nested transition with shadow paging
KVM: PPC: Book3S HV: Fix TLB management on SMT8 POWER9 and POWER10 processors
KVM: PPC: Book3S HV: Save and restore FSCR in the P9 path
KVM: PPC: Book3S HV: Workaround high stack usage with clang
KVM: s390: get rid of register asm usage
KVM: x86/mmu: Fix return value in tdp_mmu_map_handle_target_level()
KVM: x86/mmu: Treat NX as used (not reserved) for all !TDP shadow MMUs
KVM: x86/mmu: Use MMU's role to detect CR4.SMEP value in nested NPT walk
leds: as3645a: Fix error return code in as3645a_parse_node()
leds: class: The -ENOTSUPP should never be seen by user space
leds: ktd2692: Fix an error handling path
leds: lm3532: select regmap I2C API
leds: lm36274: Put fwnode in error case during ->probe()
leds: lm3692x: Put fwnode in any case during ->probe()
leds: lm3697: Don't spam logs when probe is deferred
leds: lp50xx: Put fwnode in error case during ->probe()
lib/math/rational.c: fix divide by zero
lib: vsprintf: Fix handling of number field widths in vsscanf
lockdep: Fix wait-type for empty stack
lockdep/selftests: Fix selftests vs PROVE_RAW_LOCK_NESTING
lockding/lockdep: Avoid to find wrong lock dep path in check_irq_usage()
locking/lockdep: Fix the dep path printing for backwards BFS
locking/lockdep: Reduce LOCKDEP dependency list
loop: Fix missing discard support when using LOOP_CONFIGURE
m68k: atari: Fix ATARI_KBD_CORE kconfig unmet dependency warning
mac80211: remove iwlwifi specific workaround NDPs of null_response
mac80211: remove iwlwifi specific workaround that broke sta NDP tx
mailbox: qcom-ipcc: Fix IPCC mbox channel exhaustion
mailbox: qcom: Use PLATFORM_DEVID_AUTO to register platform device
Makefile: fix GDB warning with CONFIG_RELR
mark pstore-blk as broken
media: am437x: fix pm_runtime_get_sync() usage count
media: au0828: fix a NULL vs IS_ERR() check
media: bt878: do not schedule tasklet when it is not setup
media: bt8xx: Fix a missing check bug in bt878_probe
media: cedrus: Fix .buf_prepare
media: cobalt: fix race condition in setting HPD
media: cpia2: fix memory leak in cpia2_usb_probe
media: dvb_net: avoid speculation from net slot
media: dvb-usb: fix wrong definition
media: dvd_usb: memory leak in cinergyt2_fe_attach
media: em28xx: Fix possible memory leak of em28xx struct
media: exynos4-is: Fix a use after free in isp_video_release
media: exynos4-is: fix pm_runtime_get_sync() usage count
media: exynos4-is: remove a now unused integer
media: exynos-gsc: fix pm_runtime_get_sync() usage count
media: Fix Media Controller API config checks
media: gspca/gl860: fix zero-length control requests
media: hantro: do a PM resume earlier
media: hantro: Fix .buf_prepare
media: hevc: Fix dependent slice segment flags
media: I2C: change 'RST' to "RSET" to fix multiple build errors
media: i2c: ov2659: Use clk_{prepare_enable,disable_unprepare}() to set xvclk on/off
media: imx-csi: Skip first few frames from a BT.656 source
media: imx: imx7_mipi_csis: Fix logging of only error event counters
media: marvel-ccic: fix some issues when getting pm_runtime
media: mdk-mdp: fix pm_runtime_get_sync() usage count
media: mtk-vcodec: fix PM runtime get logic
media: pvrusb2: fix warning in pvr2_i2c_core_done
media: rc: i2c: Fix an error message
media: rkvdec: Fix .buf_prepare
media: s5p_cec: decrement usage count if disabled
media: s5p: fix pm_runtime_get_sync() usage count
media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx
media: s5p-jpeg: fix pm_runtime_get_sync() usage count
media: sh_vou: fix pm_runtime_get_sync() usage count
media: siano: fix device register error path
media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()
media: st-hva: Fix potential NULL pointer dereferences
media: sti/bdisp: fix pm_runtime_get_sync() usage count
media: sti: fix obj-$(config) targets
media: subdev: remove VIDIOC_DQEVENT_TIME32 handling
media: sunxi: fix pm_runtime_get_sync() usage count
media: tc358743: Fix error return code in tc358743_probe_of()
media: uvcvideo: Support devices that report an OT as an entity source
media: v4l2-async: Clean v4l2_async_notifier_add_fwnode_remote_subdev
media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
media: venus: Rework error fail recover logic
media: video-mux: Skip dangling endpoints
memstick: rtsx_usb_ms: fix UAF
mfd: mp2629: Select MFD_CORE to fix build error
mfd: rn5t618: Fix IRQ trigger by changing it to level mode
MIPS: Fix PKMAP with 32-bit MIPS huge page support
mmc: block: Disable CMDQ on the ioctl path
mmc: sdhci-sprd: use sdhci_sprd_writew
mmc: usdhi6rol0: fix error return code in usdhi6_probe()
mmc: via-sdmmc: add a check against NULL pointer dereference
mmc: vub3000: fix control-request direction
mm/debug_vm_pgtable/basic: add validation for dirtiness after write protect
mm/debug_vm_pgtable/basic: iterate over entire protection_map[]
mm/debug_vm_pgtable: ensure THP availability via has_transparent_hugepage()
mm/gup: fix try_grab_compound_head() race with split_huge_page()
mm/huge_memory.c: add missing read-only THP checking in transparent_hugepage_enabled()
mm/huge_memory.c: don't discard hugepage if other processes are mapping it
mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK
mm/hugetlb: remove redundant check in preparing and destroying gigantic page
mm/hugetlb: use helper huge_page_order and pages_per_huge_page
mm: memcg/slab: properly set up gfp flags for objcg pointer array
mm/page_alloc: fix counting of managed_pages
mm: page_alloc: refactor setup_per_zone_lowmem_reserve()
mm/pmem: avoid inserting hugepage PTE entry with fsdax if hugepage support is disabled
mm/shmem: fix shmem_swapin() race with swapoff
mm/z3fold: fix potential memory leak in z3fold_destroy_pool()
mm/z3fold: use release_z3fold_page_locked() to release locked z3fold page
mptcp: fix pr_debug in mptcp_token_new_connect
mptcp: generate subflow hmac after mptcp_finish_join()
mt76: fix possible NULL pointer dereference in mt76_tx
mt76: mt7615: fix NULL pointer dereference in tx_prepare_skb()
mtd: partitions: redboot: seek fis-index-block in the right node
mtd: rawnand: arasan: Ensure proper configuration for the asserted target
mtd: rawnand: marvell: add missing clk_disable_unprepare() on error in marvell_nfc_resume()
mwifiex: re-fix for unaligned accesses
net: atlantic: fix the macsec key length
net: bcmgenet: Fix attaching to PYH failed on RPi 4B
net: can: ems_usb: fix use-after-free in ems_usb_disconnect()
net: dsa: sja1105: fix NULL pointer dereference in sja1105_reload_cbs()
net: ethernet: aeroflex: fix UAF in greth_of_remove
net: ethernet: ezchip: fix error handling
net: ethernet: ezchip: fix UAF in nps_enet_remove
netfilter: nf_tables_offload: check FLOW_DISSECTOR_KEY_BASIC in VLAN transfer logic
netfilter: nft_exthdr: check for IPv6 packet before further processing
netfilter: nft_osf: check for TCP packet before further processing
netfilter: nft_tproxy: restrict support to TCP and UDP transport protocols
net: ftgmac100: add missing error return code in ftgmac100_probe()
net/ipv4: swap flow ports when validating source
netlabel: Fix memory leak in netlbl_mgmt_add_common
net: lwtunnel: handle MTU calculation in forwading
net: macsec: fix the length used to copy the key for offloading
net: mvpp2: Put fwnode in error case during ->probe()
net: pch_gbe: Propagate error from devm_gpio_request_one()
net: phy: mscc: fix macsec key length
net: qrtr: ns: Fix error return code in qrtr_ns_init()
net/sched: act_vlan: Fix modify to allow 0
net: sched: add barrier to ensure correct ordering for lockless qdisc
net: sched: fix warning in tcindex_alloc_perfect_hash
net: ti: am65-cpsw-nuss: Fix crash when changing number of TX queues
net: tipc: fix FB_MTU eat two pages
ntfs: fix validity check for file name attribute
nvme-pci: fix var. type for increasing cq_head
nvme-pci: look for StorageD3Enable on companion ACPI device instead
nvmet-fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst()
ocfs2: fix snprintf() checking
of: Fix truncation of memory sizes on 32-bit platforms
open: don't silently ignore unknown O-flags in openat2()
pata_ep93xx: fix deferred probing
pata_octeon_cf: avoid WARN_ON() in ata_host_activate()
pata_rb532_cf: fix deferred probing
PCI: hv: Add check for hyperv_initialized in init_hv_pci_drv()
perf/arm-cmn: Fix invalid pointer when access dtc object sharing the same IRQ number
perf llvm: Return -ENOMEM when asprintf() fails
perf scripting python: Fix tuple_set_u64()
perf/smmuv3: Don't trample existing events with global filter
phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
phy: uniphier-pcie: Fix updating phy parameters
pinctrl: renesas: r8a7796: Add missing bias for PRESET# pin
pinctrl: renesas: r8a77990: JTAG pins do not have pull-down capabilities
pkt_sched: sch_qfq: fix qfq_change_class() error path
platform/x86: asus-nb-wmi: Revert "add support for ASUS ROG Zephyrus G14 and G15"
platform/x86: asus-nb-wmi: Revert "Drop duplicate DMI quirk structures"
platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard()
platform/x86: touchscreen_dmi: Add an extra entry for the upside down Goodix touchscreen on Teclast X89 tablets
platform/x86: touchscreen_dmi: Add info for the Goodix GT912 panel of TM800A550L tablets
PM / devfreq: Add missing error code in devfreq_add_device()
powerpc/64s: Fix copy-paste data exposure into newly created tasks
powerpc: Offline CPU in stop_this_cpu()
powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable
powerpc/papr_scm: Properly handle UUID types and API
powerpc/powernv: Fix machine check reporting of async store errors
powerpc/preempt: Don't touch the idle task's preempt_count during hotplug
powerpc/stacktrace: Fix spurious "stale" traces in raise_backtrace_ipi()
psi: Fix race between psi_trigger_create/destroy
random32: Fix implicit truncation warning in prandom_seed_state()
rcu: Invoke rcu_spawn_core_kthreads() from rcu_spawn_gp_kthread()
RDMA/cma: Fix incorrect Packet Lifetime calculation
RDMA/cma: Protect RMW with qp_mutex
RDMA/core: Always release restrack object
RDMA/core: Sanitize WQ state received from the userspace
RDMA/mlx5: Don't access NULL-cleared mpi pointer
RDMA/mlx5: Don't add slave port to unaffiliated list
RDMA/rtrs-clt: Check if the queue_depth has changed during a reconnection
RDMA/rtrs-clt: Check state of the rtrs_clt_sess before reading its stats
RDMA/rtrs-clt: Fix memory leak of not-freed sess->stats and stats->pcpu_stats
RDMA/rtrs: Do not reset hb_missed_max after re-connection
RDMA/rtrs-srv: Fix memory leak of unfreed rtrs_srv_stats object
RDMA/rtrs-srv: Fix memory leak when having multiple sessions
RDMA/rtrs-srv: Set minimal max_send_wr and max_recv_wr
RDMA/rxe: Fix failure during driver load
RDMA/rxe: Fix qp reference counting for atomic ops
RDMA/srp: Fix a recently introduced memory leak
regulator: da9052: Ensure enough delay time for .set_voltage_time_sel
regulator: fan53880: Fix vsel_mask setting for FAN53880_BUCK
regulator: hi655x: Fix pass wrong pointer to config.driver_data
regulator: mt6358: Fix vdram2 .vsel_mask
regulator: uniphier: Add missing MODULE_DEVICE_TABLE
Revert "be2net: disable bh with spin_lock in be_process_mcc"
Revert "ibmvnic: remove duplicate napi_schedule call in open function"
rsi: Assign beacon rate settings to the correct rate_info descriptor field
rsi: fix AP mode with WPA failure due to encrypted EAPOL
rtc: stm32: Fix unbalanced clk_disable_unprepare() on probe error path
rtw88: 8822c: fix lc calibration timing
s390: appldata depends on PROC_SYSCTL
s390/cio: dont call css_wait_for_slow_path() inside a lock
s390: enable HAVE_IOREMAP_PROT
s390/irq: select HAVE_IRQ_EXIT_ON_IRQ_STACK
s390: mm: Fix secure storage access exception handling
s390: preempt: Fix preempt_count initialization
samples/bpf: Fix Segmentation fault for xdp_redirect command
samples/bpf: Fix the error return code of xdp_redirect's main()
sata_highbank: fix deferred probing
sched/core: Initialize the idle task with preemption disabled
sched/fair: Fix ascii art by relpacing tabs
sched/rt: Fix Deadline utilization tracking during policy change
sched/rt: Fix RT utilization tracking during policy change
sched/uclamp: Fix locking around cpu_util_update_eff()
sched/uclamp: Fix uclamp_tg_restrict()
sched/uclamp: Fix wrong implementation of cpu.uclamp.min
scsi: core: Retry I/O for Notify (Enable Spinup) Required error
scsi: fc: Correct RHBA attributes length
scsi: FlashPoint: Rename si_flags field
scsi: iscsi: Flush block work before unblock
scsi: mpt3sas: Fix error return value in _scsih_expander_add()
scsi: target: cxgbit: Unmap DMA buffer before calling target_execute_cmd()
selftests/bpf: Whitelist test_progs.h from .gitignore
selftests/ftrace: fix event-no-pid on 1-core machine
selftests/lkdtm: Avoid needing explicit sub-shell
selftests: splice: Adjust for handler fallback removal
selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
selftests/vm/pkeys: handle negative sys_pkey_alloc() return code
selftests/vm/pkeys: refill shadow register after implicit kernel write
seq_buf: Make trace_seq_putmem_hex() support data longer than 8
serial: 8250: 8250_omap: Disable RX interrupt after DMA enable
serial: 8250: 8250_omap: Fix possible interrupt storm on K3 SoCs
serial: 8250: Actually allow UPF_MAGIC_MULTIPLIER baud rates
serial: 8250_omap: fix a timeout loop condition
serial_cs: Add Option International GSM-Ready 56K/ISDN modem
serial_cs: remove wrong GLOBETROTTER.cis entry
serial: fsl_lpuart: don't modify arbitrary data on lpuart32
serial: fsl_lpuart: remove RTSCTS handling from get_mctrl()
serial: mvebu-uart: correctly calculate minimal possible baudrate
serial: mvebu-uart: do not allow changing baudrate when uartclk is not available
serial: mvebu-uart: fix calculation of clock divisor
serial: sh-sci: Stop dmaengine transfer in sci_stop_tx()
soundwire: stream: Fix test for DP prepare complete
spi: Allow to have all native CSs in use along with GPIOs
spi: Avoid undefined behaviour when counting unused native CSs
spi: Make of_register_spi_device also set the fwnode
spi: meson-spicc: fix a wrong goto jump for avoiding memory leak.
spi: meson-spicc: fix memory leak in meson_spicc_probe
spi: omap-100k: Fix the length judgment problem
spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf'
spi: spi-sun6i: Fix chipselect/clock bug
spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages()
ssb: Fix error return code in ssb_bus_scan()
ssb: sdio: Don't overwrite const buffer if block_write fails
staging: fbtft: Don't spam logs when probe is deferred
staging: fbtft: Rectify GPIO handling
staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
staging: gdm724x: check for overflow in gdm_lte_netif_rx()
staging: media: rkvdec: fix pm_runtime_get_sync() usage count
staging: mmal-vchiq: Fix incorrect static vchiq_instance.
staging: mt7621-dts: fix pci address for PCI memory range
staging: rtl8712: fix error handling in r871xu_drv_init
staging: rtl8712: fix memory leak in rtl871x_load_fw_cb
SUNRPC: Fix the batch tasks count wraparound.
SUNRPC: Should wake up the privileged task firstly.
swap: fix do_swap_page() race with swapoff
tc-testing: fix list handling
thermal/cpufreq_cooling: Update offline CPUs per-cpu thermal_pressure
thunderbolt: Bond lanes only when dual_link_port != NULL in alloc_dev_default()
tls: prevent oversized sendfile() hangs by ignoring MSG_MORE
tools/bpftool: Fix error return code in do_batch()
tpm: Replace WARN_ONCE() with dev_err_once() in tpm_tis_status()
tpm_tis_spi: add missing SPI device ID entries
tracepoint: Add tracepoint_probe_register_may_exist() for BPF tracing
tracing/histograms: Fix parsing of "sym-offset" modifier
tty: nozomi: Fix a resource leak in an error handling function
tty: nozomi: Fix the error handling path of 'nozomi_card_init()'
USB: cdc-acm: blacklist Heimann USB Appset device
usb: dwc2: Don't reset the core after setting turnaround time
usb: dwc3: Fix debugfs creation flow
usb: gadget: eem: fix echo command packet response issue
usb: gadget: f_fs: Fix setting of device and driver data cross-references
usb: renesas-xhci: Fix handling of unknown ROM state
usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()
vfio/pci: Handle concurrent vma faults
video: fbdev: imxfb: Fix an error message
visorbus: fix error return code in visorchipset_init()
vrf: do not push non-ND strict packets with a source LLA through packet taps again
vxlan: add missing rcu_read_lock() in neigh_reduce()
wcn36xx: Move hal_buf allocation to devm_kmalloc in probe
wireless: carl9170: fix LEDS build errors & warnings
writeback, cgroup: increment isw_nr_in_flight before grabbing an inode
writeback: fix obtain a reference to a freeing memcg css
x86/elf: Use _BITUL() macro in UAPI headers
x86/sev: Make sure IRQs are disabled while GHCB is active
x86/sev: Split up runtime #VC handler for correct state tracking
xen/events: reset active flag for lateeoi events later
xfrm: Fix xfrm offload fallback fail case
xfrm: remove the fragment check for ipv6 beet mode
xfrm: xfrm_state_mtu should return at least 1280 for ipv6
xhci: solve a double free problem while doing s4
xsk: Fix broken Tx ring validation
xsk: Fix missing validation for skb and unaligned mode

Updated by kernel-updater-bot (https://abf.io/mikhailnov/kernel-updater-bot)
2021-07-16 12:22:38 +03:00

1608 lines
55 KiB
RPMSpec

# _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
# 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
%define sublevel 50
# Release number. Increase this before a rebuild.
%define rpmrel 1
%define fullrpmrel %{rpmrel}
%define rpmtag %{disttag}
# version defines
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
%define kverrel %{kversion}-%{fullrpmrel}
%define tar_ver %{kernelversion}.%{patchlevel}
%ifarch %{ix86}
%define arch_suffix i586
%endif
%ifarch %{x86_64}
%define arch_suffix x86_64
%endif
%ifarch aarch64
%define arch_suffix arm64
%endif
%define buildrpmrel %{fullrpmrel}%{rpmtag}-%{arch_suffix}
%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
# Fail the build after "make oldconfig" to edit kernel configs
%bcond_with fail
# User Mode Linux, https://habr.com/ru/company/itsumma/blog/459558/
# Not buildable on aarch64
%ifarch %{x86_64}
%bcond_without uml
%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
%if %{mdvver} >= 201905
# Build binary out-of-tree kernel modules (experimental)
%bcond_without binary_extra_modules
# Sign kernel modules with GOST key (experimental)
%bcond_without gost_sign
%else
%bcond_with binary_extra_modules
%bcond_with gost_sign
%endif
%bcond_with ccache
%bcond_without flow_abi
# 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
# The full kernel version
%define kver_full %{kversion}-%{flavour}-%{buildrpmrel}
############################################################################
%define top_dir_name kernel-%{_arch}
%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}
# 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
%define certs_signing_key_priv_rnd %{certs_dir_rnd}/signing_key_priv.key
%define certs_signing_der %{certs_dir_rnd}/signing_key.x509
%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}
############################################################################
# Build defines
%define build_doc 0
%define build_devel 1
%define build_debug 1
# Build kernel-headers package
# 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
# build perf and cpupower tools
%if %{mdvver} > 201610
%define build_perf 1
%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
# 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
%else
%define kmod_suffix %{nil}
%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}"
%else
%define kmake %make CC='gcc' ARCH="%{arch_type}"
%endif
# there are places where parallel make don't work
%define smake make
%ifarch %{ix86} %{x86_64}
%define arch_type x86
%endif
%ifarch aarch64
%define arch_type arm64
%endif
# 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}
Version: %{kversion}
Release: %{fullrpmrel}
License: GPLv2
Group: System/Kernel and hardware
URL: http://www.kernel.org
####################################################################
#
# Sources
#
Source0: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.xz
# This is for disabling *config, mrproper, prepare, scripts on -devel rpms
# Needed, because otherwise the -devel won't build correctly.
Source2: 0001-disable-mrproper-prepare-scripts-configs-in-devel-rp.patch
# TODO: make a separate package "ksobirator" and BR it
# after testing these macros properly
Source3: macros.ksobirator
%{load:%{SOURCE3}}
# Kernel configuration files.
Source111: kernel-x86_64.config
Source112: kernel-i586.config
Source113: kernel-arm64.config
# Cpupower: the service, the config, etc.
Source50: cpupower.service
Source51: cpupower.config
Source52: cpupower-start.sh
Source53: cpupower.path
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)}
####################################################################
# Patches
# The patch to make kernel x.y.z from x.y.0.
Patch1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kversion}.xz
# Patches from mainline
# none
# 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.
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
Patch102: 0001-audit-make-it-less-verbose.patch
# AUFS 5 from http://aufs.sourceforge.net/
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
# For kmod() generator of RPM Provides
# Changes version of aacraid.ko
Patch111: 0001-Remove-RPM-illegal-chars-from-module-version.patch
# 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
Patch203: 0003-security-altha-altha_lsm.c-build-fixed-with-kernel-5.patch
Patch204: 0004-altha-use-path-strings-instead-of-path-structs.patch
# 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
# 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
# Disable AutoReq
AutoReq: 0
# but keep autoprov for kmod(xxx)
AutoProv: 1
BuildRequires: bash
BuildRequires: bc
BuildRequires: binutils
BuildRequires: gcc
# ./scripts/mkcompile_h
# in net-tools in rosa2016.1, already installed
%if %{mdvver} > 201610
BuildRequires: hostname
%endif
# For power tools
BuildRequires: pkgconfig(ncurses)
BuildRequires: kmod-devel kmod-compat
BuildRequires: bison
BuildRequires: flex
BuildRequires: bzip2
BuildRequires: rsync
%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
BuildRequires: binutils-devel
BuildRequires: elfutils-devel
BuildRequires: libunwind-devel
BuildRequires: newt-devel
BuildRequires: perl-devel
BuildRequires: python3
BuildRequires: pkgconfig(python3)
BuildRequires: xmlto
BuildRequires: zlib-devel
BuildRequires: pkgconfig(libcrypto)
%endif
%if %{with uml}
BuildRequires: vde-devel
%endif
# (To generate keys)
# 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
%if %{with binary_extra_modules}
BuildRequires: kernel-source-rtl8821ce
BuildRequires: kernel-source-tripso
BuildRequires: kernel-source-ipt-so
%if %{with binary_virtualbox_host}
BuildRequires: kernel-source-virtualbox
%endif
%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
%endif
%endif #with binary_extra_modules
%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
%endif
%ifarch %{ix86}
Conflicts: arch(x86_64)
%endif
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.
#
# 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}
# File triggers from grub packages will handle this.
#/usr/sbin/update-grub2
%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)
%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
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
%{devel_root}/Documentation
%dir %{devel_root}
%dir %{devel_root}/arch
%dir %{devel_root}/include
%{devel_root}/arch/um
%{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
%{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
%{devel_root}/include/kunit
%{devel_root}/include/linux
%{devel_root}/include/math-emu
%{devel_root}/include/media
%{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
############################################################################
%if %build_doc
%package doc
Summary: Various documentation bits found in the kernel source
Group: Documentation
Buildarch: noarch
%description doc
This package contains documentation files from the kernel source.
%files doc
%doc linux-%{tar_ver}/Documentation/*
%endif
############################################################################
%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
%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
############################################################################
%if %{build_cpupower}
%package -n cpupower
Summary: The cpupower tools
Group: System/Kernel and hardware
%description -n cpupower
The cpupower tools.
%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 || :
fi
%preun -n cpupower
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 || :
fi
%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
############################################################################
%package -n cpupower-devel
Summary: Development files for cpupower
Group: Development/Kernel
Requires: cpupower = %{EVRD}
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
%{_includedir}/cpuidle.h
%endif
############################################################################
%if %{build_headers}
%package -n kernel-headers
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}
%description -n kernel-headers
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
%{_includedir}/*
# Don't conflict with cpupower-devel
%if %{build_cpupower}
%exclude %{_includedir}/cpufreq.h
%exclude %{_includedir}/cpuidle.h
%endif
%endif
############################################################################
%if %{with uml}
%package uml
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
%description uml
User Mode Linux binary.
Stripped, debug is in %{name}-debuginfo.
%files uml
%{_bindir}/linux-uml-%{kver_full}
#------------------------------------------------
%package uml-modules
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
%description uml-modules
User Mode Linux (UML) kernel modules
- not compressed
- not stripped
- signed
%files uml-modules
/lib/modules-uml/%{kver_full}
%endif #endif uml
#------------------------------------------------
%if %{with binary_extra_modules}
%ksob_mk_module_pkg -n 8821ce -s net/wireless -r rtl8821ce-blacklist
%ksob_mk_module_pkg -n xt_TRIPSO -s net -r tripso
%ksob_mk_module_pkg -n xt_so -s net -r ipt-so
%if %{with binary_shredder}
%ksob_mk_module_pkg -n shredder-kernel -s extra -r rosa-shredder-user
%endif
#------------------------------------------------
# virtualbox host
%if %{with binary_virtualbox_host}
%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}
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
%description -n kernel-modules-virtualbox-host-%{ksob_kernel}
Meta package to pull VirtualBox host kernel modules for %{name}
%files -n kernel-modules-virtualbox-host-%{ksob_kernel}
# empty
%endif #ifarch x86
#------------------------------------------------
%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
%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
################################################
%prep
# avoid accidental merge
%if 0%{?rpm5}
%{error:Package structure is for dnf, not for urpmi!}
%endif
%setup -q -n %top_dir_name -c
%if %{with uml}
cp -r %{src_dir} %{src_dir}.uml
%endif
cd %src_dir
%autopatch -p1
#
# Setup Begin
#
# Kernel configuration
echo "Creating the kernel configuration file."
# Configs
cp %{SOURCE111} .
cp %{SOURCE112} .
cp %{SOURCE113} .
cp kernel-%{arch_suffix}.config .config
touch %{build_dir}/.config.append
# 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
%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
%endif
sed -i '/CONFIG_MODULE_SIG_FORCE/d' .config
%if %{with oblig_signed_modules}
# Disallow loading not signed modules
# But 0001-ROSA-ima-allow-to-off-modules-signature-check-dynami.patch allows to override this in cmdline
echo CONFIG_MODULE_SIG_FORCE=y >> %{build_dir}/.config.append
%else
echo CONFIG_MODULE_SIG_FORCE=n >> %{build_dir}/.config.append
%endif
sed -i '/CONFIG_MODULE_SIG_KEY/d' .config
# Set path to the key that will be generated later by openssl/libressl
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
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}
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.
# 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
cat %{build_dir}/.config.append >> .config
# Store the config file in the appropriate directory.
CONFIG_DIR=arch/%{arch_type}/configs
mkdir -p "${CONFIG_DIR}"
cfg_file=arch/%{arch_type}/configs/%{arch_suffix}_defconfig-%{flavour}
make ARCH=%{arch_type} oldconfig
# When it is needed to edit kernel configs, run:
# abf fetch
# rpmbuild --define "_sourcedir $PWD" --with=fail -bb kernel.spec
# 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}."
# make sure the kernel has the sublevel we know it has...
LC_ALL=C sed -ri "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile
# get rid of unwanted files
find . -name '*~' -o -name '*.orig' -o -name '*.append' | %kxargs rm -f
find . -name '.get_maintainer.ignore' | %kxargs rm -f
############################################################################
%build
# 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(){
# Show resulting kernel public keys for debugging
cat "%{src_dir}/%{certs_dir_rnd}/x509_certificate_list" | base64 -d || :
rm -fvr "%{src_dir}/%{certs_dir_rnd}"
%if %{with uml}
cat "%{src_dir}.uml/%{certs_dir_rnd}/x509_certificate_list" | base64 -d || :
rm -fvr "%{src_dir}.uml/%{certs_dir_rnd}"
%endif
}
# Make a trap to delete keys even if %%build fails in the middle
trap "_cleanup" EXIT
rm -rf %{temp_root}
install -d %{temp_root}
cd %src_dir
### 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
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)"
cat <<EOF > "%{certs_key_config_rnd}"
[ req ]
prompt = no
string_mask = utf8only
#default_keyfile = %{certs_signing_key_priv_rnd}
distinguished_name = req_distinguished_name
x509_extensions = myexts
[ 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
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
}
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}"
# link sign-file and extract-cert with LibreSSL instead of OpenSSL
if [ $? != 0 ] ; then exit $? ; fi
sed -i %{src_dir}/scripts/Makefile \
%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}
# .config
%smake -s mrproper
cp arch/%{arch_type}/configs/%{arch_suffix}_defconfig-%{flavour} .config
# make sure EXTRAVERSION says what we want it to say
LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{flavour}-%{buildrpmrel}/" Makefile
# build the kernel
echo "Building kernel %{kver_full}"
TARGETS="all"
# need to install dtbs to proper boot arm64 devices
%ifarch %{armx}
TARGETS="$TARGETS dtbs"
%endif
%kmake V=1 -s $TARGETS
# 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
%if %{with binary_shredder}
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
%if %{with binary_virtualbox_host}
# build commands for virtualbox are based on the ones from the virtualbox package
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
%endif
%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
%if %{with uml}
cp -rv %{certs_dir_rnd} %{src_dir}.uml/
pushd %{src_dir}.uml
%kmake ARCH=um defconfig
%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
%ifarch %{armx}
%make_build ARCH=%{arch_type} V=1 INSTALL_DTBS_PATH=%{temp_boot}/dtb-%{kver_full} dtbs_install
%endif
%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
# 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
%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
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}/
cp -fR arch/%{arch_type}/kernel/asm-offsets.{c,s} %{temp_devel_root}/arch/%{arch_type}/kernel/
%ifarch %{ix86} %{x86_64}
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/
# needed for arch/x86/purgatory
cp -fR lib/*.h lib/*.c %{temp_devel_root}/lib/
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}/
# 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/
# 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/
# aufs2 has a special file needed
cp -fR fs/aufs/magic.mk %{temp_devel_root}/fs/aufs
# SELinux needs security/selinux/include
cp -fR security/selinux/include %{temp_devel_root}/security/selinux
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
# Clean the scripts tree, and make sure everything is ok (sanity check)
# running prepare+scripts (tree was already "prepared" in build)
pushd %{temp_devel_root}
%smake V=1 -s clean ARCH=%{arch_type}
popd
rm -f %{temp_devel_root}/.config.old
# fix permissions
chmod -R a+rX %{temp_devel_root}
# disable mrproper in -devel rpms
patch -p1 --fuzz=0 -d %{temp_devel_root} -i %{SOURCE2}
# endif build_devel
%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
# https://patchwork.kernel.org/patch/11446123/
_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 \
"%{certs_signing_key_priv_rnd}.RSA" "%{certs_signing_key_priv_rnd}.RSA" "$f"
%endif
unset f
}
export -f _libressl_sign
find %{temp_modules}/%{kver_full}/kernel \
%if %{with uml}
%{temp_root}/lib/modules-uml/%{kver_full} \
%endif
-name '*.ko' -print0 | sort -u | \
xargs --null -P "$(nproc)" -I {} "$SHELL" -e -x -c 'if ! _libressl_sign "{}"; \
then echo Failed _libressl_sign on "{}" && exit 1; fi'
# set extraversion to match srpm to get nice version reported by the tools
LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{fullrpmrel}/" Makefile
%if %{build_perf}
%smake -C tools/perf -s PYTHON=%{__python3} HAVE_CPLUS_DEMANGLE=1 WERROR=0 prefix=%{_prefix} lib=%{_lib} NO_GTK2=1 all
%smake -C tools/perf -s prefix=%{_prefix} lib=%{_lib} NO_GTK2=1 man
%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
%endif
_cleanup
############################################################################
%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
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}
# 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
%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
# 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.
for i in *; do
touch $i/modules.description
done
popd
# need to set extraversion to match srpm again to avoid rebuild
LC_ALL=C sed -ri "s/^EXTRAVERSION.*/EXTRAVERSION = -%{fullrpmrel}/" Makefile
%if %{build_perf}
# perf tool binary and supporting scripts/binaries
make -C tools/perf -s V=1 DESTDIR=%{buildroot} WERROR=0 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} lib=%{_lib} install
# 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
# perf man pages (note: implicit rpm magic compresses them later)
make -C tools/perf -s V=1 DESTDIR=%{buildroot} WERROR=0 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install-man
%endif
%if %{build_cpupower}
make -C tools/power/cpupower DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
rm -f %{buildroot}%{_libdir}/*.{a,la}
%find_lang cpupower
mv cpupower.lang ../
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
install -m644 %{SOURCE50} %{buildroot}%{_unitdir}/cpupower.service
install -m644 %{SOURCE53} %{buildroot}%{_unitdir}/cpupower.path
install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
install -m755 %{SOURCE52} %{buildroot}%{_bindir}/cpupower-start.sh
%endif
# 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