From: Viktor Malik <vmalik@xxxxxxxxxx> redhat: Drop bpftool from kernel spec We are going to build bpftool as a separate package. There are 2 main reasons for this change: (1) bpftool version is independent of the kernel and having it in the kernel spec causes all kinds of problems and (2) bpftool is loosely coupled to the libbpf library which is also packaged separately. Note that bpftool is still built during kernel build in 2 places: - Bootstrap bpftool for generating vmlinux.h which goes into kernel-devel. - As a part of kernel BPF selftests build. Here, we opt to use the bpftool from kernel sources rather than the system one because upstream selftests sometimes require unreleased bpftool features to build successfully. Signed-off-by: Viktor Malik <vmalik@xxxxxxxxxx> diff --git a/redhat/Makefile b/redhat/Makefile index blahblah..blahblah 100644 --- a/redhat/Makefile +++ b/redhat/Makefile @@ -335,12 +335,6 @@ KABI_TARBALL:=$(REDHAT)/kernel-abi-stablelists-$(SPECKABIVERSION).tar.xz KABIDW := $(REDHAT)/kabi-dwarf KABIDW_TARBALL:=$(REDHAT)/kernel-kabi-dw-$(SPECKABIVERSION).tar.xz -# Taken from tools/lib/bpf/Makefile -SPECBPFTOOLVERSION:=$(shell \ - grep -oE '^LIBBPF_([0-9.]+)' $(TOPDIR)/tools/lib/bpf/libbpf.map | \ - sort -rV | head -n1 | cut -d'_' -f2 | \ - awk -F. -v OFS=. '{$$1 += 6 ; print}') - # load Makefile variable settings from user-specified configuration file, # ~/.rhpkg.mk or $TOPDIR/.rhpkg.mk ifeq ("$(RHDISTGIT_CACHE)", "") diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -228,8 +228,6 @@ Summary: The Linux kernel %define with_libperf %{?_without_libperf: 0} %{?!_without_libperf: 1} # tools %define with_tools %{?_without_tools: 0} %{?!_without_tools: 1} -# bpf tool -%define with_bpftool %{?_without_bpftool: 0} %{?!_without_bpftool: 1} # kernel-debuginfo %define with_debuginfo %{?_without_debuginfo: 0} %{?!_without_debuginfo: 1} # kernel-abi-stablelists @@ -389,7 +387,6 @@ Summary: The Linux kernel %define with_perf 0 %define with_libperf 0 %define with_tools 0 -%define with_bpftool 0 %define with_kernel_abi_stablelists 0 %define with_selftests 0 %define with_ipaclones 0 @@ -402,7 +399,6 @@ Summary: The Linux kernel %define with_perf 0 %define with_libperf 0 %define with_tools 0 -%define with_bpftool 0 %define with_kernel_abi_stablelists 0 %define with_selftests 0 %define with_ipaclones 0 @@ -418,7 +414,6 @@ Summary: The Linux kernel %define with_perf 0 %define with_libperf 0 %define with_tools 0 -%define with_bpftool 0 %define with_kernel_abi_stablelists 0 %define with_selftests 0 %define with_ipaclones 0 @@ -444,11 +439,6 @@ Summary: The Linux kernel %define use_vdso 1 %endif -# selftests require bpftool to be built. If bpftools is disabled, then disable selftests -%if %{with_bpftool} == 0 -%define with_selftests 0 -%endif - %ifnarch noarch %define with_kernel_abi_stablelists 0 %endif @@ -479,7 +469,6 @@ Summary: The Linux kernel %define with_tools 0 %define with_perf 0 %define with_libperf 0 -%define with_bpftool 0 %define with_selftests 0 %define with_debug 0 %endif @@ -573,7 +562,6 @@ Summary: The Linux kernel %define with_perf 0 %define with_libperf 0 %define with_tools 0 -%define with_bpftool 0 %define with_selftests 0 %define _enable_debug_packages 0 %endif @@ -713,12 +701,8 @@ BuildRequires: libnl3-devel %if %{with_tools} || %{signmodules} || %{signkernel} BuildRequires: openssl-devel %endif -%if %{with_bpftool} -BuildRequires: python3-docutils -BuildRequires: zlib-devel binutils-devel llvm-devel -%endif %if %{with_selftests} -BuildRequires: clang llvm-devel fuse-devel +BuildRequires: clang llvm-devel fuse-devel zlib-devel binutils-devel %ifarch x86_64 BuildRequires: lld %endif @@ -1243,42 +1227,6 @@ analysing the logical and timing behavior of Linux. # with_tools %endif -%if %{with_bpftool} - -%if 0%{?fedora} -# bpftoolverion doesn't bump with stable updates so let's stick with -# upstream kernel version for the package name. We still get correct -# output with bpftool -V. -%define bpftoolversion %specrpmversion -%else -%define bpftoolversion %%SPECBPFTOOLVERSION%% -%endif - -%package -n bpftool -Summary: Inspection and simple manipulation of eBPF programs and maps -Version: %{bpftoolversion} -%description -n bpftool -This package contains the bpftool, which allows inspection and simple -manipulation of eBPF programs and maps. - -%package -n bpftool-debuginfo -Summary: Debug information for package bpftool -Version: %{bpftoolversion} -Group: Development/Debug -Requires: %{name}-debuginfo-common-%{_target_cpu} = %{specrpmversion}-%{release} -AutoReqProv: no -%description -n bpftool-debuginfo -This package provides debug information for the bpftool package. - -%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_sbindir}/bpftool(\.debug)?|XXX' -o bpftool-debuginfo.list} - -# Setting "Version:" above overrides the internal {version} macro, -# need to restore it here -%define version %{specrpmversion} - -# with_bpftool -%endif - %if %{with_selftests} %package selftests-internal @@ -3040,17 +2988,6 @@ if [ -f $DevelDir/vmlinux.h ]; then fi echo "${RPM_VMLINUX_H}" > ../vmlinux_h_path -%if %{with_bpftool} -%global bpftool_make \ - %{__make} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" DESTDIR=$RPM_BUILD_ROOT %{?make_opts} VMLINUX_H="${RPM_VMLINUX_H}" V=1 -%{log_msg "build bpftool"} -pushd tools/bpf/bpftool -%{bpftool_make} -popd -%else -%{log_msg "bpftools disabled ... disabling selftests"} -%endif - %if %{with_selftests} %{log_msg "start build selftests"} # Unfortunately, samples/bpf/Makefile expects that the headers are installed @@ -3070,9 +3007,6 @@ fi %{log_msg "build samples/bpf"} %{make} %{?_smp_mflags} ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true -# Prevent bpf selftests to build bpftool repeatedly: -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. @@ -3110,7 +3044,6 @@ done %buildroot_save_unstripped "usr/libexec/kselftests/bpf/test_progs" %buildroot_save_unstripped "usr/libexec/kselftests/bpf/test_progs-no_alu32" popd -export -n BPFTOOL %{log_msg "end build selftests"} %endif @@ -3360,12 +3293,6 @@ rm -f %{buildroot}%{_bindir}/timerlat popd %endif -%if %{with_bpftool} -pushd tools/bpf/bpftool -%{bpftool_make} prefix=%{_prefix} bash_compdir=%{_sysconfdir}/bash_completion.d/ mandir=%{_mandir} install doc-install -popd -%endif - %if %{with_selftests} pushd samples install -d %{buildroot}%{_libexecdir}/ksamples @@ -3908,29 +3835,6 @@ fi\ # with_tools %endif -%if %{with_bpftool} -%files -n bpftool -%{_sbindir}/bpftool -%{_sysconfdir}/bash_completion.d/bpftool -%{_mandir}/man8/bpftool-cgroup.8.gz -%{_mandir}/man8/bpftool-gen.8.gz -%{_mandir}/man8/bpftool-iter.8.gz -%{_mandir}/man8/bpftool-link.8.gz -%{_mandir}/man8/bpftool-map.8.gz -%{_mandir}/man8/bpftool-prog.8.gz -%{_mandir}/man8/bpftool-perf.8.gz -%{_mandir}/man8/bpftool.8.gz -%{_mandir}/man8/bpftool-net.8.gz -%{_mandir}/man8/bpftool-feature.8.gz -%{_mandir}/man8/bpftool-btf.8.gz -%{_mandir}/man8/bpftool-struct_ops.8.gz - -%if %{with_debuginfo} -%files -f bpftool-debuginfo.list -n bpftool-debuginfo -%defattr(-,root,root) -%endif -%endif - %if %{with_selftests} %files selftests-internal %{_libexecdir}/ksamples diff --git a/redhat/scripts/genspec/genspec.sh b/redhat/scripts/genspec/genspec.sh index blahblah..blahblah 100755 --- a/redhat/scripts/genspec/genspec.sh +++ b/redhat/scripts/genspec/genspec.sh @@ -57,7 +57,6 @@ test -f "$SOURCES/$SPECFILE" && s/%%SPECVERSION%%/$SPECVERSION/ s/%%SPECRPMVERSION%%/$SPECRPMVERSION/ s/%%SPECKABIVERSION%%/$SPECKABIVERSION/ - s/%%SPECBPFTOOLVERSION%%/$SPECBPFTOOLVERSION/ s/%%SPECTARFILE_RELEASE%%/$SPECTARFILE_RELEASE/ s/%%SPECPACKAGE_NAME%%/$SPECPACKAGE_NAME/ s/%%SPECGEMINI%%/$SPECGEMINI/ diff --git a/redhat/scripts/genspec/headerspec.sh b/redhat/scripts/genspec/headerspec.sh index blahblah..blahblah 100755 --- a/redhat/scripts/genspec/headerspec.sh +++ b/redhat/scripts/genspec/headerspec.sh @@ -27,7 +27,6 @@ test -f "$SOURCES/kernel-headers.spec" && s/%%SPECVERSION%%/$SPECVERSION/ s/%%SPECRPMVERSION%%/$SPECRPMVERSION/ s/%%SPECKABIVERSION%%/$SPECKABIVERSION/ - s/%%SPECBPFTOOLVERSION%%/$SPECBPFTOOLVERSION/ s/%%SPECTARFILE_RELEASE%%/$SPECTARFILE_RELEASE/ s/%%SPECPACKAGE_NAME%%/$SPECPACKAGE_NAME/ s/%%SPECGEMINI%%/$SPECGEMINI/ diff --git a/redhat/self-test/data/create-data.sh b/redhat/self-test/data/create-data.sh index blahblah..blahblah 100755 --- a/redhat/self-test/data/create-data.sh +++ b/redhat/self-test/data/create-data.sh @@ -51,7 +51,6 @@ do # the tree is changed. # RHEL_RELEASE can change build-to-build. # SHELL can change depending on user's environment - # SPECBPFTOOLVERSION is derived from tools/lib/bpf/Makefile and may change. # RHGITURL may change depending on the user's method of cloning # RHDISTDATADIR will change based on these tests # VARS is a list of variables added for the 'dist-dump-variables' target @@ -61,7 +60,6 @@ do grep -v -w UPSTREAM |\ grep -v -w RHEL_RELEASE |\ grep -v -w SHELL |\ - grep -v -w SPECBPFTOOLVERSION |\ grep -v -w RHGITURL |\ grep -v -w RHDISTDATADIR |\ grep -v -w VARS |\ -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3338 -- _______________________________________________ kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx 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/kernel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue