5

I am new to linux and I am trying to compile an external kernel module on a Debian bookworm virtualization (UTM).

Makefile

obj-m += hello_world.o

PWD := $(CURDIR)

all:
    make -C /lib/modules/`uname -r`/build M=$(PWD)

clean:
    make -C /lib/modules/`uname -r`/build M=$(PWD) clean

The compilation fails with

./tools/bpf/resolve_btfids/resolve_btfids: not found

I have downloaded the linux headers with

sudo apt install linux-headers-`uname -r`

and inside tools there is only an objtool file.

I downloaded the linux source, compiled the required file and placed it in

/usr/src/linux-headers-`uname -r`/tools/bpf/resolve_btfids

for the module to compile.

I also found that CONFIG_DEBUG_INFO_BTS_MODULES is responsible for this and by removing the corresponding rule

ifdef CONFIG_DEBUG_INFO_BTF_MODULES
        +$(if $(newer-prereqs),$(call cmd,btf_ko))
endif

from

/usr/src/linux-headers-`uname -r`/scripts/Makefile.modfinal

the build can also succeed.

I was wondering

  • am I doing something wrong
  • why is this happening
  • is this normal for kernel module development
  • is there another way to get the compiled tools

Related links:

1 Answer 1

1

I'm facing the same issue building many git hub modules that I would love to get working.

I researched what/why this has changed with no success.

I did managed to build the btfids tool using the following commands to lessen the pain by those that follow.

apt install linux-source-6.6
tar xvf linux-source-6.6.tar.xz
find linux-source-6.6 | grep resolve_btfids
cd linux-source-6.6/tools/bpf/resolve_btfids
make
file tools/bpf/resolve_btfids/resolve_btfids
mkdir -p /usr/src/linux-headers-`uname -r`/tools/bpf/resolve_btfids
ln -s $(realpath resolve_btfids) /usr/src/linux-headers-`uname -r`/tools/bpf/resolve_btfids

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .