| 302 | } |
| 303 | |
| 304 | fn build_kernel_cmdline(config: &VmLaunchConfig) -> String { |
| 305 | let mut parts = vec![ |
| 306 | "console=ttyS0".to_string(), |
| 307 | "root=/dev/vda".to_string(), |
| 308 | "rootfstype=ext4".to_string(), |
| 309 | "ro".to_string(), |
| 310 | "panic=-1".to_string(), |
| 311 | format!("init={}", config.exec_path), |
| 312 | ]; |
| 313 | |
| 314 | if let Some(ip) = &config.guest_ip |
| 315 | && let Some(host_ip) = &config.host_ip |
| 316 | { |
| 317 | parts.push(format!("ip={ip}::{host_ip}:255.255.255.252:sandbox::off")); |
| 318 | } |
| 319 | |
| 320 | if config.gpu_bdf.is_some() { |
| 321 | parts.push("firmware_class.path=/lib/firmware".to_string()); |
| 322 | } |
| 323 | |
| 324 | parts.join(" ") |
| 325 | } |
| 326 | |
| 327 | fn host_dns_server() -> Option<String> { |
| 328 | // Prefer systemd-resolved upstream config (skips the 127.0.0.53 |