feat: download alpine linux-virt kernel for single --kernel

This commit is contained in:
2026-06-19 16:46:23 +02:00
parent 1d2031b3ca
commit 3188566b6e
6 changed files with 413 additions and 26 deletions
+14 -6
View File
@@ -38,7 +38,7 @@ 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 |
| `--kernel [PATH]` | Boot with QEMU system emulation. Downloads Alpine's `linux-virt` kernel if no path provided |
| `-m, --memory <SIZE>` | Memory for QEMU VM (default: 2G, only with `--kernel`) |
## Examples
@@ -59,11 +59,14 @@ ecr --arch arm64 alpine -- uname -m
# Always pull a fresh image
ecr --no-cache fedora
# Boot with QEMU system emulation (requires qemu-system-<arch>)
# Boot with QEMU system emulation (auto-downloads default kernel)
ecr --kernel alpine
# Boot with your own kernel
ecr --kernel /boot/vmlinuz ubuntu
# Boot with custom memory
ecr --kernel /boot/vmlinuz --memory 4G alpine
ecr --kernel --memory 4G alpine
```
## QEMU System Mode
@@ -71,18 +74,23 @@ ecr --kernel /boot/vmlinuz --memory 4G alpine
When `--kernel` is specified, ecr boots the rootfs in a full QEMU virtual machine instead of using namespaces:
```sh
ecr --kernel /boot/vmlinuz alpine
# Auto-download Alpine's linux-virt kernel (recommended)
ecr --kernel alpine
# Use your own kernel
ecr --kernel /boot/vmlinuz ubuntu
```
This mode:
- Creates a gzipped CPIO initramfs from the rootfs
- Boots QEMU with your kernel
- Boots QEMU with your kernel (or auto-downloads Alpine's `linux-virt` kernel)
- Provides full VM isolation
- Works for any architecture (no binfmt_misc needed)
- Caches the default kernel in `~/.cache/ecr/`
Requirements:
- `qemu-system-<arch>` installed
- Kernel with serial console support
- For custom kernels: kernel must have serial console support
## Supported distributions