Skip to content

Commit df91d83

Browse files
authored
DLPX-84445 Generate BTF for our custom zfs and spl kernel modules (#357)
PR URL: https://www.github.com/delphix/linux-pkg/pull/357
1 parent f4a8cf9 commit df91d83

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

lib/common.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,47 @@ function install_kernel_headers() {
597597
done
598598
}
599599

600+
#
601+
# Install kernel dbgsym packages for all target kernels.
602+
# The kernel packages are fetched from S3.
603+
#
604+
function install_kernel_dbgsyms() {
605+
logmust determine_target_kernels
606+
check_env KERNEL_VERSIONS DEPDIR
607+
608+
logmust list_linux_kernel_packages
609+
# Note: linux packages returned in _RET_LIST
610+
611+
local pkg
612+
for pkg in "${_RET_LIST[@]}"; do
613+
logmust install_pkgs "$DEPDIR/$pkg/"linux-image-*dbgsym*.ddeb
614+
done
615+
616+
#
617+
# Verify that headers are installed for all kernel versions
618+
# stored in KERNEL_VERSIONS
619+
#
620+
local kernel
621+
for kernel in $KERNEL_VERSIONS; do
622+
logmust dpkg-query -l "linux-image-$kernel-dbgsym*" >/dev/null
623+
done
624+
}
625+
626+
function install_kernel_headers_and_dbgsyms() {
627+
logmust install_kernel_headers
628+
logmust install_kernel_dbgsyms
629+
630+
#
631+
# Additionally, we add these symlinks so that kernel module builds will
632+
# be able to generate BTF information, as they look for the "vmlinux" file
633+
# in the kernel header directory.
634+
#
635+
local kernel
636+
for kernel in $KERNEL_VERSIONS; do
637+
logmust sudo ln -s "/usr/lib/debug/boot/vmlinux-$kernel" "/usr/src/linux-headers-$kernel/vmlinux"
638+
done
639+
}
640+
600641
function delphix_revision() {
601642
#
602643
# We use "delphix" in the default revision to make it easy to find all

packages/connstat/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function prepare() {
2424
debhelper \
2525
dpkg-dev \
2626
llvm-14
27-
logmust install_kernel_headers
27+
logmust install_kernel_headers_and_dbgsyms
2828
logmust install_pkgs "$DEPDIR"/dwarves/*.deb
2929
}
3030

packages/zfs/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function prepare() {
5757
python3 \
5858
uuid-dev \
5959
zlib1g-dev
60-
logmust install_kernel_headers
60+
logmust install_kernel_headers_and_dbgsyms
6161
logmust install_pkgs "$DEPDIR"/delphix-rust/*.deb
6262
logmust cargo install [email protected] --locked
6363
logmust install_pkgs "$DEPDIR"/delphix-go/*.deb

0 commit comments

Comments
 (0)