summary refs log tree commit diff
path: root/vm
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-04-25 16:20:13 +0000
committerAlyssa Ross <hi@alyssa.is>2023-04-27 23:35:50 +0000
commitb571cee2499c445f7a542c8bb09789dcb8d65890 (patch)
treeeeed4f9d1003f5af6a748218555ca1ba66428564 /vm
parent69393c7c80c43349c907d516c69eaf557b443304 (diff)
downloadspectrum-b571cee2499c445f7a542c8bb09789dcb8d65890.tar
spectrum-b571cee2499c445f7a542c8bb09789dcb8d65890.tar.gz
spectrum-b571cee2499c445f7a542c8bb09789dcb8d65890.tar.bz2
spectrum-b571cee2499c445f7a542c8bb09789dcb8d65890.tar.lz
spectrum-b571cee2499c445f7a542c8bb09789dcb8d65890.tar.xz
spectrum-b571cee2499c445f7a542c8bb09789dcb8d65890.tar.zst
spectrum-b571cee2499c445f7a542c8bb09789dcb8d65890.zip
vm: use a stripped vmlinux
This reduces the combined image from 9.1G to 7.2G, and also gets us
away from using the vmlinux from dev, which we wouldn't be able to do
on aarch64 anyway.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'vm')
-rw-r--r--vm/sys/net/default.nix16
1 files changed, 13 insertions, 3 deletions
diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
index 94dadf6..1914b6a 100644
--- a/vm/sys/net/default.nix
+++ b/vm/sys/net/default.nix
@@ -60,7 +60,7 @@ let
         -T ${writeReferencesToFile packagesSysroot} .
   '';
 
-  kernel = buildPackages.linux.override {
+  kernel = (buildPackages.linux_latest.override {
     structuredExtraConfig = with lib.kernel; {
       VIRTIO = yes;
       VIRTIO_PCI = yes;
@@ -68,7 +68,17 @@ let
       VIRTIO_CONSOLE = yes;
       EXT4_FS = yes;
     };
-  };
+  }).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"
+    ];
+  });
 in
 
 stdenvNoCC.mkDerivation {
@@ -80,7 +90,7 @@ stdenvNoCC.mkDerivation {
   nativeBuildInputs = [ jq lseek s6-rc tar2ext4 util-linux ];
 
   PACKAGES_TAR = packagesTar;
-  KERNEL = "${kernel.dev}/vmlinux";
+  KERNEL = "${kernel}/vmlinux.bin";
 
   makeFlags = [ "prefix=$(out)" ];