-
Notifications
You must be signed in to change notification settings - Fork 43
/
bootiso_stage.go
85 lines (65 loc) · 1.83 KB
/
bootiso_stage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package osbuild
type BootISOMonoStageOptions struct {
Product Product `json:"product"`
Kernel string `json:"kernel"`
ISOLabel string `json:"isolabel"`
EFI EFI `json:"efi,omitempty"`
ISOLinux ISOLinux `json:"isolinux,omitempty"`
// Additional kernel boot options
KernelOpts string `json:"kernel_opts,omitempty"`
Templates string `json:"templates,omitempty"`
RootFS RootFS `json:"rootfs,omitempty"`
}
type EFI struct {
Architectures []string `json:"architectures"`
Vendor string `json:"vendor"`
}
type ISOLinux struct {
Enabled bool `json:"enabled"`
Debug bool `json:"debug,omitempty"`
}
type RootFS struct {
Compression FSCompression `json:"compression"`
// Size in MiB
Size int `json:"size"`
}
type FSCompression struct {
Method string `json:"method"`
Options *FSCompressionOptions `json:"options,omitempty"`
}
type FSCompressionOptions struct {
BCJ string `json:"bcj"`
}
// BCJOption returns the appropriate xz branch/call/jump (BCJ) filter for the
// given architecture
func BCJOption(arch string) string {
switch arch {
case "x86_64":
return "x86"
case "aarch64":
return "arm"
case "ppc64le":
return "powerpc"
}
return ""
}
func (BootISOMonoStageOptions) isStageOptions() {}
type BootISOMonoStageInputs struct {
RootFS *TreeInput `json:"rootfs"`
Kernel *TreeInput `json:"kernel,omitempty"`
}
func (BootISOMonoStageInputs) isStageInputs() {}
// Assemble a file system tree for a bootable ISO
func NewBootISOMonoStage(options *BootISOMonoStageOptions, inputs *BootISOMonoStageInputs) *Stage {
return &Stage{
Type: "org.osbuild.bootiso.mono",
Options: options,
Inputs: inputs,
}
}
func NewBootISOMonoStagePipelineTreeInputs(pipeline string) *BootISOMonoStageInputs {
rootfsInput := NewTreeInput("name:" + pipeline)
return &BootISOMonoStageInputs{
RootFS: rootfsInput,
}
}