-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switching to OCI images to distribute kernels broke the update-kernel-deps target. Move it to a script and fix it to work with OCI images. Signed-off-by: Lorenz Bauer <[email protected]>
- Loading branch information
Showing
6 changed files
with
52 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
readonly docker="${CONTAINER_ENGINE:-docker}" | ||
|
||
extract_oci_image() { | ||
local image_name=$1 | ||
local target_directory=$2 | ||
|
||
echo -n "Fetching $image_name... " | ||
|
||
# We abuse the --output flag of docker buildx to obtain a copy of the image. | ||
# This is simpler than creating a temporary container and using docker cp. | ||
# It also automatically fetches the image for us if necessary. | ||
if ! echo "FROM $image_name" | "$docker" buildx build --quiet --pull --output="$target_directory" - &> /dev/null; then | ||
echo "failed" | ||
return 1 | ||
fi | ||
|
||
echo "ok" | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
source "$(dirname "$(realpath "$0")")/lib.sh" | ||
|
||
tmp=$(mktemp -d) | ||
|
||
cleanup() { | ||
rm -r "$tmp" | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
# Download and process libbpf.c | ||
curl -fL "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/tools/lib/bpf/libbpf.c?h=v$KERNEL_VERSION" -o "$tmp/libbpf.c" | ||
"./internal/cmd/gensections.awk" "$tmp/libbpf.c" | gofmt > "./elf_sections.go" | ||
|
||
# Download and process vmlinux and btf_testmod | ||
extract_oci_image "ghcr.io/cilium/ci-kernels:$KERNEL_VERSION" "$tmp" | ||
|
||
"/lib/modules/$(uname -r)/build/scripts/extract-vmlinux" "$tmp/boot/vmlinuz" > "$tmp/vmlinux" | ||
|
||
objcopy --dump-section .BTF=/dev/stdout "$tmp/vmlinux" /dev/null | gzip > "btf/testdata/vmlinux.btf.gz" | ||
find "$tmp/lib/modules" -type f -name bpf_testmod.ko -exec objcopy --dump-section .BTF="btf/testdata/btf_testmod.btf" {} /dev/null \; |