diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-04-13 19:15:09 +0200 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-04-29 09:55:44 +0000 |
commit | abf73fadbc7d77c31385300395870520f7ba7e5d (patch) | |
tree | 61fd5608fc1002e5b47b5b621314a1fe967bbcd2 | |
parent | b571cee2499c445f7a542c8bb09789dcb8d65890 (diff) | |
download | spectrum-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>
-rw-r--r-- | img/app/default.nix | 22 | ||||
-rw-r--r-- | vm/sys/net/default.nix | 22 |
2 files changed, 28 insertions, 16 deletions
diff --git a/img/app/default.nix b/img/app/default.nix index 3073a0e..37561f0 100644 --- a/img/app/default.nix +++ b/img/app/default.nix @@ -51,6 +51,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; @@ -61,13 +73,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 @@ -81,7 +87,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)" ]; 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)" ]; |