Blame internal/osbuild1/qemu_assembler.go

Packit Service 15f37d
package osbuild1
Packit Service 15f37d
Packit Service 15f37d
// QEMUAssemblerOptions desrcibe how to assemble a tree into an image using qemu.
Packit Service 15f37d
//
Packit Service 15f37d
// The assembler creates an image of the given size, adds a GRUB2 bootloader
Packit Service 15f37d
// and if necessary and a partition table to it with the given PTUUID
Packit Service 15f37d
// containing the indicated partitions. Finally, the image is converted into
Packit Service 15f37d
// the target format and stored with the given filename.
Packit Service 15f37d
type QEMUAssemblerOptions struct {
Packit Service 15f37d
	Bootloader *QEMUBootloader `json:"bootloader,omitempty"`
Packit Service 15f37d
	Format     string          `json:"format"`
Packit Service 15f37d
	Filename   string          `json:"filename"`
Packit Service 15f37d
	Size       uint64          `json:"size"`
Packit Service 15f37d
	PTUUID     string          `json:"ptuuid"`
Packit Service 15f37d
	PTType     string          `json:"pttype"`
Packit Service 15f37d
	Partitions []QEMUPartition `json:"partitions"`
Packit Service 15f37d
}
Packit Service 15f37d
Packit Service 15f37d
type QEMUPartition struct {
Packit Service 15f37d
	Start      uint64          `json:"start"`
Packit Service 15f37d
	Size       uint64          `json:"size,omitempty"`
Packit Service 15f37d
	Type       string          `json:"type,omitempty"`
Packit Service 15f37d
	Bootable   bool            `json:"bootable,omitempty"`
Packit Service 15f37d
	UUID       string          `json:"uuid,omitempty"`
Packit Service 15f37d
	Filesystem *QEMUFilesystem `json:"filesystem,omitempty"`
Packit Service 15f37d
}
Packit Service 15f37d
Packit Service 15f37d
type QEMUFilesystem struct {
Packit Service 15f37d
	Type       string `json:"type"`
Packit Service 15f37d
	UUID       string `json:"uuid"`
Packit Service 15f37d
	Label      string `json:"label,omitempty"`
Packit Service 15f37d
	Mountpoint string `json:"mountpoint"`
Packit Service 15f37d
}
Packit Service 15f37d
Packit Service 15f37d
type QEMUBootloader struct {
Packit Service 15f37d
	Type     string `json:"type,omitempty"`
Packit Service 15f37d
	Platform string `json:"platform,omitempty"`
Packit Service 15f37d
}
Packit Service 15f37d
Packit Service 15f37d
func (QEMUAssemblerOptions) isAssemblerOptions() {}
Packit Service 15f37d
Packit Service 15f37d
// NewQEMUAssembler creates a new QEMU Assembler object.
Packit Service 15f37d
func NewQEMUAssembler(options *QEMUAssemblerOptions) *Assembler {
Packit Service 15f37d
	return &Assembler{
Packit Service 15f37d
		Name:    "org.osbuild.qemu",
Packit Service 15f37d
		Options: options,
Packit Service 15f37d
	}
Packit Service 15f37d
}