Skip to content

Commit

Permalink
RHEL-10: add image-installer image type (COMPOSER-2193)
Browse files Browse the repository at this point in the history
It is based on RHEL-9, with the package set adjusted for RHEL-10.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
  • Loading branch information
thozza authored and achilleas-k committed Aug 21, 2024
1 parent 733540c commit 54c2e63
Show file tree
Hide file tree
Showing 4 changed files with 402 additions and 0 deletions.
302 changes: 302 additions & 0 deletions pkg/distro/rhel/rhel10/bare_metal.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package rhel10

import (
"fmt"

"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/images/pkg/distro"
"github.com/osbuild/images/pkg/distro/rhel"
"github.com/osbuild/images/pkg/rpmmd"
)
Expand All @@ -24,3 +28,301 @@ func mkTarImgType() *rhel.ImageType {
[]string{"archive"},
)
}

func mkImageInstallerImgType() *rhel.ImageType {
it := rhel.NewImageType(
"image-installer",
"installer.iso",
"application/x-iso9660-image",
map[string]rhel.PackageSetFunc{
rhel.OSPkgsKey: bareMetalPackageSet,
rhel.InstallerPkgsKey: anacondaPackageSet,
},
rhel.ImageInstallerImage,
[]string{"build"},
[]string{"anaconda-tree", "rootfs-image", "efiboot-tree", "os", "bootiso-tree", "bootiso"},
[]string{"bootiso"},
)

it.BootISO = true
it.Bootable = true
it.ISOLabelFn = distroISOLabelFunc

it.DefaultInstallerConfig = &distro.InstallerConfig{
AdditionalDracutModules: []string{
"nvdimm", // non-volatile DIMM firmware (provides nfit, cuse, and nd_e820)
"prefixdevname",
"prefixdevname-tools",
},
AdditionalDrivers: []string{
"ipmi_devintf",
"ipmi_msghandler",
},
}

return it
}

// PACKAGE SETS

func bareMetalPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
ps := rpmmd.PackageSet{
Include: []string{
"@core",
"chrony",
"cockpit-system",
"cockpit-ws",
"dnf-utils",
"dosfstools",
"firewalld",
"iwl1000-firmware",
"iwl100-firmware",
"iwl105-firmware",
"iwl135-firmware",
"iwl2000-firmware",
"iwl2030-firmware",
"iwl3160-firmware",
"iwl5000-firmware",
"iwl5150-firmware",
"iwl6000g2a-firmware",
"iwl6000g2b-firmware",
"iwl6050-firmware",
"iwl7260-firmware",
"lvm2",
"net-tools",
"nfs-utils",
"oddjob",
"oddjob-mkhomedir",
"policycoreutils",
"psmisc",
"python3-jsonschema",
"qemu-guest-agent",
"redhat-release",
"redhat-release-eula",
"rsync",
"tar",
"tcpdump",
"tuned",
},
Exclude: []string{
"dracut-config-rescue",
},
}.Append(distroBuildPackageSet(t))

// Ensure to not pull in subscription-manager on non-RHEL distro
if t.IsRHEL() {
ps = ps.Append(rpmmd.PackageSet{
Include: []string{
"subscription-manager-cockpit",
},
})
}

return ps
}

func installerPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
ps := rpmmd.PackageSet{
Include: []string{
"anaconda-dracut",
"curl",
"dracut-config-generic",
"dracut-network",
"hostname",
"iwl100-firmware",
"iwl1000-firmware",
"iwl105-firmware",
"iwl135-firmware",
"iwl2000-firmware",
"iwl2030-firmware",
"iwl3160-firmware",
"iwl5000-firmware",
"iwl5150-firmware",
"iwl6050-firmware",
"iwl7260-firmware",
"kernel",
"less",
"nfs-utils",
"openssh-clients",
"ostree",
"plymouth",
"prefixdevname",
"rng-tools",
"rpcbind",
"selinux-policy-targeted",
"systemd",
"tar",
"xfsprogs",
"xz",
},
}

ps = ps.Append(rpmmd.PackageSet{
// Extra packages that are required by the dracut stage of all installers.
// These are weak deps of other packages in the list above, but lets be
// explicit about what we need and not rely on the weak deps. Relying
// on hard-dependencies for other modules is OK for now.
//
// TODO: add these dynamically based on the modules enabled by each
// pipeline.
Include: []string{
"mdadm",
"nss-softokn",
},
})

switch t.Arch().Name() {
case arch.ARCH_X86_64.String():
ps = ps.Append(rpmmd.PackageSet{
Include: []string{
"biosdevname",
},
})
}

return ps
}

