summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-11-26 22:34:43 +0100
committerAlyssa Ross <hi@alyssa.is>2023-12-05 14:46:50 +0100
commitc1237194b7f0e4c8354b71ffc8f37f567bda7b33 (patch)
treebc0384e7674fc94b1ff8232f6fcc61982b6e51c0
parent109d87a0804fec3f9e07642099c12067d7b06277 (diff)
downloadspectrum-c1237194b7f0e4c8354b71ffc8f37f567bda7b33.tar
spectrum-c1237194b7f0e4c8354b71ffc8f37f567bda7b33.tar.gz
spectrum-c1237194b7f0e4c8354b71ffc8f37f567bda7b33.tar.bz2
spectrum-c1237194b7f0e4c8354b71ffc8f37f567bda7b33.tar.lz
spectrum-c1237194b7f0e4c8354b71ffc8f37f567bda7b33.tar.xz
spectrum-c1237194b7f0e4c8354b71ffc8f37f567bda7b33.tar.zst
spectrum-c1237194b7f0e4c8354b71ffc8f37f567bda7b33.zip
Revert "vm: build command line into kernels"
This reverts commit 5f556f806a70f3787fe725254ccf3d245bd5bebc.

This turns out to not really be workable on aarch64 at the moment,
without giving things up — both crosvm and Cloud Hypervisor inject
earlycon parameters onto the command line, which overrides the
built-in command line.  We could use CONFIG_CMDLINE_FORCE, but then we
wouldn't know which serial console to use, because crosvm and Cloud
Hypervisor both use different ones.

There's discussion about making it possible to have the bootloader
command line append to the built-in command line, but it's moving
extremely slowly, so we can't count on it any time soon.

