Skip to content

Commit 271ad8a

Browse files
linuxPackages.hyperv-daemons: Fix aarch64 builds on latest kernel (NixOS#371583)
2 parents 1fe90f7 + 9ebccc2 commit 271ad8a

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

pkgs/os-specific/linux/hyperv-daemons/default.nix

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
let
1313
libexec = "libexec/hypervkvpd";
1414

15-
fcopy_name = (if lib.versionOlder kernel.version "6.10" then "fcopy" else "fcopy_uio");
15+
fcopy_name =
16+
if lib.versionOlder kernel.version "6.10" then
17+
"fcopy"
18+
else
19+
# The fcopy program is explicitly left out in the Makefile on aarch64
20+
(if stdenv.hostPlatform.isAarch64 then null else "fcopy_uio");
1621

1722
daemons = stdenv.mkDerivation rec {
1823
pname = "hyperv-daemons-bin";
@@ -21,31 +26,18 @@ let
2126
nativeBuildInputs = [ makeWrapper ];
2227
buildInputs = [ python3 ];
2328

24-
# as of 4.9 compilation will fail due to -Werror=format-security
25-
hardeningDisable = [ "format" ];
26-
2729
postPatch = ''
2830
cd tools/hv
2931
substituteInPlace hv_kvp_daemon.c \
3032
--replace /usr/libexec/hypervkvpd/ $out/${libexec}/
3133
'';
3234

33-
# We don't actually need the hv_get_{dhcp,dns}_info scripts on NixOS in
34-
# their current incarnation but with them in place, we stop the spam of
35-
# errors in the log.
36-
installPhase = ''
37-
runHook preInstall
38-
39-
for f in ${fcopy_name} kvp vss ; do
40-
install -Dm755 hv_''${f}_daemon -t $out/bin
41-
done
42-
43-
install -Dm755 lsvmbus $out/bin/lsvmbus
44-
install -Dm755 hv_get_dhcp_info.sh $out/${libexec}/hv_get_dhcp_info
45-
install -Dm755 hv_get_dns_info.sh $out/${libexec}/hv_get_dns_info
46-
47-
runHook postInstall
48-
'';
35+
makeFlags = [
36+
"ARCH=${stdenv.hostPlatform.parsed.cpu.name}"
37+
"DESTDIR=$(out)"
38+
"sbindir=/bin"
39+
"libexecdir=/libexec"
40+
];
4941

5042
postFixup = ''
5143
wrapProgram $out/bin/hv_kvp_daemon \
@@ -90,22 +82,29 @@ stdenv.mkDerivation {
9082
];
9183

9284
buildInputs = [ daemons ];
85+
passthru = {
86+
inherit daemons;
87+
};
9388

9489
buildCommand = ''
9590
system=$lib/lib/systemd/system
9691
97-
install -Dm444 ${
98-
service "${
99-
fcopy_name
100-
}" "file copy (FCOPY)" "/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio"
101-
} $system/hv-fcopy.service
92+
${lib.optionalString (fcopy_name != null) ''
93+
install -Dm444 ${
94+
service fcopy_name "file copy (FCOPY)"
95+
"/sys/bus/vmbus/devices/eb765408-105f-49b6-b4aa-c123b64d17d4/uio"
96+
} $system/hv-fcopy.service
97+
''}
10298
install -Dm444 ${service "kvp" "key-value pair (KVP)" "hv_kvp"} $system/hv-kvp.service
10399
install -Dm444 ${service "vss" "volume shadow copy (VSS)" "hv_vss"} $system/hv-vss.service
104100
105101
cat > $system/hyperv-daemons.target <<EOF
106102
[Unit]
107103
Description=Hyper-V Daemons
108-
Wants=hv-fcopy.service hv-kvp.service hv-vss.service
104+
Wants=hv-kvp.service hv-vss.service
105+
${lib.optionalString (fcopy_name != null) ''
106+
Wants=hv-fcopy.service
107+
''}
109108
EOF
110109
111110
for f in $lib/lib/systemd/system/*.service ; do

0 commit comments

Comments
 (0)