Kernel questions - finding source, and trouble building

I have been trying to find the source RPM (i.e. SRPM) package for the kernel I am currently running, whose prebuilt package is kernel-5.14.0-162.6.1.el9_1.0.1.x86_64.rpm . In other words, I’m trying to find the package kernel-5.14.0-162.6.1.el9_1.0.1.src.rpm .

Now, the nearest I can find on under archived versions is kernel-5.14.0-162.23.1.el9_1.src.rpm, but this doesn’t build correctly, giving me the following output (after I have removed the -s (silent) flag from the make instruction):

/usr/bin/make ‘HOSTCFLAGS=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection’ 'HOSTLDFLAGS=-Wl,-z,relro -Wl,–as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 ’ ARCH=x86_64 KCFLAGS= WITH_GCOV=0 -j24 bzImage

  • /usr/bin/make ‘HOSTCFLAGS=-O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection’ 'HOSTLDFLAGS=-Wl,-z,relro -Wl,–as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 ’ ARCH=x86_64 KCFLAGS= WITH_GCOV=0 -j24 bzImage
    DESCEND objtool
    DESCEND bpf/resolve_btfids
    CALL scripts/atomic/
    CALL scripts/
    CHK include/generated/compile.h
    GEN .version
    CHK include/generated/compile.h
    UPD include/generated/compile.h
    CC init/version.o
    AR init/built-in.a
    LD vmlinux.o
    MODPOST vmlinux.symvers
    MODINFO modules.builtin.modinfo
    GEN modules.builtin
    LD .tmp_vmlinux.btf
    BTF .btf.vmlinux.bin.o
    LD .tmp_vmlinux.kallsyms1
    KSYMS .tmp_vmlinux.kallsyms1.S
    AS .tmp_vmlinux.kallsyms1.S
    LD .tmp_vmlinux.kallsyms2
    KSYMS .tmp_vmlinux.kallsyms2.S
    AS .tmp_vmlinux.kallsyms2.S
    LD vmlinux
    BTFIDS vmlinux
    FAILED: load BTF from vmlinux: Invalid argument
    make: *** [Makefile:1218: vmlinux] Error 255
    make: *** Deleting file ‘vmlinux’

Can anybody tell me any of:

where to find the source package I really want; or
what is wrong in the above build; or
where I can find the meaning of the capital letter keywords output from make (e.g. BTFIDS) ?


I’m not sure why you need such an old kernel, not the latest kernel from 9.2. But anyway, can you check to see if CONFIG_DEBUG_INFO_COMPRESSED is enabled in the config file? If so, would disabling it make it work?

You have to enable the source repo in /etc/yum.repos.d rocky.repo

name=Rocky Linux $releasever - BaseOS - Source

Change "enabled=0" to "enabled=1"

Thank you Toracat for this suggestion; it was already disabled. However, your suggestion somehow led me to this article Compiling older Linux Kernels can fail with load BTF from vmlinux: invalid argument - which contains three possible solutions; the third (patch seems to have worked for me so far.

In answer to your “I’m not sure why you need…”, I have not updated to rocky 9.2 because of hearing about random crashes with 9.2 which I definitely don’t want, particularly given that RedHat have a fix for them which is so far not available to non-fee-payers, so I am waiting till a kernel with that fix is available on the rocky repos. In the meantime I am investigating on another (non-production) system some things about the behaviour of my current system that I don’t understand, hence wanting the ability to put additional code in the kernel to investigate.

Thank you Cphusion for that - I had already enabled it, but as far as I can tell only the current (rocky 9.2) kernel and source are kept there.

This one is probably the closest one you are going to get to kernel-5.14.0-162.6.1.el9_1.0.1.src.rpm unless you download that kernel directly from RHEL.