func anacondaPackageSet(t *rhel.ImageType) rpmmd.PackageSet {

// common installer packages
ps := installerPackageSet(t)

ps = ps.Append(rpmmd.PackageSet{
Include: []string{
"alsa-firmware",
"alsa-tools-firmware",
"anaconda",
"anaconda-dracut",
"anaconda-install-img-deps",
"anaconda-widgets",
"audit",
"bind-utils",
"bzip2",
"cryptsetup",
"curl",
"dbus-x11",
"default-fonts-core-sans",
"default-fonts-other-sans",
"dejavu-sans-fonts",
"dejavu-sans-mono-fonts",
"device-mapper-persistent-data",
"dmidecode",
"dnf",
"dracut-config-generic",
"dracut-network",
"efibootmgr",
"ethtool",
"fcoe-utils",
"ftp",
"gdb-gdbserver",
"glibc-all-langpacks",
"gnome-kiosk",
"google-noto-sans-cjk-ttc-fonts",
"grub2-tools",
"grub2-tools-extra",
"grub2-tools-minimal",
"grubby",
"gsettings-desktop-schemas",
"hdparm",
"hexedit",
"hostname",
"initscripts",
"ipmitool",
"iwl1000-firmware",
"iwl100-firmware",
"iwl105-firmware",
"iwl135-firmware",
"iwl2000-firmware",
"iwl2030-firmware",
"iwl3160-firmware",
"iwl5000-firmware",
"iwl5150-firmware",
"iwl6000g2a-firmware",
"iwl6000g2b-firmware",
"iwl6050-firmware",
"iwl7260-firmware",
"jomolhari-fonts",
"kbd",
"kbd-misc",
"kdump-anaconda-addon",
"kernel",
"less",
"libblockdev-lvm-dbus",
"libibverbs",
"librsvg2",
"linux-firmware",
"lldpad",
"lsof",
"madan-fonts",
"mtr",
"mt-st",
"net-tools",
"nfs-utils",
"nmap-ncat",
"nm-connection-editor",
"nss-tools",
"openssh-clients",
"openssh-server",
// the package is not yet available on c10s / el10
//"oscap-anaconda-addon",
"ostree",
"pciutils",
"perl-interpreter",
"pigz",
"plymouth",
"prefixdevname",
"python3-pyatspi",
"rdma-core",
"redhat-release-eula",
"rng-tools",
"rpcbind",
"rpm-ostree",
"rsync",
"rsyslog",
"selinux-policy-targeted",
"sg3_utils",
"sil-padauk-fonts",
"smartmontools",
"spice-vdagent",
"strace",
"systemd",
"tar",
"udisks2",
"udisks2-iscsi",
"usbutils",
"vim-minimal",
"volume_key",
"wget",
"xfsdump",
"xfsprogs",
"xz",
},
})

ps = ps.Append(anacondaBootPackageSet(t))

switch t.Arch().Name() {
case arch.ARCH_X86_64.String():
ps = ps.Append(rpmmd.PackageSet{
Include: []string{
"biosdevname",
"dmidecode",
"grub2-tools-efi",
"memtest86+",
},
})

case arch.ARCH_AARCH64.String():
ps = ps.Append(rpmmd.PackageSet{
Include: []string{
"dmidecode",
},
})

default:
panic(fmt.Sprintf("unsupported arch: %s", t.Arch().Name()))
}

return ps
}
44 changes: 44 additions & 0 deletions pkg/distro/rhel/rhel10/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rhel10

import (
"fmt"
"strings"

"github.com/osbuild/images/internal/common"
"github.com/osbuild/images/pkg/arch"
Expand Down Expand Up @@ -36,6 +37,18 @@ var (
}
)

func distroISOLabelFunc(t *rhel.ImageType) string {
const RHEL_ISO_LABEL = "RHEL-%s-%s-0-BaseOS-%s"
const CS_ISO_LABEL = "CentOS-Stream-%s-BaseOS-%s"

if t.IsRHEL() {
osVer := strings.Split(t.Arch().Distro().OsVersion(), ".")
return fmt.Sprintf(RHEL_ISO_LABEL, osVer[0], osVer[1], t.Arch().Name())
} else {
return fmt.Sprintf(CS_ISO_LABEL, t.Arch().Distro().Releasever(), t.Arch().Name())
}
}

func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig {
return &distro.ImageConfig{
Timezone: common.ToPtr("America/New_York"),
Expand Down Expand Up @@ -213,6 +226,37 @@ func newDistro(name string, major, minor int) *rhel.Distribution {
mkGCEImageType(),
)

x86_64.AddImageTypes(
&platform.X86{
BasePlatform: platform.BasePlatform{
FirmwarePackages: []string{
"microcode_ctl", // ??
"iwl1000-firmware",
"iwl100-firmware",
"iwl105-firmware",
"iwl135-firmware",
"iwl2000-firmware",
"iwl2030-firmware",
"iwl3160-firmware",
"iwl5000-firmware",
"iwl5150-firmware",
"iwl6050-firmware",
},
},
BIOS: true,
UEFIVendor: rd.Vendor(),
},
mkImageInstallerImgType(),
)

aarch64.AddImageTypes(
&platform.Aarch64{
BasePlatform: platform.BasePlatform{},
UEFIVendor: rd.Vendor(),
},
mkImageInstallerImgType(),
)

rd.AddArches(x86_64, aarch64, ppc64le, s390x)
return rd
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/distro/rhel/rhel10/distro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
"tar",
"wsl",
"gce",
"image-installer",
},
},
{
Expand All @@ -291,6 +292,7 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
"tar",
"vhd",
"wsl",
"image-installer",
},
},
{
Expand Down
Loading

0 comments on commit 54c2e63

Please sign in to comment.