-
Notifications
You must be signed in to change notification settings - Fork 50
/
efi_boot_tree.go
63 lines (53 loc) · 1.31 KB
/
efi_boot_tree.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
package manifest
import (
"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/images/pkg/osbuild"
"github.com/osbuild/images/pkg/platform"
)
type EFIBootTree struct {
Base
Platform platform.Platform
product string
version string
UEFIVendor string
ISOLabel string
KernelOpts []string
}
func NewEFIBootTree(m *Manifest, buildPipeline *Build, product, version string) *EFIBootTree {
p := &EFIBootTree{
Base: NewBase(m, "efiboot-tree", buildPipeline),
product: product,
version: version,
}
buildPipeline.addDependent(p)
m.addPipeline(p)
return p
}
func (p *EFIBootTree) serialize() osbuild.Pipeline {
pipeline := p.Base.serialize()
a := p.Platform.GetArch().String()
var architectures []string
if a == arch.ARCH_X86_64.String() {
architectures = []string{"X64"}
} else if a == arch.ARCH_AARCH64.String() {
architectures = []string{"AA64"}
} else {
panic("unsupported architecture")
}
grubOptions := &osbuild.GrubISOStageOptions{
Product: osbuild.Product{
Name: p.product,
Version: p.version,
},
Kernel: osbuild.ISOKernel{
Dir: "/images/pxeboot",
Opts: p.KernelOpts,
},
ISOLabel: p.ISOLabel,
Architectures: architectures,
Vendor: p.UEFIVendor,
}
grub2Stage := osbuild.NewGrubISOStage(grubOptions)
pipeline.AddStage(grub2Stage)
return pipeline
}