| 72 | } |
| 73 | |
| 74 | static void PrintUsage(const char* prog) { |
| 75 | PrintVersion(); |
| 76 | fprintf(stderr, |
| 77 | "\nUsage: %s --kernel <path> [options]\n" |
| 78 | "\n" |
| 79 | "Options:\n" |
| 80 | " --vm-id <id> Runtime vm id (default: default)\n" |
| 81 | " --vm-dir <path> VM working directory (crash dumps land under <dir>/crash)\n" |
| 82 | " --control-endpoint <name>\n" |
| 83 | #ifdef _WIN32 |
| 84 | " Named pipe endpoint (without \\\\.\\pipe\\ prefix)\n" |
| 85 | #else |
| 86 | " Unix domain socket path\n" |
| 87 | #endif |
| 88 | " --interactive on|off Console mode (default: on)\n" |
| 89 | " --kernel <path> Path to vmlinuz / Image (required)\n" |
| 90 | " --initrd <path> Path to initramfs\n" |
| 91 | " --disk <path> Path to raw / qcow2 disk image\n" |
| 92 | " --cmdline <str> Kernel command line\n" |
| 93 | " --memory <MB> Guest RAM in MB (default: 256)\n" |
| 94 | " --cpus <N> Number of vCPUs (default: 1, max: 128)\n" |
| 95 | " --net Start with network link up (default: link down)\n" |
| 96 | " --debug Enable debug mode (verbose kernel output)\n" |
| 97 | " --hostfwd <spec> Port forward (repeatable), e.g.:\n" |
| 98 | " tcp:127.0.0.1:8080-:80 (loopback)\n" |
| 99 | " tcp:0.0.0.0:8080-:80 (LAN accessible)\n" |
| 100 | " --guestfwd <spec> Guest forward (repeatable), e.g.:\n" |
| 101 | " guestfwd:10.0.2.3:80-:18981\n" |
| 102 | " guestfwd:10.0.2.3:80-127.0.0.1:18981\n" |
| 103 | " --share TAG:PATH[:ro] Share host directory (repeatable)\n" |
| 104 | " --version Show version\n" |
| 105 | " --help Show this help\n", |
| 106 | prog); |
| 107 | } |
| 108 | |
| 109 | int main(int argc, char* argv[]) { |
| 110 | #ifdef _WIN32 |