summary refs log tree commit diff
path: root/vm
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-04-13 19:15:09 +0200
committerAlyssa Ross <hi@alyssa.is>2023-04-29 09:55:44 +0000
commitabf73fadbc7d77c31385300395870520f7ba7e5d (patch)
tree61fd5608fc1002e5b47b5b621314a1fe967bbcd2 /vm
parentb571cee2499c445f7a542c8bb09789dcb8d65890 (diff)
downloadspectrum-abf73fadbc7d77c31385300395870520f7ba7e5d.tar
spectrum-abf73fadbc7d77c31385300395870520f7ba7e5d.tar.gz
spectrum-abf73fadbc7d77c31385300395870520f7ba7e5d.tar.bz2
spectrum-abf73fadbc7d77c31385300395870520f7ba7e5d.tar.lz
spectrum-abf73fadbc7d77c31385300395870520f7ba7e5d.tar.xz
spectrum-abf73fadbc7d77c31385300395870520f7ba7e5d.tar.zst
spectrum-abf73fadbc7d77c31385300395870520f7ba7e5d.zip
vm: use the default kernel target on non-x86
cloud-hypervisor only supports x86_64 and aarch64, but it's clear that
it's x86_64 that's the odd one out when it comes to needing special
kernel images.  So let's assume we should use the default kernel
target, except on x86 where we know we shouldn't.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'vm')
-rw-r--r--vm/sys/net/default.nix22
1 files changed, 14 insertions, 8 deletions
diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
index 1914b6a..59549a4 100644
--- a/vm/sys/net/default.nix
+++ b/vm/sys/net/default.nix
@@ -60,6 +60,18 @@ let
         -T ${writeReferencesToFile packagesSysroot} .
   '';
 
+  kernelTarget =
+    if stdenvNoCC.hostPlatform.isx86 then
+      # vmlinux.bin is the stripped version of vmlinux.
+      # Confusingly, compressed/vmlinux.bin is the stripped version of
+      # the top-level vmlinux target, while the top-level vmlinux.bin
+      # is the stripped version of compressed/vmlinux.  So we use
+      # compressed/vmlinux.bin, since we want a stripped version of
+      # the kernel that *hasn't* been built to be compressed.  Weird!
+      "compressed/vmlinux.bin"
+    else
+      stdenvNoCC.hostPlatform.linux-kernel.target;
+
   kernel = (buildPackages.linux_latest.override {
     structuredExtraConfig = with lib.kernel; {
       VIRTIO = yes;
@@ -70,13 +82,7 @@ let
     };
   }).overrideAttrs ({ installFlags ? [], ... }: {
     installFlags = installFlags ++ [
-      # vmlinux.bin is the stripped version of vmlinux.
-      # Confusingly, compressed/vmlinux.bin is the stripped version of
-      # the top-level vmlinux target, while the top-level vmlinux.bin
-      # is the stripped version of compressed/vmlinux.  So we use
-      # compressed/vmlinux.bin, since we want a stripped version of
-      # the kernel that *hasn't* been built to be compressed.  Weird!
-      "KBUILD_IMAGE=$(boot)/compressed/vmlinux.bin"
+      "KBUILD_IMAGE=$(boot)/${kernelTarget}"
     ];
   });
 in
@@ -90,7 +96,7 @@ stdenvNoCC.mkDerivation {
   nativeBuildInputs = [ jq lseek s6-rc tar2ext4 util-linux ];
 
   PACKAGES_TAR = packagesTar;
-  KERNEL = "${kernel}/vmlinux.bin";
+  KERNEL = "${kernel}/${baseNameOf kernelTarget}";
 
   makeFlags = [ "prefix=$(out)" ];