Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SupportedEmulatorArchitectures ¶
func SupportedEmulatorArchitectures() []hv.CpuArchitecture
SupportedEmulatorArchitectures returns the list of architectures we can emulate.
Types ¶
type BinfmtConfig ¶
type BinfmtConfig struct {
// Name is the registration name (e.g., "qemu-aarch64").
Name string
// Magic is the ELF magic bytes to match.
Magic []byte
// Mask is the mask for matching (0xff means exact match, 0x00 means ignore).
Mask []byte
// Interpreter is the path to the QEMU binary.
Interpreter string
// Flags are the binfmt-misc flags (typically "OCF").
// O = preserve-argv0, C = credentials, F = fix-binary (keeps binary in memory)
Flags string
}
BinfmtConfig contains the binfmt-misc registration data for an architecture.
func GetBinfmtConfig ¶
func GetBinfmtConfig(arch hv.CpuArchitecture) (BinfmtConfig, bool)
GetBinfmtConfig returns the binfmt-misc configuration for the given architecture.
func (BinfmtConfig) RegistrationString ¶
func (c BinfmtConfig) RegistrationString() string
RegistrationString returns the string to write to /proc/sys/fs/binfmt_misc/register. Format: :name:type:offset:magic:mask:interpreter:flags Note: When offset is 0, we use :: (empty) instead of :0: for compatibility. Note: There is NO trailing colon after flags - the kernel parses until NUL.
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader downloads QEMU user emulation packages from Alpine's community repository.
func NewDownloader ¶
func NewDownloader(hostArch hv.CpuArchitecture, cacheDir string) (*Downloader, error)
NewDownloader creates a new QEMU downloader. The hostArch parameter determines which Alpine repository to use (the QEMU static binaries need to be compiled for the host architecture).
func (*Downloader) DownloadEmulator ¶
func (d *Downloader) DownloadEmulator(targetArch hv.CpuArchitecture) ([]byte, error)
DownloadEmulator downloads and extracts the QEMU binary for the given target architecture. Returns the binary data ready to be written to the guest filesystem.
type EmulatorInfo ¶
type EmulatorInfo struct {
// TargetArch is the architecture this emulator can run binaries for.
TargetArch hv.CpuArchitecture
// PackageName is the Alpine package name (e.g., "qemu-aarch64").
PackageName string
// BinaryPath is the path inside the APK (e.g., "usr/bin/qemu-aarch64").
BinaryPath string
// GuestPath is where to install the binary in the guest (e.g., "/usr/bin/qemu-aarch64-static").
GuestPath string
}
EmulatorInfo describes a QEMU static binary for a target architecture.
func GetEmulatorInfo ¶
func GetEmulatorInfo(targetArch hv.CpuArchitecture) (EmulatorInfo, bool)
GetEmulatorInfo returns the emulator info for the given target architecture.