diff --git a/dockerfiles/kernel-image b/dockerfiles/kernel-image index 0b11c0f1..4337a5ca 100644 --- a/dockerfiles/kernel-image +++ b/dockerfiles/kernel-image @@ -8,6 +8,9 @@ RUN lvh kernels --dir . fetch 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . configure 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . build 2>&1 ${KERNEL_VER} +COPY scripts/generate-btf.sh /tmp/ +RUN /tmp/generate-btf.sh /data/kernels/${KERNEL_VER}/tar-install + FROM busybox ARG KERNEL_VER=bpf-next COPY --from=builder /data/kernels/${KERNEL_VER}/tar-install /data/kernels/${KERNEL_VER} diff --git a/dockerfiles/kernel-image-4.19 b/dockerfiles/kernel-image-4.19 index c34c5e76..7af95716 100644 --- a/dockerfiles/kernel-image-4.19 +++ b/dockerfiles/kernel-image-4.19 @@ -8,6 +8,9 @@ RUN lvh kernels --dir . fetch 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . configure 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . build 2>&1 ${KERNEL_VER} +COPY scripts/generate-btf.sh /tmp/ +RUN /tmp/generate-btf.sh /data/kernels/${KERNEL_VER}/tar-install + FROM busybox ARG KERNEL_VER=4.19 COPY --from=builder /data/kernels/${KERNEL_VER}/tar-install /data/kernels/${KERNEL_VER} diff --git a/dockerfiles/kernel-image-5.10 b/dockerfiles/kernel-image-5.10 index 77434eb6..dadd044a 100644 --- a/dockerfiles/kernel-image-5.10 +++ b/dockerfiles/kernel-image-5.10 @@ -8,6 +8,9 @@ RUN lvh kernels --dir . fetch 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . configure 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . build 2>&1 ${KERNEL_VER} +COPY scripts/generate-btf.sh /tmp/ +RUN /tmp/generate-btf.sh /data/kernels/${KERNEL_VER}/tar-install + FROM busybox ARG KERNEL_VER=5.10 COPY --from=builder /data/kernels/${KERNEL_VER}/tar-install /data/kernels/${KERNEL_VER} diff --git a/dockerfiles/kernel-image-5.4 b/dockerfiles/kernel-image-5.4 index c5f3b40a..7f744a78 100644 --- a/dockerfiles/kernel-image-5.4 +++ b/dockerfiles/kernel-image-5.4 @@ -8,6 +8,9 @@ RUN lvh kernels --dir . fetch 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . configure 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . build 2>&1 ${KERNEL_VER} +COPY scripts/generate-btf.sh /tmp/ +RUN /tmp/generate-btf.sh /data/kernels/${KERNEL_VER}/tar-install + FROM busybox ARG KERNEL_VER=5.4 COPY --from=builder /data/kernels/${KERNEL_VER}/tar-install /data/kernels/${KERNEL_VER} diff --git a/dockerfiles/kernel-image-bpf-next b/dockerfiles/kernel-image-bpf-next index 0b11c0f1..4337a5ca 100644 --- a/dockerfiles/kernel-image-bpf-next +++ b/dockerfiles/kernel-image-bpf-next @@ -8,6 +8,9 @@ RUN lvh kernels --dir . fetch 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . configure 2>&1 ${KERNEL_VER} RUN lvh kernels --dir . build 2>&1 ${KERNEL_VER} +COPY scripts/generate-btf.sh /tmp/ +RUN /tmp/generate-btf.sh /data/kernels/${KERNEL_VER}/tar-install + FROM busybox ARG KERNEL_VER=bpf-next COPY --from=builder /data/kernels/${KERNEL_VER}/tar-install /data/kernels/${KERNEL_VER} diff --git a/scripts/generate-btf.sh b/scripts/generate-btf.sh new file mode 100755 index 00000000..507ca888 --- /dev/null +++ b/scripts/generate-btf.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +if [ -z $1 ]; then + echo "Usage: $0 " + exit 1 +fi + +dir="$1" +bootdir="$dir/boot" + +for fname in $bootdir/vmlinux-*; do + kernel=$(basename $fname) + ver=$(echo $kernel | sed -e 's/vmlinux-//') + outfile="$bootdir/kernel-${ver}.btf" + rm -f $outfile + pahole --btf_encode_detached=$outfile $fname + echo "Generated $outfile" +done