@@ -40,7 +40,7 @@ If `--katana` is not provided, `build.sh` prompts for confirmation (`y/N`) befor
4040| ` build-kernel.sh ` | Downloads and extracts Ubuntu kernel (` vmlinuz ` ) |
4141| ` build-initrd.sh ` | Creates minimal initrd with busybox, SEV-SNP modules, and katana |
4242| ` build-config ` | Pinned versions and checksums for reproducible builds |
43- | ` start-vm.sh ` | Starts a TEE VM with SEV-SNP enabled using QEMU |
43+ | ` start-vm.sh ` | Starts a TEE VM with SEV-SNP and launches Katana asynchronously |
4444
4545## SNP Tools
4646
@@ -69,6 +69,9 @@ cargo build -p snp-tools
6969
7070## Running
7171
72+ The QEMU command below boots the VM but does not automatically start Katana.
73+ Katana must be started asynchronously via the control channel.
74+
7275``` sh
7376qemu-system-x86_64 \
7477 # Use KVM hardware virtualization (required for SEV-SNP)
@@ -93,11 +96,42 @@ qemu-system-x86_64 \
9396 # Initial ramdisk containing katana (measured when kernel-hashes=on)
9497 -initrd output/qemu/initrd.img \
9598 # Kernel command line (measured when kernel-hashes=on)
96- # katana.args passes arguments to katana via init script
97- -append " console=ttyS0 katana.args=--http.addr,0.0.0.0,--http.port,5050,--tee.provider,sev-snp" \
99+ -append " console=ttyS0" \
100+ # Katana control channel (used to start Katana asynchronously after boot)
101+ -device virtio-serial-pci,id=virtio-serial0 \
102+ -chardev socket,id=katanactl,path=/tmp/katana-control.sock,server=on,wait=off \
103+ -device virtserialport,chardev=katanactl,name=org.katana.control.0 \
98104 ..
99105```
100106
107+ ### Start Katana via Control Channel
108+
109+ In the QEMU example above, this line defines the host-side control channel endpoint:
110+
111+ ``` sh
112+ -chardev socket,id=katanactl,path=/tmp/katana-control.sock,server=on,wait=off
113+ ```
114+
115+ The ` path=/tmp/katana-control.sock ` value is the Unix socket file on the host.
116+ That socket is connected to the guest virtio-serial port:
117+
118+ ``` sh
119+ -device virtserialport,chardev=katanactl,name=org.katana.control.0
120+ ```
121+
122+ So writes to that Unix socket become control commands inside the VM (` start ` , ` status ` ).
123+
124+ Example:
125+
126+ ``` sh
127+ # Start Katana with comma-separated CLI args
128+ printf ' start --http.addr,0.0.0.0,--http.port,5050,--tee.provider,sev-snp\n' \
129+ | socat - UNIX-CONNECT:/tmp/katana-control.sock
130+
131+ # Check launcher status
132+ printf ' status\n' | socat - UNIX-CONNECT:/tmp/katana-control.sock
133+ ```
134+
101135## Running the VM
102136
103137The ` start-vm.sh ` script provides an easy way to launch a TEE VM with SEV-SNP enabled:
@@ -108,11 +142,16 @@ sudo ./misc/AMDSEV/start-vm.sh
108142
109143# Or specify a custom boot components directory
110144sudo ./misc/AMDSEV/start-vm.sh /path/to/boot-components
145+
146+ # Or customize Katana runtime flags (comma-separated)
147+ sudo ./misc/AMDSEV/start-vm.sh --katana-args " --http.addr,0.0.0.0,--http.port,5050,--tee.provider,sev-snp,--dev"
111148```
112149
113150The script:
114151- Starts QEMU with SEV-SNP confidential computing enabled
115152- Uses direct kernel boot with kernel-hashes=on for attestation
153+ - Keeps kernel cmdline stable (` console=ttyS0 ` ) for deterministic measurement
154+ - Starts Katana asynchronously via virtio-serial control channel
116155- Forwards RPC port 5050 to host port 15051
117156- Outputs serial log to a temp file and follows it
118157
@@ -129,7 +168,7 @@ cargo build -p snp-tools
129168 --ovmf output/qemu/OVMF.fd \
130169 --kernel output/qemu/vmlinuz \
131170 --initrd output/qemu/initrd.img \
132- --append " console=ttyS0 katana.args=--http.addr,0.0.0.0,--http.port,5050,--tee.provider,sev-snp " \
171+ --append " console=ttyS0" \
133172 --vcpus 1 \
134173 --cpu epyc-v4 \
135174 --vmm qemu \
0 commit comments