@@ -2220,6 +2220,13 @@ InitBuildVars() {
22202220 fi
22212221}
22222222
2223+ #Build bootstrap bpftool
2224+ BuildBpftool(){
2225+ export BPFBOOTSTRAP_CFLAGS=$(echo "%{__global_compiler_flags}" | sed -r "s/\-specs=[^\ ]+\/redhat-annobin-cc1//")
2226+ export BPFBOOTSTRAP_LDFLAGS=$(echo "%{__global_ldflags}" | sed -r "s/\-specs=[^\ ]+\/redhat-annobin-cc1//")
2227+ CFLAGS="" LDFLAGS="" make EXTRA_CFLAGS="${BPFBOOTSTRAP_CFLAGS}" EXTRA_CXXFLAGS="${BPFBOOTSTRAP_CFLAGS}" EXTRA_LDFLAGS="${BPFBOOTSTRAP_LDFLAGS}" %{?make_opts} %{?clang_make_opts} V=1 -C tools/bpf/bpftool bootstrap
2228+ }
2229+
22232230BuildKernel() {
22242231 %{log_msg "BuildKernel for $4"}
22252232 MakeTarget=$1
@@ -2953,10 +2960,7 @@ BuildKernel() {
29532960 if [ "$Variant" != "zfcpdump" ]; then
29542961 %{log_msg "Build the bootstrap bpftool to generate vmlinux.h"}
29552962 # Build the bootstrap bpftool to generate vmlinux.h
2956- export BPFBOOTSTRAP_CFLAGS=$(echo "%{__global_compiler_flags}" | sed -r "s/\-specs=[^\ ]+\/redhat-annobin-cc1//")
2957- export BPFBOOTSTRAP_LDFLAGS=$(echo "%{__global_ldflags}" | sed -r "s/\-specs=[^\ ]+\/redhat-annobin-cc1//")
2958- CFLAGS="" LDFLAGS="" make EXTRA_CFLAGS="${BPFBOOTSTRAP_CFLAGS}" EXTRA_CXXFLAGS="${BPFBOOTSTRAP_CFLAGS}" EXTRA_LDFLAGS="${BPFBOOTSTRAP_LDFLAGS}" %{?make_opts} %{?clang_make_opts} V=1 -C tools/bpf/bpftool bootstrap
2959-
2963+ BuildBpftool
29602964 tools/bpf/bpftool/bootstrap/bpftool btf dump file vmlinux format c > $RPM_BUILD_ROOT/$DevelDir/vmlinux.h
29612965 fi
29622966%endif
@@ -3201,7 +3205,10 @@ pushd tools/tracing/rtla
32013205popd
32023206%endif
32033207
3204- if [ -f $DevelDir/vmlinux.h ]; then
3208+ #set RPM_VMLINUX_H
3209+ if [ -f $RPM_BUILD_ROOT/$DevelDir/vmlinux.h ]; then
3210+ RPM_VMLINUX_H=$RPM_BUILD_ROOT/$DevelDir/vmlinux.h
3211+ elif [ -f $DevelDir/vmlinux.h ]; then
32053212 RPM_VMLINUX_H=$DevelDir/vmlinux.h
32063213fi
32073214echo "${RPM_VMLINUX_H}" > ../vmlinux_h_path
@@ -3222,8 +3229,13 @@ if [ ! -f include/generated/autoconf.h ]; then
32223229 %{make} %{?_smp_mflags} modules_prepare
32233230fi
32243231
3232+ # Build BPFtool for samples/bpf
3233+ if [ ! -f tools/bpf/bpftool/bootstrap/bpftool ]; then
3234+ BuildBpftool
3235+ fi
3236+
32253237%{log_msg "build samples/bpf"}
3226- %{make} %{?_smp_mflags} EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true
3238+ %{make} %{?_smp_mflags} EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" ARCH=$Arch BPFTOOL=$(pwd)/tools/bpf/bpftool/bootstrap/bpftool V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true
32273239
32283240pushd tools/testing/selftests
32293241# We need to install here because we need to call make with ARCH set which
0 commit comments