Link: https://lore.kernel.org/lkml/20231110013817.2378507-1-danielwa@cisco.com/
Signed-off-by: Alyssa Ross <hi@alyssa.is>
-rw-r--r--host/start-vm/lib.rs1
-rw-r--r--host/start-vm/tests/vm_command-basic.rs2
-rw-r--r--img/app/Makefile4
-rw-r--r--img/app/default.nix2
-rw-r--r--release/checks/wayland/default.nix4
-rw-r--r--vm/sys/net/Makefile4
-rw-r--r--vm/sys/net/default.nix2
7 files changed, 11 insertions, 8 deletions
diff --git a/host/start-vm/lib.rs b/host/start-vm/lib.rs
index 16d8fe3..32ba34d 100644
--- a/host/start-vm/lib.rs
+++ b/host/start-vm/lib.rs
@@ -60,6 +60,7 @@ pub fn vm_command(dir: &Path, api_socket_fd: RawFd) -> Result<Command, String> {
 
     let mut command = Command::new("cloud-hypervisor");
     command.args(["--api-socket", &format!("fd={api_socket_fd}")]);
+    command.args(["--cmdline", "console=ttyS0 root=PARTLABEL=root"]);
     command.args(["--memory", "size=128M,shared=on"]);
     command.args(["--console", "pty"]);
     command.arg("--kernel");
diff --git a/host/start-vm/tests/vm_command-basic.rs b/host/start-vm/tests/vm_command-basic.rs
index 3b8ef0e..0abe23b 100644
--- a/host/start-vm/tests/vm_command-basic.rs
+++ b/host/start-vm/tests/vm_command-basic.rs
@@ -29,6 +29,8 @@ fn main() -> std::io::Result<()> {
     let expected_args = vec![
         OsStr::new("--api-socket"),
         OsStr::new("fd=4"),
+        OsStr::new("--cmdline"),
+        OsStr::new("console=ttyS0 root=PARTLABEL=root"),
         OsStr::new("--memory"),
         OsStr::new("size=128M,shared=on"),
         OsStr::new("--console"),
diff --git a/img/app/Makefile b/img/app/Makefile
index 8137c48..8ac20c8 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -104,7 +104,7 @@ run-qemu: $(imgdir)/appvm/blk/root.img start-virtiofsd
 	@../../scripts/run-qemu.sh -m 128 -cpu host -kernel $(KERNEL) -vga none \
 	    -drive file=$(imgdir)/appvm/blk/root.img,if=virtio,format=raw,readonly=on \
 	    -drive file=$(RUN_IMG),if=virtio,format=raw,readonly=on \
-	    -append nokaslr \
+	    -append "root=PARTLABEL=root nokaslr" \
 	    -gdb unix:build/gdb.sock,server,nowait \
 	    -netdev user,id=net0 \
 	    -device virtio-net,netdev=net0,mac=0A:B3:EC:00:00:00 \
@@ -127,6 +127,7 @@ run-cloud-hypervisor: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-vi
 	    --fs tag=virtiofs0,socket=build/virtiofsd.sock \
 	    --gpu socket=build/vhost-user-gpu.sock \
 	    --kernel $(KERNEL) \
+	    --cmdline "root=PARTLABEL=root" \
 	    --console tty \
 	    --serial pty
 .PHONY: run-cloud-hypervisor
@@ -135,6 +136,7 @@ run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
 	$(CROSVM_RUN) \
 	    --disk $(imgdir)/appvm/blk/root.img \
 	    --disk $(RUN_IMG) \
+	    -p "console=ttyS0 root=PARTLABEL=root" \
 	    --vhost-user-fs build/virtiofsd.sock:virtiofs0 \
 	    --vhost-user-gpu build/vhost-user-gpu.sock \
 	    --serial type=file,hardware=serial,path=build/crosvm.log \
diff --git a/img/app/default.nix b/img/app/default.nix
index 2bdf24d..fa282ab 100644
--- a/img/app/default.nix
+++ b/img/app/default.nix
@@ -53,8 +53,6 @@ let
 
   kernel = (linux_latest.override {
     structuredExtraConfig = with lib.kernel; {
-      CMDLINE_BOOL = yes;
-      CMDLINE = freeform "console=ttyS0 root=PARTLABEL=root";
       VIRTIO = yes;
       VIRTIO_PCI = yes;
       VIRTIO_BLK = yes;
diff --git a/release/checks/wayland/default.nix b/release/checks/wayland/default.nix
index d58e3b8..671ebe3 100644
--- a/release/checks/wayland/default.nix
+++ b/release/checks/wayland/default.nix
@@ -19,13 +19,13 @@ nixosTest ({ lib, pkgs, ... }: {
     systemd.services.cloud-hypervisor = {
       after = [ "crosvm-gpu.service" "weston.service" ];
       requires = [ "crosvm-gpu.service" "weston.service" ];
-      serviceConfig.ExecStart = "${lib.getExe pkgs.cloud-hypervisor} --memory shared=on --disk path=${appvm}/img/appvm/blk/root.img,readonly=on --disk path=${run}/blk/run.img,readonly=on --gpu socket=/run/crosvm-gpu.sock --serial tty --console null --kernel ${appvm}/img/appvm/vmlinux";
+      serviceConfig.ExecStart = "${lib.getExe pkgs.cloud-hypervisor} --memory shared=on --disk path=${appvm}/img/appvm/blk/root.img,readonly=on --disk path=${run}/blk/run.img,readonly=on --cmdline \"console=ttyS0 root=PARTLABEL=root\" --gpu socket=/run/crosvm-gpu.sock --serial tty --console null --kernel ${appvm}/img/appvm/vmlinux";
     };
 
     systemd.services.crosvm = {
       after = [ "crosvm-gpu.service" "weston.service" ];
       requires = [ "crosvm-gpu.service" "weston.service" ];
-      serviceConfig.ExecStart = "${lib.getExe pkgs.crosvm} run -s /run/crosvm --disk ${appvm}/img/appvm/blk/root.img --disk ${run}/blk/run.img --vhost-user-gpu /run/crosvm-gpu.sock --serial type=stdout,hardware=virtio-console,stdin=true ${appvm}/img/appvm/vmlinux";
+      serviceConfig.ExecStart = "${lib.getExe pkgs.crosvm} run -s /run/crosvm --disk ${appvm}/img/appvm/blk/root.img --disk ${run}/blk/run.img -p \"console=ttyS0 root=PARTLABEL=root\" --vhost-user-gpu /run/crosvm-gpu.sock --serial type=stdout,hardware=virtio-console,stdin=true ${appvm}/img/appvm/vmlinux";
       serviceConfig.ExecStop = "${lib.getExe pkgs.crosvm} stop /run/crosvm";
     };
 
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index 5e65f92..df1db8a 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -101,7 +101,7 @@ debug:
 run-qemu: build/host/data/netvm/blk/root.img
 	@../../../scripts/run-qemu.sh -m 128 -cpu host -kernel $(KERNEL) -vga none \
 	    -drive file=build/host/data/netvm/blk/root.img,if=virtio,format=raw,readonly=on \
-	    -append nokaslr \
+	    -append "root=PARTLABEL=root nokaslr" \
 	    -gdb unix:build/gdb.sock,server,nowait \
 	    -netdev user,id=net0 \
 	    -device e1000e,netdev=net0 \
@@ -121,6 +121,7 @@ run-cloud-hypervisor: build/host/data/netvm/blk/root.img
 	    --net tap=tap0 \
 	    --net tap=tap1,mac=0A:B3:EC:80:00:00 \
 	    --kernel $(KERNEL) \
+	    --cmdline "root=PARTLABEL=root" \
 	    --console tty \
 	    --serial pty
 .PHONY: run-cloud-hypervisor
@@ -128,6 +129,7 @@ run-cloud-hypervisor: build/host/data/netvm/blk/root.img
 run-crosvm: build/host/data/netvm/blk/root.img
 	$(CROSVM_RUN) \
 	    --disk build/host/data/netvm/blk/root.img \
+	    -p "console=ttyS0 root=PARTLABEL=root" \
 	    --net tap-name=tap0 \
 	    --net tap-name=tap1,mac=0A:B3:EC:80:00:00 \
 	    --serial type=file,hardware=serial,path=build/crosvm.log \
diff --git a/vm/sys/net/default.nix b/vm/sys/net/default.nix
index e88b2ba..6a746a2 100644
--- a/vm/sys/net/default.nix
+++ b/vm/sys/net/default.nix
@@ -61,8 +61,6 @@ let
 
   kernel = (linux_latest.override {
     structuredExtraConfig = with lib.kernel; {
-      CMDLINE_BOOL = yes;
-      CMDLINE = freeform "console=ttyS0 root=PARTLABEL=root";
       VIRTIO = yes;
       VIRTIO_PCI = yes;
       VIRTIO_BLK = yes;