Skip to content

Commit 7aa4385

Browse files
committed
fix(pkg/driverbuilder): fixed local cmd build up using os.Environ().
Moreover, properly mount debugfs before attempting the bpf probe build if needed. Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
1 parent be7a75f commit 7aa4385

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pkg/driverbuilder/builder/templates/local.sh

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ modinfo {{ .ModuleFullPath }}
5959

6060
{{ if .BuildProbe }}
6161
echo "* Building eBPF probe"
62+
63+
if [ ! -d /sys/kernel/debug/tracing ]; then
64+
echo "* Mounting debugfs"
65+
mount -t debugfs nodev /sys/kernel/debug
66+
fi
67+
6268
# Build the eBPF probe
6369
cd {{ .DriverBuildDir }}/bpf
6470
make

pkg/driverbuilder/local.go

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ func (lbp *LocalBuildProcessor) Start(b *builder.Build) error {
128128
ctx, cancelFunc := context.WithTimeout(context.Background(), time.Duration(lbp.timeout)*time.Second)
129129
defer cancelFunc()
130130
cmd := exec.CommandContext(ctx, "/bin/bash", "-c", driverkitScript)
131+
cmd.Env = os.Environ()
131132
// Append requested env variables to the command env
132133
for key, val := range lbp.envMap {
133134
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", key, val))

0 commit comments

Comments
 (0)