From: Don Zickus <[email protected]>

kernel.spec: Add support to use vmlinux.h

For split environments where the kernel and userspace tools are not
built together, take the -devel packaged vmlinux.h file and use it
to build bpftools.

Use the VMLINUX_H= env variable to tell the tools which file to use.

Orginally done by Jiri Olsa <[email protected]>

Updated to transition from artifacts to -devel package.

Signed-off-by: Don Zickus <[email protected]>

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100755
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -222,7 +222,6 @@ Summary: The Linux kernel
 # Fedora builds these separately
 %define with_perf 0
 %define with_tools 0
-%define with_bpftool 0
 %endif
 
 %if %{with_verbose}
@@ -2160,8 +2159,12 @@ pushd tools/vm/
 popd
 %endif
 
+if [ -f $DevelDir/vmlinux.h ]; then
+  RPM_VMLINUX_H=$DevelDir/vmlinux.h
+fi
+
 %global bpftool_make \
-  %{__make} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" 
EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT %{?make_opts}
+  %{__make} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" 
EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT %{?make_opts} 
VMLINUX_H="${RPM_VMLINUX_H}" V=1
 %if %{with_bpftool}
 pushd tools/bpf/bpftool
 %{bpftool_make}
@@ -2181,7 +2184,7 @@ export BPFTOOL=$(pwd)/tools/bpf/bpftool/bpftool
 pushd tools/testing/selftests
 # We need to install here because we need to call make with ARCH set which
 # doesn't seem possible to do in the install section.
-%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="bpf livepatch net 
net/forwarding net/mptcp netfilter tc-testing" SKIP_TARGETS="" 
INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests install
+%{make} %{?_smp_mflags} ARCH=$Arch V=1 TARGETS="bpf livepatch net 
net/forwarding net/mptcp netfilter tc-testing" SKIP_TARGETS="" 
INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" 
install
 
 # 'make install' for bpf is broken and upstream refuses to fix it.
 # Install the needed files manually.
@@ -2421,6 +2424,10 @@ install -m755 page_owner_sort 
%{buildroot}%{_bindir}/page_owner_sort
 popd
 %endif
 
+if [ -f $DevelDir/vmlinux.h ]; then
+  RPM_VMLINUX_H=$DevelDir/vmlinux.h
+fi
+
 %if %{with_bpftool}
 pushd tools/bpf/bpftool
 %{bpftool_make} prefix=%{_prefix} 
bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install 
doc-install

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1153
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to