debian-forge-composer/internal/manifest/efi_boot_tree.go
Achilleas Koutsou eaf3dc2ecc manifest: always add inst.stage2 kernel option for Anaconda
The bootiso.mono stage in osbuild that we used until recently adds the
inst.stage2 option unconditionally [1] whereas the current grub2.iso
stage that we use now doesn't.

[1] 8511add169/stages/org.osbuild.bootiso.mono (L369)
2022-12-13 07:49:32 +00:00

63 lines
1.4 KiB
Go

package manifest
import (
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/osbuild"
"github.com/osbuild/osbuild-composer/internal/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()
arch := p.Platform.GetArch().String()
var architectures []string
if arch == distro.X86_64ArchName {
architectures = []string{"X64"}
} else if arch == distro.Aarch64ArchName {
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
}