Skip to content
Draft
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
14 changes: 14 additions & 0 deletions pkg/instance/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ func Prepare(ctx context.Context, inst *store.Instance) (*Prepared, error) {
kernel := filepath.Join(inst.Dir, filenames.Kernel)
kernelCmdline := filepath.Join(inst.Dir, filenames.KernelCmdline)
initrd := filepath.Join(inst.Dir, filenames.Initrd)
entrypoint := filepath.Join(inst.Dir, filenames.Entrypoint)
stopsignal := filepath.Join(inst.Dir, filenames.StopSignal)
if _, err := os.Stat(baseDisk); errors.Is(err, os.ErrNotExist) {
var ensuredBaseDisk bool
errs := make([]error, len(inst.Config.Images))
Expand Down Expand Up @@ -137,6 +139,18 @@ func Prepare(ctx context.Context, inst *store.Instance) (*Prepared, error) {
continue
}
}
if f.Entrypoint != nil {
if err := os.WriteFile(entrypoint, []byte(*f.Entrypoint), 0o644); err != nil {
errs[i] = err
continue
}
}
if f.Stopsignal != nil {
if err := os.WriteFile(stopsignal, []byte(*f.Stopsignal), 0o644); err != nil {
errs[i] = err
continue
}
}
ensuredBaseDisk = true
break
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/limayaml/limayaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,11 @@ type Kernel struct {
}

type Image struct {
File `yaml:",inline"`
Kernel *Kernel `yaml:"kernel,omitempty" json:"kernel,omitempty"`
Initrd *File `yaml:"initrd,omitempty" json:"initrd,omitempty"`
File `yaml:",inline"`
Kernel *Kernel `yaml:"kernel,omitempty" json:"kernel,omitempty"`
Initrd *File `yaml:"initrd,omitempty" json:"initrd,omitempty"`
Entrypoint *string `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
Stopsignal *string `yaml:"stopsignal,omitempty" json:"stopsignal,omitempty"`
}

type Disk struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/store/filenames/filenames.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const (
Kernel = "kernel"
KernelCmdline = "kernel.cmdline"
Initrd = "initrd"
Entrypoint = "entrypoint"
StopSignal = "stopsignal"
QMPSock = "qmp.sock"
SerialLog = "serial.log" // default serial (ttyS0, but ttyAMA0 on qemu-system-{arm,aarch64})
SerialSock = "serial.sock"
Expand Down
4 changes: 4 additions & 0 deletions website/content/en/docs/dev/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ kernel:
- `kernel.cmdline`: the kernel cmdline
- `initrd`: the initrd

container:
- `entrypoint`: the entrypoint to use (optional)
- `stopsignal`: the stopsignal to use (optional)

QEMU:
- `qemu.pid`: QEMU PID
- `qmp.sock`: QMP socket
Expand Down
Loading