kernel-5.15/kernel.spec
Mikhail Novosyolov dc279182d3 [bot] upd: 5.10.65 -> 5.10.70
Changelog:

9p/trans_virtio: Remove sysfs file on probe failure
9p/xen: Fix end of loop tests for list_for_each_entry
afs: Fix incorrect triggering of sillyrename on 3rd-party invalidation
afs: Fix updating of i_blocks on file/dir extension
alpha: Declare virt_to_phys and virt_to_bus parameter as pointer to volatile
amd/display: downgrade validation failure log level
ARC: export clear_user_page() for modules
arm64: dts: allwinner: h6: tanix-tx6: Fix regulator node names
arm64: dts: ls1046a: fix eeprom entries
arm64: dts: qcom: ipq6018: drop '0x' from unit address
arm64: dts: qcom: ipq8074: fix pci node reg property
arm64: dts: qcom: msm8994: don't use underscore in node name
arm64: dts: qcom: msm8996: don't use underscore in node name
arm64: dts: qcom: sdm630: don't use underscore in node name
arm64: dts: qcom: sdm630: Fix TLMM node and pinctrl configuration
arm64: dts: qcom: sdm630: Rewrite memory map
arm64: dts: qcom: sdm660: use reg value for memory node
arm64: dts: qcom: sm8250: Fix epss_l3 unit address
arm64: head: avoid over-mapping in map_memory
arm64: Mark __stack_chk_guard as __ro_after_init
arm64: mm: Fix TLBI vs ASID rollover
arm64/sve: Use correct size when reinitialising SVE state
arm64: tegra: Fix compatible string for Tegra132 CPUs
arm64: tegra: Fix Tegra194 PCIe EP compatible string
ARM: 9077/1: PLT: Move struct plt_entries definition to header
ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link()
ARM: 9079/1: ftrace: Add MODULE_PLTS support
ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE
ARM: 9105/1: atags_to_fdt: don't warn about stack size
ARM: dts: at91: use the right property for shutdown controller
ARM: dts: imx53-ppd: Fix ACHC entry
ARM: dts: qcom: apq8064: correct clock names
ARM: dts: stm32: Set {bitclock,frame}-master phandles on DHCOM SoM
ARM: dts: stm32: Set {bitclock,frame}-master phandles on ST DKx
ARM: dts: stm32: Update AV96 adv7513 node per dtbs_check
ARM: Qualify enabling of swiotlb_init()
ARM: tegra: acer-a500: Remove bogus USB VBUS regulators
ARM: tegra: tamonten: Fix UART pad setting
ASoC: atmel: ATMEL drivers don't need HAS_DMA
ASoC: Intel: bytcr_rt5640: Move "Platform Clock" routes to the maps for the matching in-/output
ASoC: Intel: Skylake: Fix module configuration for KPB and MIXER
ASoC: Intel: Skylake: Fix passing loadable flag for module
ASoC: Intel: update sof_pcm512x quirks
ASoC: rockchip: i2s: Fix regmap_ops hang
ASoC: rockchip: i2s: Fixup config for DAIFMT_DSP_A/B
ata: sata_dwc_460ex: No need to call phy_exit() befre phy_init()
ath9k: fix OOB read ar9300_eeprom_restore_internal
ath9k: fix sleeping in atomic context
atlantic: Fix issue in the pm resume flow.
backlight: ktd253: Stabilize backlight
binder: make sure fd closes complete
blk-cgroup: fix UAF by grabbing blkcg lock before destroying blkg pd
blk-mq: allow 4x BLK_MAX_REQUEST_COUNT at blk_plug for multiple_queues
blk-mq: avoid to iterate over stale request
blk-throttle: fix UAF by deleteing timer in blk_throtl_exit()
blktrace: Fix uaf in blk_trace access after removing by sysfs
blk-zoned: allow BLKREPORTZONE without CAP_SYS_ADMIN
blk-zoned: allow zone management send operations without CAP_SYS_ADMIN
block: bfq: fix bfq_set_next_ioprio_data()
block, bfq: honor already-setup queue merges
block: check if a profile is actually registered in blk_integrity_unregister
block: flush the integrity workqueue in blk_integrity_unregister
Bluetooth: avoid circular locks in sco_sock_connect
Bluetooth: Fix handling of LE Enhanced Connection Complete
Bluetooth: schedule SCO timeouts with delayed_work
Bluetooth: skip invalid hci_sync_conn_complete_evt
bnx2x: Fix enabling network interfaces without VFs
bnxt_en: Consolidate firmware reset event logging.
bnxt_en: Convert to use netif_level() helpers.
bnxt_en: Fix asic.rev in devlink dev info command
bnxt_en: Fix error recovery regression
bnxt_en: Fix possible unintended driver initiated error recovery
bnxt_en: fix stored FW_PSID version masks
bnxt_en: Fix TX timeout when TX ring size is set to the smallest
bnxt_en: Improve logging of error recovery settings information.
bnxt_en: log firmware debug notifications
bnxt_en: make bnxt_free_skbs() safe to call after bnxt_free_mem()
bonding: 3ad: fix the concurrency between __bond_release_one() and bond_3ad_state_machine_handler()
bpf: Add oversize check before call kvcalloc()
bpf/tests: Do not PASS tests without actually testing the result
bpf/tests: Fix copy-and-paste error in double word test
btrfs: fix lockdep warning while mounting sprout fs
btrfs: fix upper limit for max_inline for page size 64K
btrfs: prevent __btrfs_dump_space_info() to underflow its free space
btrfs: reset replace target device to allocation state on close
btrfs: tree-log: check btrfs_lookup_data_extent return value
btrfs: update the bdev time directly when closing
btrfs: wake up async_delalloc_pages waiters after submit
bus: fsl-mc: fix mmio base address for child DPRCs
ceph: allow ceph_put_mds_session to take NULL or ERR_PTR
ceph: cancel delayed work instead of flushing on mdsc teardown
ceph: fix dereference of null pointer cf
ceph: lockdep annotations for try_nonblocking_invalidate
ceph: remove the capsnaps when removing caps
ceph: request Fw caps before updating the mtime in ceph_write_iter
cifs: fix a sign extension bug
cifs: fix incorrect check for null pointer in header_assemble
cifs: fix wrong release in sess_alloc_buffer() failed path
clk: at91: clk-generated: Limit the requested rate to our range
clk: imx8m: fix clock tree update of TF-A managed clocks
clk: rockchip: drop GRF dependency for rk3328/rk3036 pll types
clk: socfpga: agilex: add the bypass register for s2f_usr0 clock
clk: socfpga: agilex: fix the parents of the psi_ref_clk
clk: socfpga: agilex: fix up s2f_user0_clk representation
comedi: Fix memory leak in compat_insnlist()
compiler.h: Introduce absolute_pointer macro
console: consume APC, DM, DCS
coredump: fix memleak in dump_vma_snapshot()
cpufreq: intel_pstate: Override parameters if HWP forced by BIOS
cpufreq: powernv: Fix init_chip_info initialization in numa=off
cpuidle: pseries: Fixup CEDE0 latency only for POWER10 onwards
cpuidle: pseries: Mark pseries_idle_proble() as __init
crypto: ccp - shutdown SEV firmware on kexec
crypto: mxs-dcp - Use sg_mapping_iter to copy data
crypto: public_key: fix overflow during implicit conversion
dccp: don't duplicate ccid when cloning dccp sock
dma-buf: DMABUF_MOVE_NOTIFY should depend on DMA_SHARED_BUFFER
dma-debug: fix debugfs initialization order
dmaengine: acpi: Avoid comparison GSI with Linux vIRQ
dmaengine: idxd: depends on !UML
dmaengine: idxd: fix wq slot allocation index check
dmaengine: imx-sdma: remove duplicated sdma_load_context
dmaengine: ioat: depends on !UML
dmaengine: sprd: Add missing MODULE_DEVICE_TABLE
dmaengine: xilinx_dma: Set DMA mask for coherent APIs
dm crypt: Avoid percpu_counter spinlock contention in crypt_page_alloc()
docs: Fix infiniband uverbs minor number
drivers: base: cacheinfo: Get rid of DEFINE_SMP_CALL_CACHE_FUNCTION()
drm/amd/amdgpu: Increase HWIP_MAX_INSTANCE to 10
drm/amd/amdgpu: Update debugfs link_settings output link_rate field in hex
drm/amd/display: fix incorrect CM/TF programming sequence in dwb
drm/amd/display: fix missing writeback disablement if plane is removed
drm/amd/display: Fix timer_per_pixel unit error
drm/amd/display: Update bounding box states (v2)
drm/amd/display: Update number of DCN3 clock states
drm/amdgpu: Disable PCIE_DPM on Intel RKL Platform
drm/amdgpu: Fix amdgpu_ras_eeprom_init()
drm/amdgpu: Fix a printing message
drm/amdgpu: Fix BUG_ON assert
drm/amdkfd: Account for SH/SE count when setting up cu masks.
drm/amd/pm: Update intermediate power state for SI
drm: avoid blocking in drm_clients_info's rcu section
drm/bridge: lt9611: Fix handling of 4k panels
drm/bridge: nwl-dsi: Avoid potential multiplication overflow on 32-bit
drm/display: fix possible null-pointer dereference in dcn10_set_clock()
drm/dp_mst: Fix return code on sideband message failure
drm/etnaviv: add missing MMU context put when reaping MMU mapping
drm/etnaviv: exec and MMU state is lost when resetting the GPU
drm/etnaviv: fix MMU context leak on GPU reset
drm/etnaviv: keep MMU context across runtime suspend/resume
drm/etnaviv: put submit prev MMU context when it exists
drm/etnaviv: reference MMU context when setting up hardware state
drm/etnaviv: return context from etnaviv_iommu_context_get
drm/etnaviv: stop abusing mmu_context as FE running marker
drm/exynos: Always initialize mapping in exynos_drm_register_dma()
drm/mgag200: Select clock in PLL update functions
drm/msi/mdp4: populate priv->kms in mdp4_kms_init
drm/msm/dp: return correct edid checksum after corrupted edid checksum read
drm/msm/dsi: Fix DSI and DSI PHY regulator config from SDM660
drm/msm: mdp4: drop vblank get/put from prepare/complete_commit
drm/nouveau/nvkm: Replace -ENOSYS with -ENODEV
drm/panfrost: Clamp lock region to Bifrost minimum
drm/panfrost: Make sure MMU context lifetime is not bound to panfrost_priv
drm/panfrost: Simplify lock_region calculation
drm/panfrost: Use u64 for size in lock_region
drm: protect drm_master pointers in drm_lease.c
drm/rockchip: cdn-dp-core: Make cdn_dp_core_resume __maybe_unused
drm: serialize drm_file.master with a new spinlock
drm/vc4: hdmi: Set HD_CTL_WHOLSMP and HD_CTL_CHALIGN_SET
drm/vmwgfx: fix potential UAF in vmwgfx_surface.c
drm: xlnx: zynqmp_dpsub: Call pm_runtime_get_sync before setting pixel clock
drm: xlnx: zynqmp: release reset to DP controller before accessing DP registers
dt-bindings: arm: Fix Toradex compatible typo
dt-bindings: mtd: gpmc: Fix the ECC bytes vs. OOB bytes equation
EDAC/dmc520: Assign the proper type to dimm->edac_mode
EDAC/synopsys: Fix wrong value type assignment for edac_mode
enetc: Fix illegal access when reading affinity_hint
enetc: Fix uninitialized struct dim_sample field usage
erofs: fix up erofs_lookup tracepoint
ethtool: Fix an error code in cxgb2.c
ethtool: Fix rxnfc copy to user buffer overflow
ethtool: improve compat ioctl handling
events: Reuse value read using READ_ONCE instead of re-reading it
f2fs: deallocate compressed pages when error happens
f2fs: fix to account missing .skipped_gc_rwsem
f2fs: fix to do sanity check for sb/cp fields correctly
f2fs: fix to unmap pages from userspace process in punch_hole()
f2fs: fix unexpected ENOENT comes from f2fs_map_blocks()
f2fs: quota: fix potential deadlock
f2fs: reduce the scope of setting fsck tag when de->name_len is zero
f2fs: should put a page beyond EOF when preparing a write
fanotify: limit number of event merge attempts
fix array-index-out-of-bounds in taprio_change
flow_dissector: Fix out-of-bounds warnings
fpga: machxo2-spi: Fix missing error code in machxo2_write_complete()
fpga: machxo2-spi: Return an error on failure
fq_codel: reject silly quantum parameters
fscache: Fix cookie key hashing
fs/io_uring Don't use the return value from import_iovec().
fuse: fix use after free in fuse_read_interrupt()
gen_compile_commands: fix missing 'sys' package
gfs2: Don't call dlm after protocol is unmounted
gfs2: Fix glock recursion in freeze_go_xmote_bh
gpio: mpc8xxx: Fix a resources leak in the error handling path of 'mpc8xxx_probe()'
gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leak
gpio: uniphier: Fix void functions to remove return value
gpu: drm: amd: amdgpu: amdgpu_i2c: fix possible uninitialized-variable access in amdgpu_i2c_router_select_ddc_port()
habanalabs: add validity check for event ID received from F/W
HID: i2c-hid: Fix Elan touchpad regression
HID: input: do not report stylus battery state as "full"
hugetlb: fix hugetlb cgroup refcounting during vma split
hvsi: don't panic on tty_register_driver failure
hwmon: (pmbus/ibm-cffps) Fix write bits for LED control
iavf: do not override the adapter state in the watchdog task
iavf: fix locking of critical sections
IB/hfi1: Adjust pkey entry in index 0
ibmvnic: check failover_pending in login response
igc: Check if num of q_vectors is smaller than max before array access
iio: dac: ad5624r: Fix incorrect handling of an optional regulator.
iio: ltc2983: fix device probe
iomap: pass writeback errors to the mapping
iommu/amd: Relocate GAMSup check to early_enable_iommus
iommu/vt-d: Update the virtual command related registers
io_uring: add ->splice_fd_in checks
io_uring: ensure symmetry in handling iter types in loop_rw_iter()
io_uring: fail links of cancelled timeouts
io_uring: limit fixed table size by RLIMIT_NOFILE
io_uring: place fixed tables under memcg limits
io_uring: put provided buffer meta data under memcg accounting
io_uring: remove duplicated io_size from rw
io-wq: fix wakeup race when adding new work
ip_gre: validate csum_start only on pull
ipv4: ip_output.c: Fix out-of-bounds warning in ip_copy_addrs()
ipv6: delay fib6_sernum increase in fib6_add
irqchip/gic-v3-its: Fix potential VPE leak on error
irqchip/goldfish-pic: Select GENERIC_IRQ_CHIP to fix build
iwlwifi: fw: correctly limit to monitor dump
iwlwifi: mvm: avoid static queue number aliasing
iwlwifi: mvm: fix access to BSS elements
iwlwifi: mvm: fix a memory leak in iwl_mvm_mac_ctxt_beacon_changed
iwlwifi: mvm: Fix scan channel flags settings
iwlwifi: pcie: free RBs during configure
kbuild: Fix 'no symbols' warning when CONFIG_TRIM_UNUSD_KSYMS=y
Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH
kselftest/arm64: mte: Fix misleading output when skipping tests
kselftest/arm64: pac: Fix skipping of tests on systems without PAC
kselftest/arm64: signal: Add SVE to the set of features we can check for
kselftest/arm64: signal: Skip tests if required features are missing
KVM: arm64: Fix read-side race on updates to vcpu reset state
KVM: arm64: Handle PSCI resets before userspace touches vCPU state
KVM: arm64: Restrict IPA size to maximum 48 bits on 4K and 16K page size
KVM: PPC: Book3S HV: Fix copy_tofrom_guest routines
KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live
KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers
KVM: PPC: Fix clearing never mapped TCEs in realmode
libata: add ATA_HORKAGE_NO_NCQ_TRIM for Samsung 860 and 870 SSDs
libbpf: Fix race when pinning maps in parallel
libbpf: Fix reuse of pinned map on older kernel
libnvdimm/pmem: Fix crash triggered when I/O in-flight during unbind
lib/test_stackinit: Fix static initializer test
lockd: lockd server-side shouldn't set fl_ops
m68k: Double cast io functions to unsigned long
m68knommu: only set CONFIG_ISA_DMA_API for ColdFire sub-arch
mac80211: Fix monitor MTU limit so that A-MSDUs get through
mcb: fix error handling in mcb_alloc_bus()
md: fix a lock order reversal in md_alloc
media: atomisp: Fix runtime PM imbalance in atomisp_pci_probe
media: atomisp: pci: fix error return code in atomisp_pci_probe()
media: dib8000: rewrite the init prbs logic
media: hantro: vp8: Move noisy WARN_ON to vpu_debug
media: imx258: Limit the max analogue gain to 480
media: imx258: Rectify mismatch of VTS value
media: platform: stm32: unprepare clocks at handling errors in probe
media: rc-loopback: return number of emitters rather than error
media: TDA1997x: fix tda1997x_query_dv_timings() return value
media: tegra-cec: Handle errors of clk_prepare_enable()
media: uvc: don't do DMA on stack
media: v4l2-dv-timings.c: fix wrong condition in two for-loops
memcg: enable accounting for pids in nested pid namespaces
mfd: axp20x: Update AXP288 volatile ranges
mfd: db8500-prcmu: Adjust map to reality
mfd: Don't use irq_create_mapping() to resolve a mapping
mfd: lpc_sch: Partially revert "Add support for Intel Quark X1000"
mfd: lpc_sch: Rename GPIOBASE to prevent build error
mfd: tqmx86: Clear GPIO IRQ resource when no IRQ is set
MIPS: Malta: fix alignment of the devicetree buffer
mmc: core: Return correct emmc response in case of ioctl error
mmc: rtsx_pci: Fix long reads when clock is prescaled
mmc: sdhci-of-arasan: Check return value of non-void funtions
mmc: sdhci-of-arasan: Modified SD default speed to 19MHz for ZynqMP
mm: fix uninitialized use in overcommit_policy_handler
mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled
mm/hugetlb: initialize hugetlb_usage in mm_init
mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
mm,vmscan: fix divide by zero in get_scan_count
mtd: mtdconcat: Check _read, _write callbacks existence before assignment
mtd: mtdconcat: Judge callback existence based on the master
mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
net: 6pack: Fix tx timeout and slot time
net/af_unix: fix a data-race in unix_dgram_poll
net-caif: avoid user-triggerable WARN_ON(1)
net: dsa: b53: Fix calculating number of switch ports
net: dsa: b53: Fix IMP port setup on BCM5301x
net: dsa: b53: Set correct number of ports in the DSA struct
net: dsa: bcm_sf2: Fix array overrun in bcm_sf2_num_active_ports()
net: dsa: destroy the phylink instance on any error in dsa_slave_phy_setup
net: dsa: don't allocate the slave_mii_bus using devres
net: dsa: lantiq_gswip: fix maximum frame length
net: dsa: realtek: register the MDIO bus under devres
net: dsa: tag_rtl4_a: Fix egress tags
net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe()
netfilter: Fix fall-through warnings for Clang
netfilter: nft_ct: protect nft_ct_pcpu_template_refcnt with mutex
netfilter: socket: icmp6: fix use-after-scope
net: fix NULL pointer reference in cipso_v4_doi_free
net: Fix offloading indirect devices dependency on qdisc order creation
net: hns3: change affinity_mask to numa node range
net: hns3: check queue id range before using
net: hns3: clean up a type mismatch warning
net: hns3: disable mac in flr process
net: hns3: fix change RSS 'hfunc' ineffective issue
net: hns3: fix the timing issue of VF clearing interrupt sources
net: hns3: pad the short tunnel frame before sending to hardware
net: hso: add failure handler for add_net_device
net: hso: fix muxed tty registration
net: i825xx: Use absolute_pointer for memcpy from fixed memory location
net: ipa: initialize all filter table slots
net/l2tp: Fix reference count leak in l2tp_udp_recv_core
netlink: Deal with ESRCH error in nlmsg_notify()
net: macb: fix use after free on rmmod
net/mlx4_en: Don't allow aRFS for encapsulated packets
net/mlx5: DR, Enable QP retransmission
net/mlx5: DR, fix a potential use-after-free bug
net/mlx5: Fix potential sleeping in atomic context
net/mlx5: Fix variable type to match 64bit
net/mlx5: FWTrace, cancel work on alloc pd error flow
net/{mlx5|nfp|bnxt}: Remove unnecessary RTNL lock assert
net: phy: Fix data type in DP83822 dp8382x_disable_wol()
net: phylink: Update SFP selected interface on advertising changes
net: renesas: sh_eth: Fix freeing wrong tx descriptor
net/smc: add missing error check in smc_clc_prfx_set()
net/smc: fix 'workqueue leaked lock' in smc_conn_abort_work
net: stmmac: allow CSR clock of 300MHz
net: usb: cdc_mbim: avoid altsetting toggling for Telit LN920
net: w5100: check return value after calling platform_get_resource()
nfp: fix return statement in nfp_net_parse_meta()
nfsd: fix crash on LOCKT on reexported NFSv3
NFSv4/pNFS: Always allow update of a zero valued layout barrier
NFSv4/pNFS: Fix a layoutget livelock loop
NFSv4/pnfs: The layout barrier indicate a minimal value for the seqid
nilfs2: fix memory leak in nilfs_sysfs_create_device_group
nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group
nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group
nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group
nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group
nilfs2: fix NULL pointer in nilfs_##name##_attr_release
nilfs2: use refcount_dec_and_lock() to fix potential UAF
NTB: Fix an error code in ntb_msit_probe()
NTB: perf: Fix an error code in perf_setup_inbuf()
nvme: code command_id with a genctr for use-after-free validation
nvme: keep ctrl->namespaces ordered
nvmem: qfprom: Fix up qfprom_disable_fuse_blowing() ordering
nvme-multipath: fix ANA state updates when a namespace is not present
nvme-rdma: destroy cm id before destroy qp to avoid use after free
nvme-tcp: don't check blk_mq_tag_to_rq when receiving pdu data
nvme-tcp: fix incorrect h2cdata pdu offset accounting
nvme-tcp: fix io_work priority inversion
ocfs2: drop acl cache for directories too
octeontx2-af: Add additional register check to rvu_poll_reg()
octeontx2-pf: Fix NIX1_RX interface backpressure
of: Don't allow __of_attached_node_sysfs() without CONFIG_SYSFS
openrisc: don't printk() unconditionally
opp: Don't print an error if required-opps is missing
ovl: fix BUG_ON() in may_delete() when called from ovl_cleanup()
parisc: fix crash with signals and alloca
parisc: Move pci_dev_is_behind_card_dino to where it is used
parisc: Use absolute_pointer() to define PAGE0
parport: remove non-zero check on count
PCI: aardvark: Configure PCIe resources from 'ranges' DT property
PCI: aardvark: Fix checking for PIO status
PCI: aardvark: Fix masking and unmasking legacy INTx interrupts
PCI: aardvark: Fix reporting CRS value
PCI: aardvark: Increase polling delay to 1.5s while waiting for PIO response
PCI: Add ACS quirks for Cavium multi-function devices
PCI: Add ACS quirks for NXP LX2xx0 and LX2xx2 platforms
PCI: Add AMD GPU multi-function power dependencies
PCI: cadence: Add quirk flag to set minimum delay in LTSSM Detect.Quiet state
PCI: cadence: Use bitfield for *quirk_retrain_flag* instead of bool
PCI: Export pci_pio_to_address() for module use
PCI: Fix pci_dev_str_match_path() alloc while atomic bug
PCI: ibmphp: Fix double unmap of io_mem
PCI: iproc: Fix BCMA probe resource handling
PCI: j721e: Add PCIe support for AM64
PCI: j721e: Add PCIe support for J7200
PCI/MSI: Skip masking MSI-X on Xen PV
PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing 'ranges'
PCI: pci-bridge-emul: Add PCIe Root Capabilities Register
PCI/portdrv: Enable Bandwidth Notification only if port supports it
PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe()
PCI: Restrict ASMedia ASM1062 SATA Max Payload Size Supported
PCI: Return ~0 data on pciconfig_read() CAP_SYS_ADMIN failure
PCI: Sync __pci_register_driver() stub for CONFIG_PCI=n
PCI: tegra194: Fix handling BME_CHGED event
PCI: tegra194: Fix MSI-X programming
PCI: tegra: Fix OF node reference leak
PCI: Use pci_update_current_state() in pci_enable_device_flags()
PCI: xilinx-nwl: Enable the clock through CCF
perf bench inject-buildid: Handle writen() errors
perf machine: Initialize srcline string member in add_location struct
perf test: Fix bpf test sample mismatch reporting
perf tools: Allow build-id with trailing zeros
perf unwind: Do not overwrite FEATURE_CHECK_LDFLAGS-libunwind-{x86,aarch64}
pinctrl: armada-37xx: Correct PWM pins definitions
pinctrl: ingenic: Fix incorrect pull up/down info
pinctrl: remove empty lines in pinctrl subsystem
pinctrl: samsung: Fix pinctrl bank pin count
pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
pinctrl: stmfx: Fix hazardous u8[] to unsigned long cast
platform/chrome: cros_ec_proto: Send command again when timeout occurs
platform/chrome: cros_ec_trace: Fix format warnings
platform/chrome: sensorhub: Add trace events for sample
platform/x86: dell-smbios-wmi: Add missing kfree in error-exit from run_smbios_call
platform/x86/intel: punit_ipc: Drop wrong use of ACPI_PTR()
PM: base: power: don't try to use non-existing RTC for storing data
PM: sleep: core: Avoid setting power.must_resume to false
powerpc/config: Renable MTD_PHYSMAP_OF
powerpc/numa: Consider the max NUMA node for migratable LPAR
powerpc/perf/hv-gpci: Fix counter value parsing
powerpc/smp: Update cpu_core_map on all PowerPc systems
powerpc/stacktrace: Include linux/delay.h
power: supply: max17042: handle fails of reading status register
prctl: allow to setup brk for et_dyn executables
profiling: fix shift-out-of-bounds bugs
ptp: dp83640: don't define PAGE0
pwm: img: Don't modify HW state in .remove() callback
pwm: lpc32xx: Don't modify HW state in .probe() after the PWM chip was registered
pwm: mxs: Don't modify HW state in .probe() after the PWM chip was registered
pwm: rockchip: Don't modify HW state in .remove() callback
pwm: stm32-lp: Don't modify HW state in .remove() callback
qed: Handle management FW error
qed: rdma - don't wait for resources under hw error recovery flow
qlcnic: Remove redundant unlock in qlcnic_pinit_from_rom
qnx4: avoid stringop-overread errors
qnx4: work around gcc false positive warning bug
r6040: Restore MDIO clock frequency after MAC reset
rcu: Fix macro name CONFIG_TASKS_RCU_TRACE
RDMA/efa: Remove double QP type assignment
RDMA/hns: Fix QP's resp incomplete assignment
RDMA/iwcm: Release resources if iw_cm module initialization fails
RDMA/mlx5: Delete not-available udata check
Re-enable UAS for LaCie Rugged USB3-FW with fk quirk
Revert "block: nbd: add sanity check for first_minor"
Revert "Bluetooth: Move shutdown callback before flushing tx and rx queue"
Revert "dmaengine: imx-sdma: refine to load context only once"
Revert "net/mlx5: Register to devlink ingress VLAN filter trap"
Revert "posix-cpu-timers: Force next expiration recalc after itimer reset"
Revert "time: Handle negative seconds correctly in timespec64_to_ns()"
Revert "USB: bcma: Add a check for devm_gpiod_get"
Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set"
rpc: fix gss_svc_init cleanup on failure
rtc: rx8010: select REGMAP_I2C
rtc: tps65910: Correct driver module alias
rtl8xxxu: Fix the handling of TX A-MPDU aggregation
rtw88: use read_poll_timeout instead of fixed sleep
rtw88: wow: build wow function only if CONFIG_PM is on
rtw88: wow: fix size access error of probe request
s390/bpf: Fix 64-bit subtraction of the -0x80000000 constant
s390/bpf: Fix branch shortening during codegen pass
s390/bpf: Fix optimizing out zero-extensions
s390/jump_label: print real address in a case of a jump label bug
s390: make PCI mio support a machine flag
s390/pci_mmio: fully validate the VMA before calling follow_pte()
s390/pv: fix the forcing of the swiotlb
s390/qdio: cancel the ESTABLISH ccw after timeout
s390/qdio: fix roll-back after timeout on ESTABLISH ccw
s390/qeth: fix NULL deref in qeth_clear_working_pool_list()
s390/sclp: fix Secure-IPL facility detection
samples: bpf: Fix tracex7 error raised on the missing argument
sched/idle: Make the idle timer expire in hard interrupt context
scsi: bsg: Remove support for SCSI_IOCTL_SEND_COMMAND
scsi: BusLogic: Fix missing pr_cont() use
scsi: BusLogic: Use %X for u32 sized integer rather than %lX
scsi: fdomain: Fix error return code in fdomain_probe()
scsi: iscsi: Adjust iface sysfs attr detection
scsi: lpfc: Use correct scnprintf() limit
scsi: qedf: Fix error codes in qedf_alloc_global_queues()
scsi: qedi: Fix error codes in qedi_alloc_global_queues()
scsi: qla2xxx: Changes to support kdump kernel
scsi: qla2xxx: Restore initiator in dual mode
scsi: qla2xxx: Sync queue idx with queue_pair_map idx
scsi: sd_zbc: Ensure buffer size is aligned to SECTOR_SIZE
scsi: smartpqi: Fix an error code in pqi_get_raid_map()
scsi: target: Fix the pgr/alua_support_store functions
scsi: ufs: Fix memory corruption by ufshcd_read_desc_param()
scsi: ufs: ufs-exynos: Fix static checker warning
sctp: add param size validation for SCTP_PARAM_SET_PRIMARY
sctp: validate chunk size in __rcv_asconf_lookup
selftest: net: fix typo in altname test
selftests/bpf: Enlarge select() timeout for test_maps
selftests/bpf: Fix flaky send_signal test
selftests/bpf: Fix potential unreleased lock
selftests/bpf: Fix xdp_tx.c prog section name
selftests: firmware: Fix ignored return val of asprintf() warn
selftests/ftrace: Fix requirement check of README file
selftests: mptcp: clean tmp files in simult_flows
serial: 8250: 8250_omap: Fix RX_LVL register offset
serial: 8250: Define RX trigger levels for OxSemi 950 devices
serial: 8250_omap: Handle optional overrun-throttle-ms property
serial: 8250_pci: make setup_port() parameters explicitly unsigned
serial: mvebu-uart: fix driver's tx_empty callback
serial: sh-sci: fix break handling for sysrq
Set fc_nlinfo in nh_create_ipv4, nh_create_ipv6
Smack: Fix wrong semantics in smk_access_entry()
soc: aspeed: lpc-ctrl: Fix boundary check for mmap
soc: aspeed: p2a-ctrl: Fix boundary check for mmap
soc: mediatek: cmdq: add address shift in jump
soc: qcom: aoss: Fix the out of bound usage of cooling_devs
soundwire: intel: fix potential race condition during power down
sparc32: page align size in arch_dma_alloc
sparc: avoid stringop-overread errors
spi: Fix tegra20 build with CONFIG_PM=n
staging: board: Fix uninitialized spinlock when attaching genpd
staging: greybus: uart: fix tty use after free
staging: ks7010: Fix the initialization of the 'sleep_status' structure
staging: rtl8192u: Fix bitwise vs logical operator in TranslateRxSignalStuff819xUsb()
staging: rts5208: Fix get_ms_information() heap buffer size
SUNRPC: Fix potential memory corruption
sunrpc: Fix return value of get_srcport()
SUNRPC query transport's source port
SUNRPC/xprtrdma: Fix reconnection locking
tcp: enable data-less, empty-cookie SYN with TFO_SERVER_COOKIE_NOT_REQD
tcp: fix tp->undo_retrans accounting in tcp_sacktag_one()
thermal/core: Fix thermal_cooling_device_register() prototype
thermal/core: Potential buffer overflow in thermal_build_list_of_policies()
thermal/drivers/exynos: Fix an error code in exynos_tmu_probe()
thermal/drivers/int340x: Do not set a wrong tcc offset on resume
thunderbolt: Fix port linking by checking all adapters
tipc: fix an use-after-free issue in tipc_recvmsg
tipc: increase timeout in tipc_sk_enqueue()
tipc: keep the skb in rcv queue until the whole data is read
tools/bootconfig: Fix tracing_on option checking in ftrace2bconf.sh
tools lib: Adopt memchr_inv() from kernel
tools/thermal/tmon: Add cross compiling support
tracing/boot: Fix a hist trigger dependency for boot time tracing
tracing/probes: Reject events which have the same name of existing one
treewide: Change list_sort to use const pointers
tty: serial: jsm: hold port lock when reporting modem line changes
tty: synclink_gt, drop unneeded forward declarations
tty: synclink_gt: rename a conflicting function name
udp_tunnel: Fix udp_tunnel_nic work-queue type
um: virtio_uml: fix memory leak on init failures
USB: cdc-acm: fix minor-number release
usb: chipidea: host: fix port index underflow and UBSAN complains
usb: core: hcd: Add support for deferring roothub registration
usb: dwc2: gadget: Fix ISOC flow for BDMA and Slave
usb: dwc2: gadget: Fix ISOC transfer complete handling for DDMA
usb: dwc3: core: balance phy init and exit
USB: EHCI: ehci-mv: improve error handling in mv_ehci_enable()
usb: gadget: composite: Allow bMaxPower=0 if self-powered
usb: gadget: r8a66597: fix a loop in set_feature()
usb: gadget: u_ether: fix a potential null pointer dereference
usb: host: fotg210: fix the actual_length of an iso packet
usb: host: fotg210: fix the endpoint's transactional opportunities calculation
usbip: give back URBs for unsent unlink requests during cleanup
usbip:vhci_hcd USB port can get stuck in the disabled state
usb: musb: musb_dsps: request_irq() after initializing musb
usb: musb: tusb6010: uninitialized data in tusb_fifo_write_unaligned()
USB: serial: cp210x: add ID for GW Instek GDM-834x Digital Multimeter
USB: serial: cp210x: fix dropped characters with CP2102
USB: serial: mos7840: remove duplicated 0xac24 device ID
USB: serial: option: add device id for Foxconn T99W265
USB: serial: option: add Telit LN920 compositions
USB: serial: option: remove duplicate USB device ID
usb-storage: Add quirk for ScanLogic SL11R-IDE older than 2.6c
userfaultfd: prevent concurrent API initialization
vfio: Use config not menuconfig for VFIO_NOIOMMU
vhost_net: fix OoB on sendmsg() failure.
video: fbdev: asiliantfb: Error out if 'pixclock' equals zero
video: fbdev: kyro: Error out if 'pixclock' equals zero
video: fbdev: kyro: fix a DoS bug by restricting user input
video: fbdev: riva: Error out if 'pixclock' equals zero
VMCI: fix NULL pointer dereference when unmapping queue pair
watchdog: Start watchdog in watchdog_set_last_hw_keepalive only if appropriate
wcn36xx: Ensure finish scan is not requested before start scan
wcn36xx: Fix missing frame timestamp for beacon/probe-resp
workqueue: Fix possible memory leaks in wq_numa_init()
x86/asm: Add a missing __iomem annotation in enqcmds()
x86/asm: Fix SETZ size enqcmds() build failure
x86/hyperv: fix for unwanted manipulation of sched_clock when TSC marked unstable
x86/mce: Avoid infinite loop for copy from user recovery
x86/mm: Fix kern_addr_valid() to cope with existing but not present entries
x86/pat: Pass valid address to sanitize_phys()
x86/uaccess: Fix 32-bit __get_user_asm_u64() when CC_HAS_ASM_GOTO_OUTPUT=y
xen/balloon: fix balloon kthread freezing
xen/balloon: use a kernel thread instead a workqueue
xen: fix setting of max_pfn in shared_info
xen: reset legacy rtc flag for PV domU
xen/x86: fix PV trap handling on secondary processors
xhci: Set HCD flag to defer primary roothub registration
xtensa: ISS: don't panic in rs_init

Updated by kernel-updater-bot (https://abf.io/mikhailnov/kernel-updater-bot)
2021-10-03 13:59:50 +03:00

1614 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 70
# 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
%define build_headers 1
# 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
Patch0632: 0632-pm-disable-all-sleep-states-on-BE-M1000-based-boards.patch
Patch0633: 0633-BE-M1000-secondary-CPUs-boot-fix.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
# XXX temporary hack to upgrade from kernel-headers 1:5.4
%if %{build_headers}
Recommends: kernel-headers = %{EVRD}
%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
Provides: linux-userspace-headers = %{EVRD}
Provides: kernel-release-headers = %{EVRD}
# removed Epoch from this subpackage
Obsoletes: kernel-headers > 1:5.4
%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