Skip to content

Commit a505295

Browse files
committed
windows: automate update of external dependencies
Add a script which automatically fetches ebpf_structs.h and regenerates asm/func_win.go from it. Break out the stringer invocation into a separate step because efW made a breaking change to function names, which breaks the subsequent build. Signed-off-by: Lorenz Bauer <[email protected]>
1 parent 8a100e3 commit a505295

File tree

7 files changed

+70
-48
lines changed

7 files changed

+70
-48
lines changed

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ all: format $(addsuffix -el.elf,$(TARGETS)) $(addsuffix -eb.elf,$(TARGETS)) gene
9898
ln -srf testdata/loader-$(CLANG)-eb.elf testdata/loader-eb.elf
9999

100100
generate:
101+
go generate -run "stringer" ./...
101102
go generate -run "gentypes" ./...
102-
go generate -skip "gentypes" ./...
103+
go generate -skip "(gentypes|stringer)" ./...
103104

104105
testdata/loader-%-el.elf: testdata/loader.c
105106
$* $(CFLAGS) -target bpfel -c $< -o $@
@@ -117,8 +118,10 @@ testdata/loader-%-eb.elf: testdata/loader.c
117118
$(CLANG) $(CFLAGS) -target bpfeb -c $< -o $@
118119
$(STRIP) -g $@
119120

120-
.PHONY: update-kernel-deps
121-
update-kernel-deps: export KERNEL_VERSION?=6.16.0
122-
update-kernel-deps:
123-
./testdata/sh/update-kernel-deps.sh
121+
.PHONY: update-external-deps
122+
update-external-deps: export KERNEL_VERSION=6.16.0
123+
update-external-deps: export EFW_VERSION=v1.0.0-rc1
124+
update-external-deps:
125+
./scripts/update-kernel-deps.sh
126+
./scripts/update-efw-deps.sh
124127
$(MAKE) container-all

asm/func_string.go

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

asm/func_win.go

Lines changed: 36 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/ebpf/contributing/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ variables:
6161
make CONTAINER_ENGINE=podman CONTAINER_RUN_ARGS=
6262
```
6363

64-
### Updating kernel dependencies
64+
### Updating external dependencies
6565

6666
Syscall bindings and some parameters required to parse ELF sections are derived
6767
from upstream kernel versions. You can update them to the latest version by:
6868

6969
1. Adjusting the `KERNEL_VERSION` variable in `Makefile`
7070
2. Running
7171
```shell-session
72-
make update-kernel-deps
72+
make update-external-deps
7373
```
7474
7575
Finally, bump the tested kernels in `.github/workflows/ci.yml`

internal/cmd/genwinfunctions.awk

100644100755
File mode changed.

scripts/update-efw-deps.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
tmp=$(mktemp -d)
6+
7+
cleanup() {
8+
rm -r "$tmp"
9+
}
10+
11+
trap cleanup EXIT
12+
13+
# Download and process ebpf_structs.h
14+
curl -fL "https://github.com/microsoft/ebpf-for-windows/raw/refs/tags/${EFW_VERSION}/include/ebpf_structs.h" -o "$tmp/ebpf_structs.h"
15+
"./internal/cmd/genwinfunctions.awk" "$tmp/ebpf_structs.h" | gofmt > "./asm/func_win.go"
File renamed without changes.

0 commit comments

Comments
 (0)