Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ docs/

qboot
console.log
qboot-test-library
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ QBoot is a command-line tool written in D that wraps QEMU to provide a streamlin

- **Zero-config startup**: Works out of the box with sensible defaults
- **JSON configuration**: Persistent settings via `~/.config/qboot/config.json`
- **Interactive and headless modes**: GUI or console-only operation
- **Graphical and headless modes**: GUI or console-only operation
- **Snapshot support**: Choose whether to persist changes
- **Multi-architecture support**: Works with x86_64, aarch64, ppc64le, and s390x
- **KVM acceleration**: Automatic hardware acceleration when available
- **SSH-ready networking**: Built-in port forwarding for easy access
- **Comprehensive testing**: Full test suite with >95% coverage
Expand All @@ -38,28 +39,33 @@ make install
# Launch a VM with a disk image
./qboot -d /path/to/your/disk.img

# Interactive mode with GUI
./qboot -d disk.img --interactive
# Graphical mode
./qboot -d disk.img -g

# Custom CPU and RAM settings
./qboot -d disk.img --cpu 4 --ram 8

# Headless mode with persistent changes
./qboot -d disk.img --no-snapshot
./qboot -d disk.img -w

# Show command before running
./qboot -d disk.img --confirm
```

## Command Line Options

| Option | Short | Description | Default |
|--------|-------|-------------|---------|
| `--arch` | `-a` | CPU architecture (`x86_64`, `aarch64`, etc.) | `x86_64` |
| `--disk` | `-d` | Path to disk image (required) | - |
| `--cpu` | `-c` | Number of CPU cores | 2 |
| `--ram` | `-r` | RAM in GB | 4 |
| `--interactive` | `-i` | Enable GUI mode | false |
| `--no-snapshot` | `-S` | Persist changes to disk | false |
| `--log` | `-l` | Serial console log file | console.log |
| `--ssh-port` | - | SSH port forwarding | 2222 |
| `--help` | `-h` | Show help message | - |
| `--graphical` | `-g` | Enable graphical console | false |
| `--write-mode` | `-w` | Persist changes to disk (disables snapshot) | false |
| `--ssh-port` | `-p` | Host port for SSH forwarding | 2222 |
| `--log-file` | `-l` | Serial console log file | `qboot.log` |
| `--confirm` | | Show command and wait for keypress before starting | false |
| `--help` | | Show help message | - |

## Configuration

Expand All @@ -68,11 +74,11 @@ QBoot automatically creates a configuration file at `~/.config/qboot/config.json
```json
{
"description": "Default configuration for qboot. Edit these values to fit your workflow.",
"arch": "x86_64",
"cpu": 2,
"ram_gb": 4,
"ssh_port": 2222,
"log_file": "console.log",
"headless_saves_changes": false
"ramGb": 4,
"sshPort": 2222,
"logFile": "qboot.log"
}
```

Expand All @@ -87,13 +93,13 @@ Configuration values are applied in this order (highest priority first):

```bash
# Start a development VM with GUI
qboot -d ubuntu-dev.img -i -c 4 -r 8
qboot -d ubuntu-dev.img -g -c 4 -r 8

# Quick headless test (changes discarded)
qboot -d test-image.img

# Persistent headless server
qboot -d server.img -S --ssh-port 2223
qboot -d server.img -w --ssh-port 2223
```

### SSH Access
Expand All @@ -109,7 +115,7 @@ ssh -p 2222 user@localhost
Monitor the VM's serial console:

```bash
tail -f console.log
tail -f qboot.log
```

## Architecture
Expand All @@ -129,11 +135,8 @@ QBoot generates commands similar to:
qemu-system-x86_64 \
-enable-kvm -cpu host \
-smp 2 -m 4G \
-mem-path /dev/hugepages \
-drive file=disk.img,if=virtio,cache=none,aio=native,discard=unmap \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-device virtio-net-pci,netdev=net0 \
-nographic -snapshot
-netdev user,id=net0,hostfwd=tcp::2222
```

## Development
Expand Down Expand Up @@ -283,4 +286,4 @@ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENS

**Happy virtualizing!** 🎉

If you find QBoot useful, please consider giving it a ⭐ on GitHub!
If you find QBoot useful, please consider giving it a ⭐ on GitHub!
50 changes: 50 additions & 0 deletions source/aarch64.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module aarch64;

import vm;
import std.format;

/**
* Concrete implementation of the VirtualMachine for aarch64 architecture.
*/
class AARCH64_VM : VirtualMachine
{
/// Returns the name of the QEMU binary for the specific architecture.
override string qemuBinary()
{
return "qemu-system-aarch64";
}

/// Returns an array of architecture-specific QEMU arguments.
override string[] getArchArgs()
{
// This requires a UEFI firmware file. A common path is provided.
// Users might need to install it via their package manager
// (e.g., qemu-efi-aarch64 on Debian/Ubuntu).
return [
"-machine", "virt",
"-cpu", "max",
"-bios", "/usr/share/qemu/aavmf-aarch64-code.bin"

];
}

/// Returns an array of QEMU arguments for attaching the disk.
override string[] getDiskArgs()
{
return [
"-drive",
format("file=%s,if=virtio,cache=none,aio=native,discard=unmap", diskPath)
];
}

/// Returns an array of QEMU arguments for networking.
override string[] getNetworkArgs()
{
return [
"-netdev",
format("user,id=net0,hostfwd=tcp::%d-:22", sshPort),
"-device",
"virtio-net-pci,netdev=net0"
];
}
}
Loading
Loading