feat: add --kernel flag for QEMU system emulation mode
Add --kernel <PATH> option to boot extracted rootfs in a QEMU virtual machine instead of namespace/chroot mode. The rootfs is converted to an ext4 disk image using mke2fs and booted with the provided kernel.
This commit is contained in:
@@ -38,6 +38,8 @@ ecr [OPTIONS] <DISTRO[:VERSION]> [-- COMMAND...]
|
||||
| `--no-cache` | Force a fresh download, bypassing the cache |
|
||||
| `-v, --verbose` | Print diagnostic output (URLs, layer info, extraction steps) |
|
||||
| `-a, --arch <ARCH>` | Target architecture (`amd64`, `arm64`, `armhf`, `riscv64`, …) |
|
||||
| `--kernel <PATH>` | Boot with QEMU system emulation using specified kernel |
|
||||
| `-m, --memory <SIZE>` | Memory for QEMU VM (default: 2G, only with `--kernel`) |
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -56,8 +58,33 @@ ecr --arch arm64 alpine -- uname -m
|
||||
|
||||
# Always pull a fresh image
|
||||
ecr --no-cache fedora
|
||||
|
||||
# Boot with QEMU system emulation (requires qemu-system-<arch> and e2fsprogs)
|
||||
ecr --kernel /boot/vmlinuz ubuntu
|
||||
|
||||
# Boot with custom memory
|
||||
ecr --kernel /boot/vmlinuz --memory 4G alpine
|
||||
```
|
||||
|
||||
## QEMU System Mode
|
||||
|
||||
When `--kernel` is specified, ecr boots the rootfs in a full QEMU virtual machine instead of using namespaces:
|
||||
|
||||
```sh
|
||||
ecr --kernel /boot/vmlinuz alpine
|
||||
```
|
||||
|
||||
This mode:
|
||||
- Creates an ext4 disk image from the rootfs
|
||||
- Boots QEMU with your kernel
|
||||
- Provides full VM isolation
|
||||
- Works for any architecture (no binfmt_misc needed)
|
||||
|
||||
Requirements:
|
||||
- `qemu-system-<arch>` installed
|
||||
- `e2fsprogs` for disk image creation
|
||||
- Kernel with virtio support
|
||||
|
||||
## Supported distributions
|
||||
|
||||
| Name | Source | Version examples |
|
||||
|
||||
Reference in New Issue
Block a user