kernel-5.15/kernel.spec
Mikhail Novosyolov 77913992cd [bot] upd: 5.15.61 -> 5.15.65
Changelog:

ACPI: processor: Remove freq Qos request for all CPUs
ACPI: property: Return type of acpi_add_nondev_subnodes() should be bool
ACPI: thermal: drop an always true check
af_key: Do not call xfrm_probe_algs in parallel
ALSA: control: Use deferred fasync helper
ALSA: core: Add async signal helpers
ALSA: hda/realtek: Add quirk for Clevo NS50PU, NS70PU
ALSA: info: Fix llseek return value when using callback
ALSA: timer: Use deferred fasync helper
ALSA: usb-audio: Add quirk for LH Labs Geek Out HD Audio 1V5
ALSA: usb-audio: More comprehensive mixer map for ASUS ROG Zenith II
android: binder: fix lockdep check on clearing vma
apparmor: fix aa_label_asxprint return check
apparmor: fix absroot causing audited secids to begin with =
apparmor: Fix failed mount permission check error message
apparmor: Fix memleak in aa_simple_write_to_buffer()
apparmor: fix overlapping attachment computation
apparmor: fix quiet_denied for file rules
apparmor: fix reference count leak in aa_pivotroot()
apparmor: fix setting unconfined mode on a loaded profile
arm64: errata: Add Cortex-A510 to the repeat tlbi list
arm64: Fix match_list for erratum 1286807 on Arm Cortex-A76
asm-generic: sections: refactor memory_intersects
ASoC: codec: tlv320aic32x4: fix mono playback via I2S
ASoC: rsnd: care default case on rsnd_ssiu_busif_err_irq_ctrl()
ASoC: sh: rz-ssi: Improve error handling in rz_ssi_probe() error path
ASoC: SOF: debug: Fix potential buffer overflow by snprintf()
ASoC: SOF: Intel: hda: Define rom_status_reg in sof_intel_dsp_desc
ASoC: SOF: Intel: hda: Fix potential buffer overflow by snprintf()
ASoC: tas2770: Allow mono streams
ASoC: tas2770: Drop conflicting set_bias_level power setting
ASoC: tas2770: Fix handling of mute/unmute
ASoC: tas2770: Set correct FSYNC polarity
ata: libata-eh: Add missing command name
atm: idt77252: fix use-after-free bugs caused by tst_timer
audit: fix potential double free on error path from fsnotify_add_inode_mark
binder_alloc: add missing mmap_lock calls when using the VMA
blk-mq: fix io hung due to missing commit_rqs
block: add a bdev_max_zone_append_sectors helper
block: add bdev_max_segments() helper
Bluetooth: L2CAP: Fix build errors in some archs
bnxt_en: fix NQ resource accounting during vf creation on 57500 chips
bonding: 802.3ad: fix no transmission of LACPDUs
bootmem: remove the vmemmap pages from kmemleak in put_page_bootmem
bpf: Acquire map uref in .init_seq_private for array map iterator
bpf: Acquire map uref in .init_seq_private for hash map iterator
bpf: Acquire map uref in .init_seq_private for sock local storage map iterator
bpf: Acquire map uref in .init_seq_private for sock{map,hash} iterator
bpf: Check the validity of max_rdwr_access for sock local storage map iterator
bpf: Don't redirect packets with invalid pkt_len
bpf: Don't reinit map value in prealloc_lru_pop
bpf: Don't use tnum_range on array range checking for poke descriptors
BPF: Fix potential bad pointer dereference in bpf_sys_bpf()
btrfs: add and use helper for unlinking inode during log replay
btrfs: add info when mount fails due to stale replace target
btrfs: check if root is readonly while setting security xattr
btrfs: convert count_max_extents() to use fs_info->max_extent_size
btrfs: fix lockdep splat with reloc root extent buffers
btrfs: fix lost error handling when looking up extended ref on log replay
btrfs: fix possible memory leak in btrfs_get_dev_args_from_path()
btrfs: fix silent failure when deleting root reference
btrfs: fix space cache corruption and potential double allocations
btrfs: fix warning during log replay when bumping inode link count
btrfs: move lockdep class helpers to locking.c
btrfs: only write the sectors in the vertical stripe which has data stripes
btrfs: pass the dentry to btrfs_log_new_name() instead of the inode
btrfs: put initial index value of a directory in a constant
btrfs: raid56: don't trust any cached sector in __raid56_parity_recover()
btrfs: remove no longer needed logic for replaying directory deletes
btrfs: remove root argument from btrfs_unlink_inode()
btrfs: remove unnecessary parameter delalloc_start for writepage_delalloc()
btrfs: replace BTRFS_MAX_EXTENT_SIZE with fs_info->max_extent_size
btrfs: replace: drop assert for suspended replace
btrfs: reset RO counter on block group if we fail to relocate
btrfs: tree-checker: check for overlapping extent items
btrfs: unset reloc control if transaction commit fails in prepare_to_relocate()
btrfs: zoned: revive max_zone_append_bytes
can: ems_usb: fix clang's -Wunaligned-access warning
can: j1939: j1939_session_destroy(): fix memory leak of skbs
can: j1939: j1939_sk_queue_activate_next_locked(): replace WARN_ON_ONCE with netdev_warn_once()
can: mcp251x: Fix race condition on receive interrupt
ceph: don't leak snap_rwsem in handle_cap_grant
ceph: use correct index when encoding client supported features
cgroup: Fix race condition at rebind_subsystems()
cifs: Fix memory leak on the deferred close
clk: qcom: clk-alpha-pll: fix clk_trion_pll_configure description
clk: qcom: ipq8074: dont disable gcc_sleep_clk_src
clk: ti: Stop using legacy clkctrl names for omap4 and 5
coresight: etm4x: avoid build failure with unrolled loops
crypto: lib - remove unneeded selection of XOR_BLOCKS
csky/kprobe: reclaim insn_slot on kprobe unregistration
cxl: Fix a memory leak in an error handling path
devlink: Fix use-after-free after a failed reload
dmaengine: dw-axi-dmac: do not print NULL LLI during error
dmaengine: dw-axi-dmac: ignore interrupt if no descriptor
dmaengine: sprd: Cleanup in .remove() after pm_runtime_get_sync() failed
Documentation/ABI: Mention retbleed vulnerability info file for sysfs
Documentation: ACPI: EINJ: Fix obsolete example
dpaa2-eth: trace the allocated address instead of page struct
drivers/base: fix userspace break from using bin_attributes for cpumap and cpulist
Drivers: hv: balloon: Support status report for larger page sizes
drivers:md:fix a potential use-after-free bug
drm/amd/display: avoid doing vm_init multiple time
drm/amd/display: Avoid MPC infinite loop
drm/amd/display: Check correct bounds for stream encoder instances for DCN303
drm/amd/display: clear optc underflow before turn off odm clock
drm/amd/display: Fix HDMI VSIF V3 incorrect issue
drm/amd/display: Fix pixel clock programming
drm/amd/display: For stereo keep "FLIP_ANY_FRAME"
drm/amdgpu: Increase tlb flush timeout for sriov
drm/amd/pm: add missing ->fini_microcode interface for Sienna Cichlid
drm/bridge: Add stubs for devm_drm_of_get_bridge when OF is disabled
drm/i915/gt: Skip TLB invalidations once wedged
drm/imx/dcss: get rid of HPD warning message
drm/meson: Fix overflow implicit truncation warnings
drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()
drm/nouveau: recognise GA103
drm/sun4i: dsi: Prevent underflow when computing packet sizes
drm/ttm: Fix dummy res NULL ptr deref bug
drm/vc4: hdmi: Depends on CONFIG_PM
drm/vc4: hdmi: Rework power up
dt-bindings: arm: qcom: fix Alcatel OneTouch Idol 3 compatibles
dt-bindings: arm: qcom: fix Longcheer L8150 compatibles
dt-bindings: arm: qcom: fix MSM8916 MTP compatibles
dt-bindings: arm: qcom: fix MSM8994 boards compatibles
dt-bindings: clock: qcom,gcc-msm8996: add more GCC clock sources
dt-bindings: gpio: zynq: Add missing compatible strings
dt-bindings: usb: mtk-xhci: Allow wakeup interrupt-names to be optional
eth: sun: cassini: remove dead code
ext4: avoid remove directory when directory is corrupted
ext4: avoid resizing to a partial cluster size
f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()
f2fs: fix to do sanity check on segment type in build_sit_entries()
fbdev: fbcon: Properly revert changes when vc_resize() failed
fbdev: fb_pm2fb: Avoid potential divide by zero error
fec: Fix timer capture timing in `fec_ptp_enable_pps()`
firmware: tegra: bpmp: Do only aligned access to IPC memory area
fs/ntfs3: Do not change mode if ntfs_set_ea failed
fs/ntfs3: Don't clear upper bits accidentally in log_replay()
fs/ntfs3: Fix double free on remount
fs/ntfs3: Fix missing i_op in ntfs_read_mft
fs/ntfs3: Fix NULL deref in ntfs_update_mftmirr
fs/ntfs3: Fix using uninitialized value n when calling indx_read
fs/ntfs3: Fix work with fragmented xattr
fs/ntfs3: uninitialized variable in ntfs_set_acl_ex()
fs: require CAP_SYS_ADMIN in target namespace for idmapped mounts
ftrace: Fix NULL pointer dereference in is_ftrace_trampoline when ftrace is dead
gadgetfs: ep_io - wait until IRQ finishes
gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file
geneve: do not use RT_TOS for IPv6 flowlabel
geneve: fix TOS inheriting for ipv4
habanalabs/gaudi: fix shift out of bounds
habanalabs/gaudi: mask constant value before cast
HID: add Lenovo Yoga C630 battery quirk
HID: AMD_SFH: Add a DMI quirk entry for Chromebooks
HID: asus: ROG NKey: Ignore portion of 0x5a report
HID: hidraw: fix memory leak in hidraw_release()
HID: multitouch: new device class fix Lenovo X12 trackpad sticky
HID: steam: Prevent NULL pointer dereference in steam_{recv,send}_report
HID: thrustmaster: Add sparco wheel and fix array length
i2c: imx: Make sure to unregister adapter on remove()
i40e: Fix incorrect address type for IPv6 flow rules
i40e: Fix to stop tx_timeout recovery if GLOBR fails
iavf: Fix adminq error handling
iavf: Fix reset error handling
ice: Ignore EEXIST when setting promisc mode
ice: xsk: Force rings to be sized to power of 2
ice: xsk: prohibit usage of non-balanced queue id
igb: Add lock to avoid data race
Input: exc3000 - fix return value check of wait_for_completion_timeout
Input: i8042 - add additional TUXEDO devices to i8042 quirk tables
Input: i8042 - add TUXEDO devices to i8042 quirk tables
Input: i8042 - merge quirk tables
Input: i8042 - move __initconst to fix code styling warning
iommu/io-pgtable-arm-v7s: Add a quirk to allow pgtable PA up to 35bit
ionic: clear broken state on generation change
ionic: fix up issues with handling EAGAIN on FW cmds
ionic: VF initial random MAC address if no assigned mac
ionic: widen queue_lock use around lif init and deinit
io_uring: bump poll refs to full 31-bits
io_uring: clean cqe filling functions
io_uring: correct fill events helpers types
io_uring: fail links when poll fails
io_uring: fix issue with io_write() not always undoing sb_start_write()
io_uring: fix UAF due to missing POLLFREE handling
io_uring: fix wrong arm_poll error handling
io_uring: inline io_poll_complete
io_uring: kill poll linking optimisation
io_uring: move common poll bits
io_uring: poll rework
io_uring: refactor poll update
io_uring: remove poll entry from list when canceling all
io_uring: Remove unused function req_ref_put
io_uring: use original request task for inflight tracking
ipv6: do not use RT_TOS for IPv6 flowlabel
irqchip/tegra: Fix overflow implicit truncation warnings
ixgbe: stop resetting SYSTIME in ixgbe_ptp_start_cyclecounter
kbuild: dummy-tools: avoid tmpdir leak in dummy gcc
kbuild: Fix include path in scripts/Makefile.modpost
kbuild: fix the modules order between drivers and libs
kernel/sys_ni: add compat entry for fadvise64_64
kprobes: don't call disarm_kprobe() for disabled kprobes
ksmbd: don't remove dos attribute xattr on O_TRUNC open
ksmbd: fix heap-based overflow in set_ntacl_dacl()
ksmbd: prevent out of bound read for SMB2_WRITE
ksmbd: return STATUS_BAD_NETWORK_NAME error status if share is not configured
KVM: arm64: Reject 32bit user PSTATE on asymmetric systems
KVM: arm64: Treat PMCR_EL1.LC as RES1 on asymmetric systems
KVM: PPC: Book3S HV: Fix "rm_exit" entry in debugfs timings
KVM: Unconditionally get a ref to /dev/kvm module when creating a VM
lib/list_debug.c: Detect uninitialized lists
locking/atomic: Make test_and_*_bit() ordered on failure
loop: Check for overflow while configuring loop
m68k: coldfire/device.c: protect FLEXCAN blocks
md: call __md_stop_writes in md_stop
md: Notify sysfs sync_completed in md_reap_sync_thread()
media: pvrusb2: fix memory leak in pvr_probe
mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
mlx5: do not use RT_TOS for IPv6 flowlabel
mlxsw: spectrum: Clear PTP configuration after unregistering the netdevice
mmc: meson-gx: Fix an error handling path in meson_mmc_probe()
mmc: mtk-sd: Clear interrupts when cqe off/disable
mmc: pxamci: Fix an error handling path in pxamci_probe()
mmc: pxamci: Fix another error handling path in pxamci_probe()
mmc: sdhci-of-dwcmshc: add reset call back for rockchip Socs
mmc: sdhci-of-dwcmshc: Re-enable support for the BlueField-3 SoC
mmc: sdhci-of-dwcmshc: rename rk3568 to rk35xx
mmc: tmio: avoid glitches when resetting
mm/damon/dbgfs: avoid duplicate context directory creation
mm: Force TLB flush for PFNMAP mappings before unlink_file_vma()
mm/hugetlb: avoid corrupting page->mapping in hugetlb_mcopy_atomic_pte
mm/hugetlb: fix hugetlb not supporting softdirty tracking
mm/rmap: Fix anon_vma->degree ambiguity leading to double-reuse
mm/smaps: don't access young/dirty bit if pte unpresent
modules: Ensure natural alignment for .altinstructions and __bug_table sections
mptcp: Fix crash due to tcp_tsorted_anchor was initialized before release skb
mptcp: stop relying on tcp_tx_skb_cache
neigh: fix possible DoS due to net iface start/stop loop
net/af_packet: check len when min_header_len equals to 0
net: atlantic: fix aq_vec index out of range error
net: bcmgenet: Indicate MAC is in charge of PHY PM
net: bgmac: Fix a BUG triggered by wrong bytes_compl
net: dsa: don't warn in dsa_port_set_state_now() when driver doesn't support it
net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters
net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry
net: dsa: mv88e6060: prevent crash on an unused port
net: dsa: sja1105: fix buffer overflow in sja1105_setup_devlink_regions()
netfilter: bitwise: improve error goto labels
netfilter: conntrack: NF_CONNTRACK_PROCFS should no longer default to y
netfilter: ebtables: reject blobs that don't provide all entry points
netfilter: flowtable: add function to invoke garbage collection immediately
netfilter: flowtable: fix stuck flows on cleanup due to pending work
netfilter: nf_tables: check NFT_SET_CONCAT flag if field_count is specified
netfilter: nf_tables: consolidate rule verdict trace call
netfilter: nf_tables: disallow binding to already bound chain
netfilter: nf_tables: disallow jump to implicit chain from set element
netfilter: nf_tables: disallow NFTA_SET_ELEM_KEY_END with NFT_SET_ELEM_INTERVAL_END flag
netfilter: nf_tables: disallow NFT_SET_ELEM_CATCHALL and NFT_SET_ELEM_INTERVAL_END
netfilter: nf_tables: disallow updates of implicit chain
netfilter: nf_tables: do not leave chain stats enabled on error
netfilter: nf_tables: make table handle allocation per-netns friendly
netfilter: nf_tables: NFTA_SET_ELEM_KEY_END requires concat and interval flags
netfilter: nf_tables: possible module reference underflow in error path
netfilter: nf_tables: really skip inactive sets when allocating name
netfilter: nf_tables: upfront validation of data via nft_data_init()
netfilter: nf_tables: use READ_ONCE and WRITE_ONCE for shared generation id access
netfilter: nf_tables: validate NFTA_SET_ELEM_OBJREF based on NFT_SET_OBJECT flag
netfilter: nft_cmp: optimize comparison for 16-bytes
netfilter: nft_osf: restrict osf to ipv4, ipv6 and inet families
netfilter: nft_payload: do not truncate csum_offset and csum_type
netfilter: nft_payload: report ERANGE for too long offset and length
netfilter: nft_tunnel: restrict it to netdev family
net: Fix a data-race around netdev_budget.
net: Fix a data-race around netdev_budget_usecs.
net: Fix a data-race around sysctl_net_busy_poll.
net: Fix a data-race around sysctl_net_busy_read.
net: Fix a data-race around sysctl_somaxconn.
net: Fix a data-race around sysctl_tstamp_allow_data.
net: Fix data-races around netdev_max_backlog.
net: Fix data-races around netdev_tstamp_prequeue.
net: Fix data-races around sysctl_devconf_inherit_init_net.
net: Fix data-races around sysctl_fb_tunnels_only_for_init_net.
net: Fix data-races around sysctl_max_skb_frags.
net: Fix data-races around sysctl_optmem_max.
net: Fix data-races around sysctl_[rw]mem_(max|default).
net: Fix data-races around weight_p and dev_weight_[rt]x_bias.
net: fix potential refcount leak in ndisc_router_discovery()
net: fix refcount bug in sk_psock_get (2)
net: genl: fix error path memory leak in policy dumping
net: ipa: don't assume SMEM is page-aligned
net: ipvtap - add __init/__exit annotations to module init/exit funcs
net/mlx5: Avoid false positive lockdep warning by adding lock_class_key
net/mlx5e: Fix wrong application of the LRO state
net/mlx5e: Fix wrong tc flag used when set hw-tc-offload off
net/mlx5e: Properly disable vlan strip on non-UL reps
net: moxa: get rid of asymmetry in DMA mapping/unmapping
net: moxa: pass pdev instead of ndev to DMA functions
net: neigh: don't call kfree_skb() under spin_lock_irqsave()
net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()
net: phy: Warn about incorrect mdio_bus_phy_resume() state
net: qrtr: start MHI channel after endpoit creation
net_sched: cls_route: disallow handle of 0
net: stmmac: work around sporadic tx issue on link-up
net/sunrpc: fix potential memory leaks in rpc_sysfs_xprt_state_change()
net: use eth_hw_addr_set() instead of ether_addr_copy()
nfc: pn533: Fix use-after-free bugs caused by pn532_cmd_timeout
nfp: ethtool: fix the display error of `ethtool -m DEVNAME`
NFS: Don't allocate nfs_fattr on the stack in __nfs42_ssc_open()
NFSv4.1: Don't decrease the value of seq_nr_highest_sent
NFSv4.1: Handle NFS4ERR_DELAY replies to OP_SEQUENCE correctly
NFSv4.1: RECLAIM_COMPLETE must handle EACCES
NFSv4.2 fix problems with __nfs42_ssc_open
NFSv4: Fix races in the legacy idmapper upcall
NFSv4/pnfs: Fix a use-after-free bug in open
nios2: add force_successful_syscall_return()
nios2: don't leave NULLs in sys_call_table[]
nios2: fix syscall restart checks
nios2: page fault et.al. are *not* restartable syscalls...
nios2: restarts apply only to the first sigframe we build...
nios2: traced syscall does need to check the syscall number
nouveau: explicitly wait on the fence in nouveau_bo_move_m2mf
NTB: ntb_tool: uninitialized heap data in tool_fn_write()
ntfs: fix acl handling
nvmet-tcp: fix lockdep complaint on nvmet_tcp_wq flush during queue teardown
octeontx2-af: Apply tx nibble fixup always
octeontx2-af: Fix key checking for source mac
octeontx2-af: Fix mcam entry resource leak
octeontx2-af: suppress external profile loading warning
octeontx2-pf: Fix NIX_AF_TL3_TL2X_LINKX_CFG register configuration
openrisc: io: Define iounmap argument as volatile
ovl: warn if trusted xattr creation fails
parisc: Fix exception handler for fldw and fstw instructions
parisc: Make CONFIG_64BIT available for ARCH=parisc64 only
PCI: aardvark: Fix reporting Slot capabilities on emulated bridge
PCI/ACPI: Guard ARM64-specific mcfg_quirks
PCI: Add ACS quirk for Broadcom BCM5750x NICs
perf parse-events: Fix segfault when event parser gets an error
perf probe: Fix an error handling path in 'parse_perf_probe_command()'
perf python: Fix build when PYTHON_CONFIG is user supplied
perf stat: Clear evsel->reset_group for each stat run
perf tests: Fix Track with sched_switch test for hybrid case
perf/x86/intel/ds: Fix precise store latency handling
perf/x86/intel/uncore: Fix broken read_counter() for SNB IMC PMU
perf/x86/lbr: Enable the branch type for the Arch LBR by default
phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks
pinctrl: amd: Don't save/restore interrupt status and wake status bits
pinctrl: intel: Check against matching data instead of ACPI companion
pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map
pinctrl: qcom: msm8916: Allow CAMSS GP clocks to be muxed
pinctrl: qcom: sm8250: Fix PDC map
pinctrl: sunxi: Add I/O bias setting for H6 R-PIO
platform/chrome: cros_ec_proto: don't show MKBP version if unsupported
plip: avoid rcu debug splat
powerpc/32: Don't always pass -mcpu=powerpc to the compiler
powerpc/32: Set an IBAT covering up to _einittext during init
powerpc/64: Init jump labels before parse_early_param()
powerpc/ioda/iommu/debugfs: Generate unique debugfs entries
powerpc/pci: Fix get_phb_number() locking
r8152: fix the RX FIFO settings when suspending
r8152: fix the units of some registers for RTL8156A
ratelimit: Fix data-races in ___ratelimit().
RDMA/rxe: Limit the number of calls to each tasklet
rds: add missing barrier to release_refill
regulator: pca9450: Remove restrictions for regulator-name
Revert "md-raid: destroy the bitmap after destroying the thread"
Revert "memcg: cleanup racy sum avoidance code"
Revert "net: macsec: update SCI upon MAC address change."
Revert "PCI/portdrv: Don't disable AER reporting in get_port_device_capability()"
Revert "usbnet: smsc95xx: Fix deadlock on runtime resume"
Revert "usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling"
Revert "x86/ftrace: Use alternative RET encoding"
RISC-V: Add fast call path of crash_kexec()
riscv: dts: canaan: Add k210 topology information
riscv: dts: sifive: Add fu740 topology information
riscv: lib: uaccess: fix CSR_STATUS SR_SUM bit
riscv: lib: uaccess: fold fixups into body
riscv: mmap with PROT_WRITE but no PROT_READ is invalid
riscv: traps: add missing prototype
rose: check NULL rose_loopback_neigh->loopback
rxrpc: Fix locking in rxrpc's sendmsg
s390: fix double free of GS and RI CBs on fork() failure
s390/hypfs: avoid error message under KVM
s390/mm: do not trigger write fault when vma does not allow VM_WRITE
scsi: lpfc: Fix possible memory leak when failing to issue CMF WQE
scsi: lpfc: Prevent buffer overflow crashes in debugfs with malformed user input
scsi: qla2xxx: edif: Fix dropped IKE message
scsi: qla2xxx: Fix response queue handler reading stale packets
scsi: storvsc: Remove WQ_MEM_RECLAIM from storvsc_error_wq
scsi: ufs: core: Enable link lost interrupt
scsi: ufs: ufs-mediatek: Fix build error and type mismatch
scsi: ufs: ufs-mediatek: Fix the timing of configuring device regulators
selftests: forwarding: Fix failing tests with old libnet
selftests/kprobe: Do not test for GRP/ without event failures
smb3: check xattr value length earlier
smb3: missing inode locks in punch hole
spi: dt-bindings: cadence: add missing 'required'
spi: dt-bindings: zynqmp-qspi: add missing 'required'
spi: meson-spicc: add local pow2 clock ops to preserve rate between messages
stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove()
sunrpc: fix expiry of auth creds
SUNRPC: Fix xdr_encode_bool()
SUNRPC: Reinitialise the backchannel request buffers before reuse
SUNRPC: RPC level errors should set task->tk_rpc_status
tcp: expose the tcp_mark_push() and tcp_skb_entail() helpers
tee: add overflow check in register_shm_helper()
testing: selftests: nft_flowtable.sh: use random netns names
tools build: Switch to new openssl API for test-libcrypto
tools/vm/slabinfo: use alphabetic order when two values are equal
tracing/eprobes: Do not allow eprobes to use $stack, or % for regs
tracing/eprobes: Do not hardcode $comm as a string
tracing/eprobes: Fix reading of string fields
tracing/eprobes: Have event probes be consistent with kprobes and uprobes
tracing: Have filter accept "common_cpu" to be consistent
tracing/perf: Fix double put of trace event when init fails
tracing/probes: Have kprobes and uprobes use $COMM too
tty: serial: Fix refcount leak bug in ucc_uart.c
uacce: Handle parent device removal or parent driver module rmmod
udmabuf: Set the DMA mask for the udmabuf device (v2)
um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups
usb: cdns3: fix random warning message when driver load
usb: cdns3 fix use-after-free at workaround 2
usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch
usb: gadget: uvc: calculate the number of request depending on framesize
usb: gadget: uvc: call uvc uvcg_warn on completed status instead of uvcg_info
usb: host: ohci-ppc-of: Fix refcount leak bug
usb: renesas: Fix refcount leak bug
vboxguest: Do not use devm for irq
venus: pm_helpers: Fix warning in OPP during probe
vfio: Clear the caps->buf to NULL after free
video: fbdev: i740fb: Check the argument of i740_calc_vclk()
virtio_net: fix memory leak inside XPD_TX with mergeable
vsock: Fix memory leak in vsock_connect()
vsock: Set socket state back to SS_UNCONNECTED in vsock_connect_timeout()
watchdog: export lockup_detector_reconfigure
wifi: rtlwifi: remove always-true condition pointed out by GCC 12
writeback: avoid use-after-free after removing device
x86/bugs: Add "unknown" reporting for MMIO Stale Data
x86/entry: Move CLD to the start of the idtentry macro
x86/ftrace: Use alternative RET encoding
x86/ibt,ftrace: Make function-graph play nice
x86/kprobes: Fix JNG/JNLE emulation
x86/mm: Use proper mask when setting PUD mapping
x86/nospec: Fix i386 RSB stuffing
x86/nospec: Unwreck the RSB stuffing
x86/unwind/orc: Unwind ftrace trampolines with correct ORC entry
xen/privcmd: fix error exit of privcmd_ioctl_dm_op()
xen/xenbus: fix return type in xenbus_file_read()
xfrm: clone missing x->lastused in xfrm_do_migrate
xfrm: fix refcount leak in __xfrm_policy_check()
xfrm: policy: fix metadata dst->dev xmit null pointer dereference
xfs: always succeed at setting the reserve pool size
xfs: fix overfilling of reserve pool
xfs: fix soft lockup via spinning in filestream ag selection loop
xfs: flush inodegc workqueue tasks before cancel
xfs: reject crazy array sizes being fed to XFS_IOC_GETBMAP*
xfs: remove infinite loop when reserving free block pool
xfs: reserve quota for dir expansion when linking/unlinking files
xfs: reserve quota for target dir expansion when renaming files
xfs: revert "xfs: actually bump warning counts when we send warnings"
zram: do not lookup algorithm in backends table

Updated by kernel-updater-bot (https://abf.io/mikhailnov/kernel-updater-bot)
2022-09-07 10:59:52 +03:00

1840 lines
64 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 15
%define sublevel 65
# 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 i686
%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, rarely needed in general
%bcond_with uml
# "Nickel" is a special brand for certified distros
%if %{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
%bcond_without aufs
# 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
# Optionally keep using xz as compressor
#bcond_without modxz
# 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}
############################################################################
#if %%{with binary_extra_modules}
# https://github.com/rpm-software-management/rpm/pull/1794
#define nvidia_390_j %%(if rpm -q kernel-source-nvidia390 >/dev/null 2>&1; then rpm -q --qf '%%{version}' kernel-source-nvidia390 | awk -F '.' '{print $1}'; else echo 0; fi)
#define nvidia_390_n %%(if rpm -q kernel-source-nvidia390 >/dev/null 2>&1; then rpm -q --qf '%%{version}' kernel-source-nvidia390 | awk -F '.' '{print $2}'; else echo 0; fi)
#define nvidia_470_j %%(if rpm -q kernel-source-nvidia470 >/dev/null 2>&1; then rpm -q --qf '%%{version}' kernel-source-nvidia470 | awk -F '.' '{print $1}'; else echo 0; fi)
#define nvidia_470_n %%(if rpm -q kernel-source-nvidia470 >/dev/null 2>&1; then rpm -q --qf '%%{version}' kernel-source-nvidia470 | awk -F '.' '{print $2}'; else echo 0; fi)
# For SRPM stage when auto-krokodil-rpm-macros is not installed
#{?!kroko_req_modules_in_kernel:%%define kroko_req_modules_in_kernel(j:n:p:) %%{nil}}
#endif
############################################################################
# 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}
%{?_with_modxz: %global build_modxz 0}
# Build defines
%define build_doc 1
%define build_devel 1
%define build_debug 1
# Build kernel-headers package
%define build_headers 1
# Build perf and cpupower tools
%define build_perf 1
%define build_cpupower 1
%if %{with compress_modules}
%if %{with modxz}
%define kmod_suffix .xz
%else
%define kmod_suffix .zst
%endif
%else
%define kmod_suffix %{nil}
%endif
%if !%{build_debug}
# Disable debug rpms.
%define _enable_debug_packages %{nil}
%define debug_package %{nil}
%endif
# End of user definitions
# 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: https://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}}
Source4: macros.nvidia
%{load:%{SOURCE4}}
# Kernel configuration files.
Source111: kernel-x86_64.config
Source112: kernel-i686.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
Patch2: kernel-5.10.93-fix-perf-build.patch
# 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
%if %{with aufs}
# AUFS 5 from http://aufs.sourceforge.net/
Patch109: 0001-Apply-AUFS-5.patch
%endif
# 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.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
# http://git.altlinux.org/gears/k/kernel-image-std-def.git
# https://github.com/asheplyakov/linux/commits/baikalm-5.15.y-next (many thanks!)
Patch0600: 0600-drm-panfrost-initial-dual-core-group-GPUs-support.patch
Patch0601: 0601-net-stmmac-inital-support-of-Baikal-T1-M-SoCs-GMAC.patch
Patch0602: 0602-dt-bindings-dwmac-Add-bindings-for-Baikal-T1-M-SoCs.patch
Patch0603: 0603-net-stmmac-custom-mdio-reset-for-some-Baikal-M-board.patch
Patch0604: 0604-net-dwmac-baikal-added-compatible-strings.patch
Patch0605: 0605-hwmon-bt1-pvt-access-registers-via-pvt_-readl-writel.patch
Patch0606: 0606-hwmon-bt1-pvt-define-pvt_readl-pvt_writel-for-Baikal.patch
Patch0607: 0607-hwmon-bt1-pvt-adjusted-probing-for-Baikal-M-SoC.patch
Patch0608: 0608-hwmon-bt1-pvt-added-compatible-baikal-pvt.patch
Patch0609: 0609-clk-added-Baikal-M-clock-management-unit-driver.patch
Patch0610: 0610-cpufreq-dt-don-t-load-on-Baikal-M-SoC.patch
Patch0611: 0611-usb-dwc3-of-simple-added-compatible-string-for-Baika.patch
Patch0612: 0612-arm64-Enable-armv8-based-Baikal-M-SoC-support.patch
Patch0613: 0613-drm-bridge-New-bridge-driver-stdp4028.patch
Patch0614: 0614-drm-added-Baikal-M-SoC-video-display-unit-driver.patch
Patch0615: 0615-baikal_vdu-et101-display-port-support.patch
Patch0616: 0616-dw-hdmi-ahb-audio-support-Baikal-M-SoC.patch
Patch0617: 0617-ALSA-hda-Baikal-M-SoC-support.patch
Patch0618: 0618-Added-TF307-TF306-board-management-controller-driver.patch
Patch0619: 0619-rejected-serial-8250_dw-verify-clock-rate-in-dw8250_.patch
Patch0620: 0620-drm-panfrost-forcibly-set-dma-coherent-on-Baikal-M.patch
Patch0621: 0621-drm-panfrost-disable-devfreq-on-Baikal-M.patch
Patch0622: 0622-pm-disable-all-sleep-states-on-Baikal-M-based-boards.patch
Patch0623: 0623-arm64-stub-fixed-secondary-cores-boot-on-Baikal-M-So.patch
Patch0624: 0624-efi-rtc-avoid-calling-efi.get_time-on-Baikal-M-SoC.patch
Patch0625: 0625-net-fwnode_get_phy_id-consider-all-compatible-string.patch
Patch0626: 0626-BROKEN-dwc-i2s-support-Baikal-M-SoC.patch
Patch0627: 0627-input-added-TF307-serio-PS-2-emulator-driver.patch
Patch0628: 0628-arm64-added-Baikal-M-SoC-and-TF307-board-device-tree.patch
Patch0629: 0629-arm64-device-tree-baikal-mark-GPU-as-dma-coherent.patch
Patch0630: 0630-arm64-device-tree-Baikal-M-fixed-PHY-binding-descrip.patch
Patch0631: 0631-arm64-device-tree-Baikal-M-fixed-gpio-alias.patch
Patch0632: 0632-arm64-device-tree-Baikal-M-fixed-GPU-opp_table.patch
Patch0633: 0633-arm64-device-tree-Baikal-M-fixed-CPUs-opp_table.patch
Patch0634: 0634-arm64-defconfig-for-Baikal-M-support-testing.patch
# Disable AutoReq
AutoReq: 0
# but keep autoprov for kmod(xxx)
AutoProv: 1
BuildRequires: bash
BuildRequires: bc
BuildRequires: binutils
BuildRequires: bison
BuildRequires: bzip2
%if %{with ccache}
BuildRequires: ccache
%endif
BuildRequires: flex
BuildRequires: gcc
# ./scripts/mkcompile_h
BuildRequires: hostname
BuildRequires: kmod-compat
BuildRequires: rsync
%if %{with compress_modules}
%if %{with modxz}
BuildRequires: xz
%else
BuildRequires: zstd
%endif
%endif
%ifarch aarch64
BuildRequires: uboot-tools
%endif
BuildRequires: kmod-devel
%ifarch x86_64 aarch64
BuildRequires: numa-devel
%endif
%if %{with uml}
BuildRequires: vde-devel
%endif
# For power tools
BuildRequires: pkgconfig(ncurses)
# For perf, cpufreq and all other tools
# For cpupower
%if %{build_cpupower}
BuildRequires: pciutils-devel
%endif
# For perf
%if %{build_perf}
BuildRequires: asciidoc
BuildRequires: perl-ExtUtils-Embed
BuildRequires: python3
BuildRequires: xmlto
BuildRequires: audit-devel
BuildRequires: binutils-devel
BuildRequires: elfutils-devel
BuildRequires: java-1.8.0-openjdk-devel
BuildRequires: libunwind-devel
BuildRequires: newt-devel
BuildRequires: perl-devel
BuildRequires: pkgconfig(babeltrace)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(python3)
BuildRequires: pkgconfig(slang)
BuildRequires: pkgconfig(zlib)
%endif
# (To generate keys)
# LibreSSL has GOST support without editing openssl.cnf
# or dlopen()-ing external library
BuildRequires: libressl
BuildRequires: libressl-devel
# To verify signatures (find, xargs, hexdump)
BuildRequires: findutils
BuildRequires: util-linux
%if %{with binary_extra_modules}
BuildRequires: auto-krokodil-rpm-macros
BuildRequires: kernel-source-rtl8821ce
BuildRequires: kernel-source-rtl8821cu
# Broadcom-wl and nvidia390 contain a proprietary blob which is only for x86
%ifarch %{ix86} %{x86_64}
BuildRequires: kernel-source-broadcom-wl
BuildRequires: kernel-source-nvidia390
%endif
# Nvidia470+ are x86_64 only (maybe aarch64 will be also packaged later)
%ifarch %{x86_64}
BuildRequires: kernel-source-nvidia470
BuildRequires: kernel-source-nvidia510
BuildRequires: kernel-source-nvidia515
%endif
BuildRequires: kernel-source-tripso
BuildRequires: kernel-source-ipt-so
%if %{with binary_virtualbox_host}
BuildRequires: kernel-source-virtualbox
%endif
BuildRequires: kernel-source-v4l2loopback
%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
# End of with binary_extra_modules
Provides: kernel = %{EVRD}
Provides: kernel-%{flavour} = %{EVRD}
Provides: kernel-abi(%{kver_full}) = %{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
# Need for rebuild dkms drivers
Requires: (kernel-%{tar_ver}-generic-devel if dkms)
# Usually necessary, but sometimes user may want to not install them
Recommends: crda
Recommends: linux-firmware
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
Recommends: wireless-regdb
%if %{with flow_abi}
Requires: kernel-%{kernelversion}.%{patchlevel}-rosa-flow-abi
%endif
%ifarch %{ix86}
Conflicts: arch(x86_64)
%endif
# XXX temporary hack to upgrade from kernel-headers 1:5.4
%if %{build_headers}
Recommends: kernel-headers = %{EVRD}
%endif
%if %{with binary_extra_modules}
%ifarch %{ix86} %{x86_64}
#kroko_req_modules_in_kernel -j %%{nvidia_390_j} -n %%{nvidia_390_n} -p %%{kver_full}
Requires: ((kernel-modules-nvidia390-%{version}-%{release}-%{flavour} = %{EVRD}) if nvidia390-core)
%endif
%ifarch %{x86_64}
#kroko_req_modules_in_kernel -j %%{nvidia_470_j} -n %%{nvidia_470_n} -p %%{kver_full}
Requires: ((kernel-modules-nvidia470-%{version}-%{release}-%{flavour} = %{EVRD}) if nvidia470-core)
Requires: ((kernel-modules-nvidia510-%{version}-%{release}-%{flavour} = %{EVRD}) if nvidia510-core)
Requires: ((kernel-modules-nvidia515-%{version}-%{release}-%{flavour} = %{EVRD}) if nvidia515-core)
%endif
%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.
dracut -f %{initrd_path} %{kver_full}
# File triggers from grub packages will handle this.
#/usr/sbin/update-grub2
%transfiletriggerin -- %{_modulesdir}/%{kver_full}
# Detect all modules, including ones inside kernel-module* packages
if grep -qE '/.*\.ko(|\..*)' ; then
depmod -a %{kver_full}
fi
%transfiletriggerpostun -- %{_modulesdir}/%{kver_full}
# Handle e.g. removal of kernel-module* packages
# List of files is not available here (?)
depmod -a %{kver_full}
%files -f %{kernel_files}
%{_bootdir}/System.map-%{kver_full}
%{_bootdir}/symvers-%{kver_full}.*
%{_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}
%exclude %{_modulesdir}/%{kver_full}/kernel/net/wireless/8821cu.ko%{kmod_suffix}
%ifarch %{ix86} %{x86_64}
%exclude %{_modulesdir}/%{kver_full}/kernel/net/wireless/wl.ko%{kmod_suffix}
%exclude %{_modulesdir}/%{kver_full}/kernel/drivers/video/nvidia390
%endif
%ifarch %{x86_64}
%exclude %{_modulesdir}/%{kver_full}/kernel/drivers/video/nvidia470
%exclude %{_modulesdir}/%{kver_full}/kernel/drivers/video/nvidia510
%exclude %{_modulesdir}/%{kver_full}/kernel/drivers/video/nvidia515
%endif
%if %{with binary_shredder}
%exclude %{_modulesdir}/%{kver_full}/kernel/extra/shredder-kernel.ko%{kmod_suffix}
%endif
%exclude %{_modulesdir}/%{kver_full}/kernel/drivers/media/v4l2loopback.ko%{kmod_suffix}
%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
# End of with binary_extra_modules
############################################################################
%if %{build_devel}
%package devel
Summary: Development files for %{name}
Group: Development/Kernel
Requires: glibc-devel
Requires: ncurses-devel
Requires: gcc
Requires: make
Requires: perl
Requires: %{name} = %{EVRD}
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
# End of 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
# End of 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
%{_includedir}/perf/perf_dlfilter.h
%dir %{_prefix}/libexec/perf-core
%dir %{_libdir}/traceevent
%dir %{_libdir}/traceevent/plugins
%{_libdir}/libperf-jvmti.so
%{_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
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
%{_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*
############################################################################
%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
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
%if %{build_perf}
%exclude %{_includedir}/perf/perf_dlfilter.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
# End of uml
#-----------------------------------------------------------------------------
###############################
# Extra modules package definitions
%if %{with binary_extra_modules}
%ksob_mk_module_pkg -n 8821ce -s net/wireless -r rtl8821ce-blacklist
%ksob_mk_module_pkg -n 8821cu -s net/wireless
%ifarch %{ix86} %{x86_64}
%ksob_mk_module_pkg -n wl -s net/wireless -r broadcom-wl-aliases
#kroko_kmod_pkg -j %%{nvidia_390_j} -n %%{nvidia_390_n} -f %%{flavour} -k %%{kernelversion}.%%{patchlevel} -m %%{sublevel} -p %%{kver_full} -s %%{NAME} -r %%{kroko_mk_release}
%endif
%ifarch %{ix86}
%nvidia_modules_pkg -e %{EVRD} -m 390 -p %{kver_full}
%endif
%ifarch %{x86_64}
#kroko_kmod_pkg -j %%{nvidia_470_j} -n %%{nvidia_470_n} -f %%{flavour} -k %%{kernelversion}.%%{patchlevel} -m %%{sublevel} -p %%{kver_full} -s %%{NAME} -r %%{kroko_mk_release}
%nvidia_modules_pkg -e %{EVRD} -m 390,470,510,515 -p %{kver_full}
%endif
%ksob_mk_module_pkg -n xt_TRIPSO -s net -r tripso
%ksob_mk_module_pkg -n xt_so -s net -r ipt-so
%ksob_mk_module_pkg -n v4l2loopback -s drivers/media -r v4l2loopback
%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
#End of 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
# End of 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
# End of 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
# Disable debug info if requested (enabled by default)
%if ! %build_debug
sed -i -e '/CONFIG_DEBUG_INFO/d' -e '/CONFIG_GDB_SCRIPTS/d' .config
echo '# CONFIG_DEBUG_INFO is not set' >> %{build_dir}/.config.append
echo '# CONFIG_GDB_SCRIPTS is not set' >> %{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
##################
# End of kernel 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
# Versionize python shebang (#!/usr/bin/env python -> #!/usr/bin/python3) in scripts
sed -i '1 s,^#!/usr/bin/env python$,#!%{__python3},' \
scripts/bloat-o-meter \
scripts/checkkconfigsymbols.py \
scripts/diffconfig \
scripts/jobserver-exec \
scripts/show_delta \
scripts/spdxcheck.py \
scripts/clang-tools/gen_compile_commands.py \
scripts/clang-tools/run-clang-tools.py \
scripts/tracing/draw_functrace.py \
tools/hv/vmbus_testing \
tools/kvm/kvm_stat/kvm_stat \
tools/perf/python/tracepoint.py \
tools/perf/python/twatch.py \
tools/power/pm-graph/bootgraph.py \
tools/power/pm-graph/sleepgraph.py \
tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py \
tools/testing/kunit/kunit.py \
tools/testing/kunit/kunit_tool_test.py \
tools/testing/selftests/bpf/test_offload.py \
tools/testing/selftests/drivers/net/mlxsw/sharedbuffer_configuration.py \
tools/testing/selftests/exec/binfmt_script \
tools/testing/selftests/net/devlink_port_split.py \
tools/testing/selftests/tc-testing/tdc.py \
tools/testing/selftests/tc-testing/tdc_batch.py \
tools/testing/selftests/tc-testing/tdc_multibatch.py \
Documentation/sphinx/kernel_include.py \
Documentation/sphinx/maintainers_include.py \
Documentation/sphinx/rstFlatTable.py \
Documentation/target/tcm_mod_builder.py
# Drop env from bash scripts
sed -i '1 s,^#!.*env .*,#!%{_bindir}/bash,' scripts/config
# Drop env from perl scripts
sed -i '1 s,^#!.*env .*,#!%{_bindir}/perl,' \
scripts/bootgraph.pl \
scripts/checkincludes.pl \
scripts/checkkconfigsymbols.py \
scripts/checkpatch.pl \
scripts/checkstack.pl \
scripts/checkversion.pl \
scripts/cleanfile \
scripts/cleanpatch \
scripts/documentation-file-ref-check \
scripts/export_report.pl \
scripts/extract-module-sig.pl \
scripts/extract-sys-certs.pl \
scripts/extract_xc3028.pl \
scripts/get_abi.pl \
scripts/get_dvb_firmware \
scripts/get_maintainer.pl \
scripts/headerdep.pl \
scripts/headers_check.pl \
scripts/kernel-doc \
scripts/leaking_addresses.pl \
scripts/markup_oops.pl \
scripts/profile2linkerlist.pl \
scripts/recordmcount.pl \
scripts/split-man.pl \
scripts/stackdelta \
scripts/dtc/dt_to_config \
scripts/kconfig/streamline_config.pl \
tools/testing/ktest/compare-ktest-sample.pl \
tools/testing/selftests/kselftest/prefix.pl \
Documentation/sphinx/parse-headers.pl
############################################################################
%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
# End of 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/rtl8821cu-%%{VERSION}-%%{RELEASE}' kernel-source-rtl8821cu)" kernel-source-rtl8821cu
pushd kernel-source-rtl8821cu
%kmake KSRC=%{src_dir} M="$PWD"
mkdir -p %{temp_modules}/%{kver_full}/kernel/net/wireless/
cp 8821cu.ko %{temp_modules}/%{kver_full}/kernel/net/wireless/8821cu.ko
popd
rm -fr kernel-source-rtl8821cu
_build_nvidia(){
cp -r "$(rpm -q --qf "/usr/src/nvidia${1}-%%{VERSION}-%%{RELEASE}" kernel-source-nvidia${1})" kernel-source-nvidia${1}
pushd kernel-source-nvidia${1}
%make SYSSRC=%{src_dir}
mkdir -p %{temp_modules}/%{kver_full}/kernel/drivers/video/nvidia${1}
cp *.ko %{temp_modules}/%{kver_full}/kernel/drivers/video/nvidia${1}
popd
rm -fr kernel-source-nvidia${1}
}
%ifarch %{ix86} %{x86_64}
cp -r "$(rpm -q --qf '/usr/src/broadcom-wl-%%{VERSION}-%%{RELEASE}' kernel-source-broadcom-wl)" kernel-source-broadcom-wl
pushd kernel-source-broadcom-wl
%kmake -C %{src_dir} M="$PWD"
mkdir -p %{temp_modules}/%{kver_full}/kernel/net/wireless/
cp wl.ko %{temp_modules}/%{kver_full}/kernel/net/wireless/wl.ko
popd
rm -fr kernel-source-broadcom-wl
_build_nvidia 390
%endif
%ifarch %{x86_64}
_build_nvidia 470
_build_nvidia 510
_build_nvidia 515
%endif
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
cp -r "$(rpm -q --qf '/usr/src/v4l2loopback-%%{VERSION}-%%{RELEASE}' kernel-source-v4l2loopback)" kernel-source-v4l2loopback
pushd kernel-source-v4l2loopback
cat Kbuild > Makefile
mkdir -p %{temp_modules}/%{kver_full}/kernel/drivers/media
make -C %{src_dir} M="$PWD" modules
cp v4l2loopback.ko %{temp_modules}/%{kver_full}/kernel/drivers/media
pushd
rm -fr kernel-source-v4l2loopback
%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
# End with nickel <- with binary_extra_modules
%endif
# End 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}
%if %{with modxz}
xz -c Module.symvers > %{temp_boot}/symvers-%{kver_full}.xz
%else
%{zstd_cmd} Module.symvers
install -m 644 Module.symvers.zst %{temp_boot}/symvers-%{kver_full}.zst
%endif
%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/
%if %{with aufs}
# aufs2 has a special file needed
cp -fR fs/aufs/magic.mk %{temp_devel_root}/fs/aufs
%endif
# 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
# End of build_devel
# 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
# End of 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}
#if %%{with oblig_signed_modules}
# 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}
#endif
# 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
%if %{with modxz}
find %{target_modules} -name "*.ko" | %kxargs xz -6e
%else
find %{target_modules} -name "*.ko" | %kxargs %{zstd_cmd} --rm -T1 #-D dictionary
rm -f dictionary
%endif
%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
# End of 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 '1 s,^#!/usr/bin/env python$,#!%{__python3},' \
%{buildroot}%{_prefix}/libexec/perf-core/scripts/python/exported-sql-viewer.py \
%{buildroot}%{_prefix}/libexec/perf-core/scripts/python/libxed.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
# Drop hidden files
rm -f %{buildroot}%{_docdir}/kernel-5.10-generic-doc/devicetree/bindings/.yamllint
# Fix perms
chmod -x %{buildroot}%{_sysconfdir}/bash_completion.d/perf
chmod -x %{buildroot}%{_prefix}/lib/perf/examples/bpf/*.c
chmod -x %{buildroot}%{_prefix}/lib/perf/include/bpf/*.h
chmod -x %{buildroot}%{_prefix}/lib/perf/include/bpf/linux/*.h
chmod -x %{buildroot}%{_datadir}/doc/perf-tip/*.txt