同じ様に試してみましたが、そもそも vmlinux-5.15.0-1038-raspi
には .BTF
セクションが存在しません。なので、「1. 上記のやり方」は無効です。
$ wget http://ddebs.ubuntu.com/pool/main/l/linux-raspi/linux-image-5.15.0-1038-raspi-dbgsym_5.15.0-1038.41_arm64.ddeb
$ dpkg-deb -x linux-image-5.15.0-1038-raspi-dbgsym_5.15.0-1038.41_arm64.ddeb .
$ bpftool btf dump file usr/lib/debug/boot/vmlinux-5.15.0-1038-raspi format c > vmlinux.h
libbpf: failed to find '.BTF' ELF section in usr/lib/debug/boot/vmlinux-5.15.0-1038-raspi
Error: failed to load BTF from usr/lib/debug/boot/vmlinux-5.15.0-1038-raspi: No data available
$ readelf -S usr/lib/debug/boot/vmlinux-5.15.0-1038-raspi
There are 42 section headers, starting at offset 0x14de8138:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .head.text PROGBITS ffff800008000000 00010000
0000000000010000 0000000000000000 AX 0 0 65536
[ 2] .text PROGBITS ffff800008010000 00020000
0000000000ded078 0000000000000008 AX 0 0 65536
[ 3] .got.plt PROGBITS ffff800008dfd078 00e0d078
0000000000000018 0000000000000008 WA 0 0 8
[ 4] .rodata PROGBITS ffff800008e00000 00e10000
00000000004ab81f 0000000000000000 WA 0 0 4096
:
$ readelf -S usr/lib/debug/boot/vmlinux-5.15.0-1038-raspi | grep -i btf
$ echo $?
1
$ objdump -s -j .BTF usr/lib/debug/boot/vmlinux-5.15.0-1038-raspi
usr/lib/debug/boot/vmlinux-5.15.0-1038-raspi: file format elf64-little
objdump: section '.BTF' mentioned in a -j option, but not found in any input file
別の方法でraspberry piのvmlinux.hを作成する方法
pahole/pahole.git - Pahole and other DWARF utils を使います。(DWARF
の debug data から BTF
を生成)
$ pahole --compile usr/lib/debug/boot/vmlinux-5.15.0-1038-raspi > vmlinux.h