Debian Codegraph @

scripts/update-kernel-deps.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 set -euo pipefail
4
5 # Extract kernel version from CI workflow file
6 kernel_version=$(awkscip-shell system . . awk. -F': ' '/CI_MAX_KERNEL_VERSION:/ {gsub(/['\''"]/, "", $2); print $2}scip-shell filesystem . . `/CI_MAX_KERNEL_VERSION:/ {gsub(/['\''"]/, "", $2); print $2}`.' .github/workflows/ci.yml)
7
8 if [scip-shell system . . `[`. -z "$kernel_version" ]; then
9 echoscip-shell system . . echo. "Error: Could not extract CI_MAX_KERNEL_VERSION from .github/workflows/ci.yml" >&2
10 exit 1
11 fi
12
13 echoscip-shell system . . echo. "Using kernel version: $kernel_version"
14
15 tmp=$(mktempscip-shell system . . mktemp. -d)
16
17 cleanupscip-shell shell shell-project 0.0.0 cleanup().() {
18 rmscip-shell system . . rm. -r "$tmp"
19 }
20
21 trap cleanup EXIT
22
23 # Download and process libbpf.c
24 # Truncate .0 patch versions (e.g., 6.16.0 -> 6.16, but leave 7.0 as 7.0)
25 kernel_version_for_url="$kernel_version"
26 if [[ $kernel_version =~ ^([0-9]+\.[0-9]+)\.0$ ]]; then
27 kernel_version_for_url="${BASH_REMATCH[1]}"
28 fi
29 curlscip-shell system . . curl. -fL "https://raw.githubusercontent.com/gregkh/linux/refs/tags/v$kernel_version_for_url/tools/lib/bpf/libbpf.c" -o "$tmp/libbpf.c"
30 "./internal/cmd/gensections.awk" "$tmp/libbpf.c" | gofmtscip-shell system . . gofmt. > "./elf_sections.go"
31
32 # Download and process vmlinux and btf_testmod
33 goscip-shell system . . go. tool crane export "ghcr.io/cilium/ci-kernels:$kernel_version" | tarscip-shell system . . tar. -x -C "$tmp"
34
35 extract-vmlinux "$tmp/boot/vmlinuz" > "$tmp/vmlinux"
36
37 objcopyscip-shell system . . objcopy. --dump-section .BTF=/dev/stdout "$tmp/vmlinux" /dev/nullscip-shell filesystem . . `/dev/null`. | gzipscip-shell system . . gzip. > "btf/testdata/vmlinux.btf.gz"
38 findscip-shell system . . find. "$tmp/lib/modules" -type f -name bpf_testmod.ko -exec objcopy --dump-section .BTF="btf/testdata/btf_testmod.btf" {} /dev/nullscip-shell filesystem . . `/dev/null`. \;
39 findscip-shell system . . find. "$tmp/lib/modules" -type f -name bpf_testmod.ko -exec objcopy --dump-section .BTF.base="btf/testdata/btf_testmod.btf.base" {} /dev/nullscip-shell filesystem . . `/dev/null`. \;