Compiling Modified Kernel from Source

I'm having a problem with my WiFi adapter, and after speaking to the driver developer, it appears that I need to make a small alteration in /net/mac80211/rx.c to fix my problem (fix awaiting acceptance for kernel 5.17). I looked up tutorials on how to build and install a kernel, and ran into many, many issues while trying to follow them (not-for-Arch). Eventually I came to realize that apparently 'make install' doesn't work in Arch for kernels. Okay... so how do I build a kernel in Arch? Looks like I need to use asp and makepkg. Okay, let's follow the steps and... wait a minute... where is the source code? Does this build directly from the remote repo rather than a local one? What good does this do me?

So yeah, how do I build and install a kernel in Arch if I need to make a modification to the source? All I want to do is change a '9' into an '11' and rebuild/install the kernel. Why does the KISS principle distro make this so complicated? Could someone please point me in the direction of step-by-step instructions to accomplish this in Arch?

Kernel: 5.15.13-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
root=UUID=60f11ec2-6d13-4e3d-9fa0-deb8066646e2 rw [email protected]
quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
systemd.unified_cgroup_hierarchy=1 loglevel=3 sysrq_always_enabled=1
Desktop: KDE Plasma 5.23.5 tk: Qt 5.15.2 info: latte-dock wm: kwin_x11
vt: 1 dm: SDDM Distro: Garuda Linux base: Arch Linux
Type: Convertible System: HP product: HP ENVY x360 Convertible 15m-eu0xxx
v: N/A serial: <superuser required> Chassis: type: 31
serial: <superuser required>
Mobo: HP model: 888A v: 63.29 serial: <superuser required> UEFI: AMI
v: F.06 date: 07/28/2021
ID-1: BAT0 charge: 35.9 Wh (71.2%) condition: 50.4/50.4 Wh (100.0%)
volts: 11.7 min: 11.6 model: 333-AC-3A-A BN03051XL type: Li-ion
serial: <filter> status: Discharging cycles: 26
ID-2: hidpp_battery_0 charge: 27% condition: N/A volts: 3.7 min: N/A
model: Logitech G502 LIGHTSPEED Wireless Gaming Mouse type: N/A
serial: <filter> status: Discharging
Device-1: hid-0018:04F3:2CF9.0004-battery model: ELAN2514:00 04F3:2CF9
serial: N/A charge: N/A status: N/A
Info: model: AMD Ryzen 5 5500U with Radeon Graphics bits: 64 type: MT MCP
arch: Zen 2 family: 0x17 (23) model-id: 0x68 (104) stepping: 1
microcode: 0x8608103
Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 3 MiB desc: 6x512 KiB
L3: 8 MiB desc: 2x4 MiB
Speed (MHz): avg: 1402 high: 1466 min/max: 1400/4056 boost: enabled
scaling: driver: acpi-cpufreq governor: performance cores: 1: 1397 2: 1397
3: 1396 4: 1397 5: 1397 6: 1397 7: 1397 8: 1397 9: 1397 10: 1466 11: 1397
12: 1397 bogomips: 50304
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Type: itlb_multihit status: Not affected
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: spec_store_bypass
mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1
mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional,
IBRS_FW, STIBP: conditional, RSB filling
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Device-1: AMD Lucienne vendor: Hewlett-Packard driver: amdgpu v: kernel
bus-ID: 04:00.0 chip-ID: 1002:164c class-ID: 0300
Display: x11 server: X.Org compositor: kwin_x11 driver:
loaded: amdgpu,ati unloaded: modesetting alternate: fbdev,vesa
display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2")
s-diag: 582mm (22.9")
Monitor-1: eDP res: 1920x1080 hz: 60 dpi: 142 size: 344x194mm (13.5x7.6")
diag: 395mm (15.5")
OpenGL: renderer: AMD RENOIR (DRM 3.42.0 5.15.13-zen1-1-zen LLVM 13.0.0)
v: 4.6 Mesa 21.3.3 direct render: Yes
Device-1: AMD vendor: Hewlett-Packard driver: snd_hda_intel v: kernel
bus-ID: 04:00.1 chip-ID: 1002:1637 class-ID: 0403
Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor
vendor: Hewlett-Packard driver: snd_rn_pci_acp3x v: kernel
alternate: snd_pci_acp3x,snd_pci_acp5x bus-ID: 04:00.5 chip-ID: 1022:15e2
class-ID: 0480
Device-3: AMD Family 17h HD Audio vendor: Hewlett-Packard
driver: snd_hda_intel v: kernel bus-ID: 04:00.6 chip-ID: 1022:15e3
class-ID: 0403
Sound Server-1: ALSA v: k5.15.13-zen1-1-zen running: yes
Sound Server-2: JACK v: 1.9.19 running: no
Sound Server-3: PulseAudio v: 15.0 running: no
Sound Server-4: PipeWire v: 0.3.43 running: yes
Device-1: Realtek vendor: Hewlett-Packard driver: rtw89_pci v: N/A
modules: rtw89pci port: f000 bus-ID: 02:00.0 chip-ID: 10ec:8852
class-ID: 0280
IF: wlp2s0 state: up mac: <filter>
Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8
bus-ID: 3-3:3 chip-ID: 0bda:2852 class-ID: e001 serial: <filter>
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Local Storage: total: 238.47 GiB used: 141 GiB (59.1%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Toshiba
model: KBG40ZNV256G KIOXIA size: 238.47 GiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
rev: HP00AE00 temp: 30.9 C scheme: GPT
ID-1: / raw-size: 62.5 GiB size: 62.5 GiB (100.00%) used: 16.41 GiB (26.3%)
fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
used: 576 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 167.67 GiB size: 167.67 GiB (100.00%)
used: 124.59 GiB (74.3%) fs: btrfs dev: /dev/nvme0n1p3 maj-min: 259:3
ID-4: /var/log raw-size: 62.5 GiB size: 62.5 GiB (100.00%)
used: 16.41 GiB (26.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
ID-5: /var/tmp raw-size: 62.5 GiB size: 62.5 GiB (100.00%)
used: 16.41 GiB (26.3%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: partition size: 8 GiB used: 0 KiB (0.0%) priority: -2
dev: /dev/nvme0n1p4 maj-min: 259:4
ID-2: swap-2 type: zram size: 7.18 GiB used: 806.8 MiB (11.0%)
priority: 100 dev: /dev/zram0
System Temperatures: cpu: 41.0 C mobo: 31.0 C gpu: amdgpu temp: 41.0 C
Fan Speeds (RPM): N/A
Processes: 351 Uptime: 2h 10m wakeups: 3808 Memory: 7.18 GiB
used: 4.04 GiB (56.3%) Init: systemd v: 250 tool: systemctl Compilers:
gcc: 11.1.0 clang: 13.0.0 Packages: pacman: 1721 lib: 511 Shell: fish
v: 3.3.1 default: Bash v: 5.1.12 running-in: yakuake inxi: 3.3.11
1 Like



You could also try AUR (en) - rtw89-dkms-git


They will do for the build process, and you can prepare the sources (rather than build) with makepkg -o, but to follow the standard approach you'd apply the patch within the prepare() function rather than editing the source directly.

makepkg -o
==> Verifying source file signatures with gpg...
zen-kernel git repo ... FAILED (unknown public key 3B94A80E50A477C7)
==> ERROR: One or more PGP signatures could not be verified!