distro/rhel: remove bootType from imageType and architecture
Remove the bootType from imageType and architecture structures and determine the image boot type based on its associated platform. This reflects changes which were done in Fedora when it was ported to the "new" image definitions, but were not ported to RHEL. GCE image type note: This change has a side-effect on the GCE image type. It was meant to be UEFI only, but the previous mixture of bootType set in the imageType and the platform used for it made it a weird combination of almost hybrid boot type, but not completely. For now, the grub2 BIOS-related packages are added to the image content as a result. Eventually, the platform used for the image should be changed to not support BIOS and the image should also not have BIOS partition at all. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
6601c32f7e
commit
dd6f9fdbcf
26 changed files with 421 additions and 71 deletions
|
|
@ -148,7 +148,6 @@ type architecture struct {
|
|||
imageTypes map[string]distro.ImageType
|
||||
imageTypeAliases map[string]string
|
||||
legacy string
|
||||
bootType distro.BootType
|
||||
}
|
||||
|
||||
func (a *architecture) Name() string {
|
||||
|
|
@ -231,8 +230,6 @@ type imageType struct {
|
|||
|
||||
// bootable image
|
||||
bootable bool
|
||||
// If set to a value, it is preferred over the architecture value
|
||||
bootType distro.BootType
|
||||
// List of valid arches for the image type
|
||||
basePartitionTables distro.BasePartitionTableMap
|
||||
}
|
||||
|
|
@ -288,14 +285,16 @@ func (t *imageType) Exports() []string {
|
|||
return t.exports
|
||||
}
|
||||
|
||||
// getBootType returns the BootType which should be used for this particular
|
||||
// combination of architecture and image type.
|
||||
// getBootType returns the BootType which should be used for this particular image type
|
||||
func (t *imageType) getBootType() distro.BootType {
|
||||
bootType := t.arch.bootType
|
||||
if t.bootType != distro.UnsetBootType {
|
||||
bootType = t.bootType
|
||||
if t.platform.GetUEFIVendor() != "" && t.platform.GetBIOSPlatform() != "" {
|
||||
return distro.HybridBootType
|
||||
} else if t.platform.GetUEFIVendor() != "" {
|
||||
return distro.UEFIBootType
|
||||
} else if t.platform.GetBIOSPlatform() != "" || t.platform.GetZiplSupport() {
|
||||
return distro.LegacyBootType
|
||||
}
|
||||
return bootType
|
||||
return distro.UnsetBootType
|
||||
}
|
||||
|
||||
func (t *imageType) getPartitionTable(
|
||||
|
|
@ -578,10 +577,9 @@ func newDistro(distroName string) distro.Distro {
|
|||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
distro: &rd,
|
||||
legacy: "i386-pc",
|
||||
bootType: distro.HybridBootType,
|
||||
name: distro.X86_64ArchName,
|
||||
distro: &rd,
|
||||
legacy: "i386-pc",
|
||||
}
|
||||
|
||||
x86_64.addImageTypes(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ func amiImgTypeX86_64(rd distribution) imageType {
|
|||
defaultImageConfig: defaultAMIImageConfigX86_64(rd),
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
@ -42,7 +41,6 @@ func ec2ImgTypeX86_64(rd distribution) imageType {
|
|||
defaultImageConfig: defaultEc2ImageConfigX86_64(rd),
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
@ -65,7 +63,6 @@ func ec2HaImgTypeX86_64(rd distribution) imageType {
|
|||
defaultImageConfig: defaultEc2ImageConfigX86_64(rd),
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
@ -131,7 +128,6 @@ func ec2SapImgTypeX86_64(rd distribution) imageType {
|
|||
defaultImageConfig: defaultEc2SapImageConfigX86_64(rd),
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto processor.max_cstate=1 intel_idle.max_cstate=1",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ type architecture struct {
|
|||
imageTypes map[string]distro.ImageType
|
||||
imageTypeAliases map[string]string
|
||||
legacy string
|
||||
bootType distro.BootType
|
||||
}
|
||||
|
||||
func (a *architecture) Name() string {
|
||||
|
|
|
|||
|
|
@ -194,28 +194,24 @@ func newDistro(name string, minor int) *distribution {
|
|||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
distro: &rd,
|
||||
legacy: "i386-pc",
|
||||
bootType: distro.HybridBootType,
|
||||
name: distro.X86_64ArchName,
|
||||
distro: &rd,
|
||||
legacy: "i386-pc",
|
||||
}
|
||||
|
||||
aarch64 := architecture{
|
||||
name: distro.Aarch64ArchName,
|
||||
distro: &rd,
|
||||
bootType: distro.UEFIBootType,
|
||||
name: distro.Aarch64ArchName,
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
ppc64le := architecture{
|
||||
distro: &rd,
|
||||
name: distro.Ppc64leArchName,
|
||||
legacy: "powerpc-ieee1275",
|
||||
bootType: distro.LegacyBootType,
|
||||
distro: &rd,
|
||||
legacy: "powerpc-ieee1275",
|
||||
name: distro.Ppc64leArchName,
|
||||
}
|
||||
s390x := architecture{
|
||||
distro: &rd,
|
||||
name: distro.S390xArchName,
|
||||
bootType: distro.LegacyBootType,
|
||||
distro: &rd,
|
||||
name: distro.S390xArchName,
|
||||
}
|
||||
|
||||
ociImgType := qcow2ImgType(rd)
|
||||
|
|
@ -288,6 +284,7 @@ func newDistro(name string, minor int) *distribution {
|
|||
// TODO: review requirement for platform with overridden packages for GCE
|
||||
gceX86Platform := &gceX86{
|
||||
X86: platform.X86{
|
||||
// TODO: BIOS should not be set to true for GCE, since it is meant to be UEFI only.
|
||||
BIOS: true,
|
||||
UEFIVendor: rd.vendor,
|
||||
BasePlatform: platform.BasePlatform{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ func gceImgType(rd distribution) imageType {
|
|||
defaultImageConfig: defaultGceByosImageConfig(rd),
|
||||
kernelOptions: gceKernelOptions,
|
||||
bootable: true,
|
||||
bootType: distro.UEFIBootType,
|
||||
defaultSize: 20 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
@ -42,7 +41,6 @@ func gceRhuiImgType(rd distribution) imageType {
|
|||
defaultImageConfig: defaultGceRhuiImageConfig(rd),
|
||||
kernelOptions: gceKernelOptions,
|
||||
bootable: true,
|
||||
bootType: distro.UEFIBootType,
|
||||
defaultSize: 20 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ type imageType struct {
|
|||
rpmOstree bool
|
||||
// bootable image
|
||||
bootable bool
|
||||
// If set to a value, it is preferred over the architecture value
|
||||
bootType distro.BootType
|
||||
// List of valid arches for the image type
|
||||
basePartitionTables distro.BasePartitionTableMap
|
||||
}
|
||||
|
|
@ -133,14 +131,16 @@ func (t *imageType) Exports() []string {
|
|||
return []string{"assembler"}
|
||||
}
|
||||
|
||||
// getBootType returns the BootType which should be used for this particular
|
||||
// combination of architecture and image type.
|
||||
// getBootType returns the BootType which should be used for this particular image type
|
||||
func (t *imageType) getBootType() distro.BootType {
|
||||
bootType := t.arch.bootType
|
||||
if t.bootType != distro.UnsetBootType {
|
||||
bootType = t.bootType
|
||||
if t.platform.GetUEFIVendor() != "" && t.platform.GetBIOSPlatform() != "" {
|
||||
return distro.HybridBootType
|
||||
} else if t.platform.GetUEFIVendor() != "" {
|
||||
return distro.UEFIBootType
|
||||
} else if t.platform.GetBIOSPlatform() != "" || t.platform.GetZiplSupport() {
|
||||
return distro.LegacyBootType
|
||||
}
|
||||
return bootType
|
||||
return distro.UnsetBootType
|
||||
}
|
||||
|
||||
func (t *imageType) getPartitionTable(
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ var (
|
|||
},
|
||||
kernelOptions: amiKernelOptions,
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
@ -38,7 +37,6 @@ var (
|
|||
},
|
||||
kernelOptions: amiKernelOptions,
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
@ -58,7 +56,6 @@ var (
|
|||
},
|
||||
kernelOptions: amiKernelOptions,
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
@ -115,7 +112,6 @@ var (
|
|||
},
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 processor.max_cstate=1 intel_idle.max_cstate=1",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ type architecture struct {
|
|||
imageTypes map[string]distro.ImageType
|
||||
imageTypeAliases map[string]string
|
||||
legacy string
|
||||
bootType distro.BootType
|
||||
}
|
||||
|
||||
func (a *architecture) Name() string {
|
||||
|
|
|
|||
|
|
@ -186,28 +186,24 @@ func newDistro(name string, minor int) *distribution {
|
|||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
distro: &rd,
|
||||
legacy: "i386-pc",
|
||||
bootType: distro.HybridBootType,
|
||||
name: distro.X86_64ArchName,
|
||||
distro: &rd,
|
||||
legacy: "i386-pc",
|
||||
}
|
||||
|
||||
aarch64 := architecture{
|
||||
name: distro.Aarch64ArchName,
|
||||
distro: &rd,
|
||||
bootType: distro.UEFIBootType,
|
||||
name: distro.Aarch64ArchName,
|
||||
distro: &rd,
|
||||
}
|
||||
|
||||
ppc64le := architecture{
|
||||
distro: &rd,
|
||||
name: distro.Ppc64leArchName,
|
||||
legacy: "powerpc-ieee1275",
|
||||
bootType: distro.LegacyBootType,
|
||||
distro: &rd,
|
||||
name: distro.Ppc64leArchName,
|
||||
legacy: "powerpc-ieee1275",
|
||||
}
|
||||
s390x := architecture{
|
||||
distro: &rd,
|
||||
name: distro.S390xArchName,
|
||||
bootType: distro.LegacyBootType,
|
||||
distro: &rd,
|
||||
name: distro.S390xArchName,
|
||||
}
|
||||
|
||||
qcow2ImgType := mkQcow2ImgType(rd)
|
||||
|
|
@ -276,6 +272,7 @@ func newDistro(name string, minor int) *distribution {
|
|||
)
|
||||
|
||||
gceX86Platform := &platform.X86{
|
||||
// TODO: BIOS should not be set to true for GCE, since it is meant to be UEFI only.
|
||||
BIOS: true,
|
||||
UEFIVendor: rd.vendor,
|
||||
BasePlatform: platform.BasePlatform{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ var (
|
|||
},
|
||||
kernelOptions: gceKernelOptions,
|
||||
bootable: true,
|
||||
bootType: distro.UEFIBootType,
|
||||
defaultSize: 20 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
@ -37,7 +36,6 @@ var (
|
|||
},
|
||||
kernelOptions: gceKernelOptions,
|
||||
bootable: true,
|
||||
bootType: distro.UEFIBootType,
|
||||
defaultSize: 20 * common.GibiByte,
|
||||
image: liveImage,
|
||||
buildPipelines: []string{"build"},
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ type imageType struct {
|
|||
rpmOstree bool
|
||||
// bootable image
|
||||
bootable bool
|
||||
// If set to a value, it is preferred over the architecture value
|
||||
bootType distro.BootType
|
||||
// List of valid arches for the image type
|
||||
basePartitionTables distro.BasePartitionTableMap
|
||||
}
|
||||
|
|
@ -136,14 +134,16 @@ func (t *imageType) Exports() []string {
|
|||
return []string{"assembler"}
|
||||
}
|
||||
|
||||
// getBootType returns the BootType which should be used for this particular
|
||||
// combination of architecture and image type.
|
||||
// getBootType returns the BootType which should be used for this particular image type
|
||||
func (t *imageType) getBootType() distro.BootType {
|
||||
bootType := t.arch.bootType
|
||||
if t.bootType != distro.UnsetBootType {
|
||||
bootType = t.bootType
|
||||
if t.platform.GetUEFIVendor() != "" && t.platform.GetBIOSPlatform() != "" {
|
||||
return distro.HybridBootType
|
||||
} else if t.platform.GetUEFIVendor() != "" {
|
||||
return distro.UEFIBootType
|
||||
} else if t.platform.GetBIOSPlatform() != "" || t.platform.GetZiplSupport() {
|
||||
return distro.LegacyBootType
|
||||
}
|
||||
return bootType
|
||||
return distro.UnsetBootType
|
||||
}
|
||||
|
||||
func (t *imageType) getPartitionTable(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue