You are not logged in.

#1 2022-11-08 17:18:00

HotDogEnemy
Member
Registered: 2020-11-24
Posts: 72

[SOLVED] Compiling older kernel fails with error

I'm currently trying to compile an older kernel (between the 5.15 and 5.16 kernels from torvalds git repo), but it keeps failing after I run make -j4. I followed the configuration steps from the wiki - copying the configuration of the currently running Linux kernel, after which I used modprobed-db to disable unneeded modules in the config. But since GCC-12 would not work due to some changes with the way it handles errors, I had to download the gcc11 package and modify the makefile to use gcc-11 and g++-11 instead. Then I ran make -j4 which results in an error about BTF.

The error message that shows when running make -j4 is as follows:

$ make -j4
  DESCEND objtool
  DESCEND bpf/resolve_btfids
  CALL    scripts/atomic/check-atomics.sh
  CALL    scripts/checksyscalls.sh
  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
ld: warning: .tmp_vmlinux.btf has a LOAD segment with RWX permissions
  BTF     .btf.vmlinux.bin.o
  LD      .tmp_vmlinux.kallsyms1
ld: warning: .tmp_vmlinux.kallsyms1 has a LOAD segment with RWX permissions
  KSYMS   .tmp_vmlinux.kallsyms1.S
  AS      .tmp_vmlinux.kallsyms1.S
  LD      .tmp_vmlinux.kallsyms2
ld: warning: .tmp_vmlinux.kallsyms2 has a LOAD segment with RWX permissions
  KSYMS   .tmp_vmlinux.kallsyms2.S
  AS      .tmp_vmlinux.kallsyms2.S
  LD      vmlinux
ld: warning: vmlinux has a LOAD segment with RWX permissions
  BTFIDS  vmlinux
FAILED: load BTF from vmlinux: Invalid argument
make: *** [Makefile:1187: vmlinux] Error 255
make: *** Deleting file 'vmlinux'

However, compiling a newer kernel (v6.1-rc4) works just fine, and the bzImage is generated successfully.

I searched around online, however I haven't found any solutions yet. Any help would be appreciated!

Last edited by HotDogEnemy (2022-11-12 08:02:20)

Offline

#2 2022-11-09 20:45:15

xerxes_
Member
Registered: 2018-04-29
Posts: 919

Re: [SOLVED] Compiling older kernel fails with error

Check permissions of your files; maybe they should not be executable?

Offline

#3 2022-11-10 00:09:41

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,762

Re: [SOLVED] Compiling older kernel fails with error

You may need an older pahole to build.

Offline

#4 2022-11-12 08:01:31

HotDogEnemy
Member
Registered: 2020-11-24
Posts: 72

Re: [SOLVED] Compiling older kernel fails with error

xerxes_ wrote:

Check permissions of your files; maybe they should not be executable?

I checked, but everything seems fine.

Scimmia wrote:

You may need an older pahole to build.

I actually figured it out, seems like the tags in the torvalds kernel branch don't get updated after its released, so I was missing some fixes. All I had to do was download a recent 5.15 kernel (5.15.77 from stable branch in this case) and replace the file scripts/pahole-flags.sh of the older kernel (the kernel I was trying to build) with the scripts/pahole-flags.sh of the newer kernel (the 5.15.77 kernel).

After doing this, the kernel compiled and booted up successfully.

Marking as solved, thank you to everyone who took the time to reply!

Offline

Board footer

Powered by FluxBB