bpftools: fix cross for riscv64-linux (#371240)

This commit is contained in:
K900
2025-02-09 09:28:59 +03:00
committed by GitHub
+23
View File
@@ -1,6 +1,7 @@
{
lib,
stdenv,
fetchpatch,
linuxHeaders,
buildPackages,
libopcodes,
@@ -25,6 +26,25 @@ stdenv.mkDerivation rec {
patches = [
# fix unknown type name '__vector128' on ppc64le
./include-asm-types-for-ppc64le.patch
# fix build for riscv64
(fetchpatch {
# libbpf: Add missing per-arch include path
# https://patchwork.kernel.org/project/linux-riscv/patch/20240927131355.350918-1-bjorn@kernel.org/
url = "https://patchwork.kernel.org/project/linux-riscv/patch/20240927131355.350918-1-bjorn@kernel.org/raw/";
hash = "sha256-edXY/ejHW5L7rGgY5B2GmVZxUgnLdBadNhBOSAgcL7M=";
})
(fetchpatch {
# selftests: bpf: Add missing per-arch include path
# https://patchwork.kernel.org/project/linux-riscv/patch/20240927131355.350918-2-bjorn@kernel.org/
url = "https://patchwork.kernel.org/project/linux-riscv/patch/20240927131355.350918-2-bjorn@kernel.org/raw/";
hash = "sha256-7yNWE/L/qd3vcLtJYoSyGxB3ytySlr20R0D3t5ni2Fc=";
})
(fetchpatch {
# tools: Override makefile ARCH variable if defined, but empty
# https://patchwork.kernel.org/project/linux-riscv/patch/20241127101748.165693-1-bjorn@kernel.org/
url = "https://patchwork.kernel.org/project/linux-riscv/patch/20241127101748.165693-1-bjorn@kernel.org/raw/";
hash = "sha256-y8N71Hm1XfX9g3S6PzW2m7Lxp6wQQMfQE9L0QNt8cYY=";
})
];
depsBuildBuild = [ buildPackages.stdenv.cc ];
@@ -68,6 +88,9 @@ stdenv.mkDerivation rec {
"bpf_dbg"
];
# needed for cross to riscv64
makeFlags = [ "ARCH=${stdenv.hostPlatform.linuxArch}" ];
installPhase = ''
make -C bpftool install
install -Dm755 -t $out/bin bpf_asm