Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions data/distrodefs/eln-11/installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@

default_iso_config: &default_iso_config
rootfs_type: "erofs"
rootfs_excludes:
- "boot/efi/.*"
- "boot/grub2/.*"
- "boot/config-.*"
- "boot/initramfs-.*"
- "boot/loader/.*"
- "boot/symvers-.*"
- "boot/System.map-.*"
- "usr/lib/sysimage/rpm/.*"
- "var/lib/rpm/.*"
- "var/lib/yum/.*"
- "var/lib/dnf/.*"
erofs_options:
compression:
method: "lzma"
Expand Down
46 changes: 39 additions & 7 deletions data/distrodefs/fedora/imagetypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -558,19 +558,33 @@
- "net-lib"
- "dbus-broker"
default_menu: 1
lorax_template_package: lorax-templates-generic
lorax_templates:
- path: 99-generic/runtime-postinstall.tmpl
- path: 99-generic/runtime-cleanup.tmpl
after_dracut: true
lorax_logos_package: fedora-logos
lorax_release_package: fedora-release
install_weak_deps: true
conditions: &default_installer_conditions
"below fedora 45 we use lorax":
when:
version_less_than: "45"
shallow_merge:
lorax_template_package: lorax-templates-generic
lorax_templates:
- path: 99-generic/runtime-postinstall.tmpl
- path: 99-generic/runtime-cleanup.tmpl
after_dracut: true
lorax_logos_package: fedora-logos
lorax_release_package: fedora-release

iso_config: &default_iso_config
preparer: "image-builder - https://osbuild.org/"
publisher: "Fedora Project"
rootfs_type: "squashfs"
rootfs_excludes:
- "boot/efi/.*"
- "boot/grub2/.*"
- "boot/config-.*"
- "boot/initramfs-.*"
- "boot/loader/.*"
- "boot/symvers-.*"
- "boot/System.map-.*"

conditions: &default_iso_config_conditions
"x86_64 uses grub2":
when:
Expand All @@ -594,6 +608,22 @@
arch: "s390x"
shallow_merge:
boot_type: "s390-iso"
"fedora < 45 excludes metadata":
when:
version_less_than: "45"
shallow_merge:
rootfs_excludes:
- "boot/efi/.*"
- "boot/grub2/.*"
- "boot/config-.*"
- "boot/initramfs-.*"
- "boot/loader/.*"
- "boot/symvers-.*"
- "boot/System.map-.*"
- "usr/lib/sysimage/rpm/.*"
- "var/lib/rpm/.*"
- "var/lib/yum/.*"
- "var/lib/dnf/.*"

erofs_options: &default_erofs_options
compression:
Expand Down Expand Up @@ -3055,6 +3085,7 @@ image_types:
- "app/org.kde.skanpage/{{.Arch}}/stable"
- "app/org.kde.qrca/{{.Arch}}/stable"
conditions:
<<: *default_installer_conditions
"there are no 45 runtimes":
when:
version_greater_or_equal: "45"
Expand Down Expand Up @@ -3117,6 +3148,7 @@ image_types:
- "app/org.gnome.Papers/{{.Arch}}/stable"
- "app/org.gnome.Weather/{{.Arch}}/stable"
conditions:
<<: *default_installer_conditions
"there are no 45 runtimes":
when:
version_greater_or_equal: "45"
Expand Down
12 changes: 12 additions & 0 deletions data/distrodefs/rhel-10/imagetypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,18 @@

default_iso_config: &default_iso_config
rootfs_type: "squashfs"
rootfs_excludes:
- "boot/efi/.*"
- "boot/grub2/.*"
- "boot/config-.*"
- "boot/initramfs-.*"
- "boot/loader/.*"
- "boot/symvers-.*"
- "boot/System.map-.*"
- "usr/lib/sysimage/rpm/.*"
- "var/lib/rpm/.*"
- "var/lib/yum/.*"
- "var/lib/dnf/.*"
conditions:
"x86_64 uses grub2":
when:
Expand Down
12 changes: 12 additions & 0 deletions data/distrodefs/rhel-8/imagetypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,18 @@

default_iso_config: &default_iso_config
rootfs_type: "squashfs-ext4"
rootfs_excludes:
- "boot/efi/.*"
- "boot/grub2/.*"
- "boot/config-.*"
- "boot/initramfs-.*"
- "boot/loader/.*"
- "boot/symvers-.*"
- "boot/System.map-.*"
- "usr/lib/sysimage/rpm/.*"
- "var/lib/rpm/.*"
- "var/lib/yum/.*"
- "var/lib/dnf/.*"
conditions:
"x86_64 uses syslinux":
when:
Expand Down
12 changes: 12 additions & 0 deletions data/distrodefs/rhel-9/imagetypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,18 @@
install_weak_deps: true

default_iso_config: &default_iso_config
rootfs_excludes:
- "boot/efi/.*"
- "boot/grub2/.*"
- "boot/config-.*"
- "boot/initramfs-.*"
- "boot/loader/.*"
- "boot/symvers-.*"
- "boot/System.map-.*"
- "usr/lib/sysimage/rpm/.*"
- "var/lib/rpm/.*"
- "var/lib/yum/.*"
- "var/lib/dnf/.*"
conditions:
"x86_64 uses syslinux":
when:
Expand Down
26 changes: 26 additions & 0 deletions pkg/distro/generic/bootc_imagetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,19 @@ func (t *bootcImageType) initAnacondaInstallerBaseFromSourceInfo(img *image.Anac

// see https://github.com/osbuild/bootc-image-builder/issues/733
img.ISOCustomizations.RootfsType = manifest.SquashfsRootfs
img.ISOCustomizations.RootfsExcludes = []string{
"boot/efi/.*",
"boot/grub2/.*",
"boot/config-.*",
"boot/initramfs-.*",
"boot/loader/.*",
"boot/symvers-.*",
"boot/System.map-.*",
"usr/lib/sysimage/rpm/.*",
"var/lib/rpm/.*",
"var/lib/yum/.*",
"var/lib/dnf/.*",
}

// Enabled by default to keep backwards compatibility
img.InstallerCustomizations.InstallWeakDeps = true
Expand Down Expand Up @@ -481,6 +494,19 @@ func (t *bootcImageType) manifestForGenericISO(options distro.ImageOptions, rng
}
img.RootfsCompression = "zstd"
img.RootfsType = manifest.SquashfsRootfs
img.RootfsExcludes = []string{
"boot/efi/.*",
"boot/grub2/.*",
"boot/config-.*",
"boot/initramfs-.*",
"boot/loader/.*",
"boot/symvers-.*",
"boot/System.map-.*",
"usr/lib/sysimage/rpm/.*",
"var/lib/rpm/.*",
"var/lib/yum/.*",
"var/lib/dnf/.*",
}

// Potentially KernelInfo is nil when we couldn't read it from the container; handle that so
// we don't panic
Expand Down
4 changes: 4 additions & 0 deletions pkg/distro/generic/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,10 @@ func isoCustomizations(t ISOImageType, c *blueprint.Customizations) (manifest.IS
isc.RootfsType = *isoroot
}

if rootfsExcludes := isoConfig.RootfsExcludes; len(rootfsExcludes) > 0 {
isc.RootfsExcludes = rootfsExcludes
}

if preparer := isoConfig.Preparer; preparer != nil {
isc.Preparer = *preparer
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/distro/iso_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type ISOConfig struct {
// is used
RootfsType *manifest.ISORootfsType `yaml:"rootfs_type,omitempty"`

// RootfsExcludes lists paths for exclusion from a rootfs
RootfsExcludes []string `yaml:"rootfs_excludes,omitempty"`

// set only when RootfsType is erofs
ErofsOptions *osbuild.ErofsStageOptions `yaml:"erofs_options,omitempty"`

Expand Down
13 changes: 13 additions & 0 deletions pkg/image/bootc_pxetar.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ func (img *BootcPXEImage) InstantiateManifestFromContainers(m *manifest.Manifest
rootfsPipeline := manifest.NewBootcRootFS(buildPipeline, rawImage, img.platform)
rootfsPipeline.ErofsOptions = img.ISOCustomizations.ErofsOptions
rootfsPipeline.RootfsType = img.ISOCustomizations.RootfsType
rootfsPipeline.RootfsExcludes = []string{
"boot/efi/.*",
"boot/grub2/.*",
"boot/config-.*",
"boot/initramfs-.*",
"boot/loader/.*",
"boot/symvers-.*",
"boot/System.map-.*",
"usr/lib/sysimage/rpm/.*",
"var/lib/rpm/.*",
"var/lib/yum/.*",
"var/lib/dnf/.*",
}

// Add the rootfs pipeline which compresses the bootc/ostree filesystem and copies
// out the kernel, initramfs, and EFI/ files needed for PXE booting it
Expand Down
2 changes: 2 additions & 0 deletions pkg/image/container_based_iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type ContainerBasedIso struct {

RootfsCompression string
RootfsType manifest.ISORootfsType
RootfsExcludes []string

KernelPath string
KernelOpts []string
Expand Down Expand Up @@ -110,6 +111,7 @@ func (img *ContainerBasedIso) InstantiateManifestFromContainer(m *manifest.Manif
isoTreePipeline.Version = img.Version
isoTreePipeline.RootfsCompression = img.RootfsCompression
isoTreePipeline.RootfsType = img.RootfsType
isoTreePipeline.RootfsExcludes = img.RootfsExcludes
isoTreePipeline.KernelPath = img.KernelPath
isoTreePipeline.InitramfsPath = img.InitramfsPath
isoTreePipeline.KernelOpts = kernelOpts
Expand Down
16 changes: 16 additions & 0 deletions pkg/image/pxetar.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ func (img *PXETar) InstantiateManifest(m *manifest.Manifest,
}

pxeTreePipeline := manifest.NewPXETree(buildPipeline, osPipeline)

// Hard-coded for now but specific to the PXE-tar
pxeTreePipeline.RootfsExcludes = []string{
"boot/efi/.*",
"boot/grub2/.*",
"boot/config-.*",
"boot/initramfs-.*",
"boot/loader/.*",
"boot/symvers-.*",
"boot/System.map-.*",
"usr/lib/sysimage/rpm/.*",
"var/lib/rpm/.*",
"var/lib/yum/.*",
"var/lib/dnf/.*",
}

// TODO
// - Setup compresstion (squashfs/erofs, etc.)

Expand Down
20 changes: 20 additions & 0 deletions pkg/manifest/anaconda_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ func (p *AnacondaInstaller) getBuildPackages(Distro) ([]string, error) {
packages = append(packages,
p.InstallerCustomizations.LoraxTemplatePackage,
)
} else {
// Lorax pulls this in as a dependency; we need it directly if we're not
// pulling in Lorax
packages = append(packages, "dosfstools")
}

if p.SELinux != "" {
Expand Down Expand Up @@ -630,6 +634,13 @@ func (p *AnacondaInstaller) payloadStages() ([]*osbuild.Stage, error) {
}))
}

if len(p.InstallerCustomizations.LoraxTemplatePackage) == 0 {
// Set the default target of the ISO to Anaconda if it is not being handled by Lorax.
stages = append(stages, osbuild.NewSystemdStage(&osbuild.SystemdStageOptions{
DefaultTarget: "anaconda.target",
}))
}

stages = append(stages, osbuild.NewSELinuxConfigStage(&osbuild.SELinuxConfigStageOptions{State: osbuild.SELinuxStatePermissive}))

// SELinux is not supported on the non-live-installers (see the previous
Expand Down Expand Up @@ -720,6 +731,15 @@ func (p *AnacondaInstaller) dracutStageOptions() (*osbuild.DracutStageOptions, e

options.AddModules = append(options.AddModules, p.InstallerCustomizations.AdditionalDracutModules...)

// If Lorax is not in use we want to remove additional files from the initrd. Lorax handles this
// by removing them from the tree itself.
if len(p.InstallerCustomizations.LoraxTemplatePackage) == 0 {
options.Remove = []string{
"usr/lib/systemd/system-generators/lvm2-activation-generator",
"usr/lib/systemd/system-generators/systemd-gpt-auto-generator",
}
}

if p.Biosdevname {
options.AddModules = append(options.AddModules, "biosdevname")
}
Expand Down
26 changes: 4 additions & 22 deletions pkg/manifest/anaconda_installer_iso_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,24 +254,6 @@ func (p *AnacondaInstallerISOTree) getBuildPackages(_ Distro) ([]string, error)
return packages, nil
}

// Exclude most of the /boot files inside the rootfs to save space
// These are not needed on the running system
// The kernel and kernel .hmac are left for use with FIPS systems
// Used by NewSquashfsStage and NewErofsStage
var installerBootExcludePaths = []string{
"boot/efi/.*",
"boot/grub2/.*",
"boot/config-.*",
"boot/initramfs-.*",
"boot/loader/.*",
"boot/symvers-.*",
"boot/System.map-.*",
"usr/lib/sysimage/rpm/.*",
"var/lib/rpm/.*",
"var/lib/yum/.*",
"var/lib/dnf/.*",
}

// NewSquashfsStage returns an osbuild stage configured to build
// the squashfs root filesystem for the ISO.
func (p *AnacondaInstallerISOTree) NewSquashfsStage() (*osbuild.Stage, error) {
Expand Down Expand Up @@ -304,8 +286,8 @@ func (p *AnacondaInstallerISOTree) NewSquashfsStage() (*osbuild.Stage, error) {
}
}

// Clean up the root filesystem's /boot to save space
squashfsOptions.ExcludePaths = installerBootExcludePaths
// Clean up the root filesystem to save space
squashfsOptions.ExcludePaths = p.ISOCustomizations.RootfsExcludes

// The iso's rootfs can either be an ext4 filesystem compressed with squashfs, or
// a squashfs of the plain directory tree
Expand Down Expand Up @@ -338,8 +320,8 @@ func (p *AnacondaInstallerISOTree) NewErofsStage() (*osbuild.Stage, error) {
return nil, fmt.Errorf("unknown AnacondaInstallerType %v in NewErofsStage", p.anacondaPipeline.Type)
}

// Clean up the root filesystem's /boot to save space
erofsOptions.ExcludePaths = installerBootExcludePaths
// Clean up the root filesystem to save space
erofsOptions.ExcludePaths = p.ISOCustomizations.RootfsExcludes

return osbuild.NewErofsStage(erofsOptions, p.anacondaPipeline.Name()), nil
}
Expand Down
1 change: 1 addition & 0 deletions pkg/manifest/anaconda_installer_iso_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,7 @@ func TestAnacondaISOTreeSerializeInstallRootfsType(t *testing.T) {
func TestAnacondaInstallerISOTreeNewErofsStage(t *testing.T) {
pipeline := newTestAnacondaISOTreeErofs(manifest.Grub2UEFIOnlyISOBoot)
pipeline.RootfsType = manifest.ErofsRootfs
pipeline.ISOCustomizations.RootfsExcludes = []string{"/foo"}

stage, err := pipeline.NewErofsStage()
require.NoError(t, err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/manifest/bootc_rootfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type BootcRootFS struct {
Base
RootfsCompression string
RootfsType ISORootfsType
RootfsExcludes []string
ErofsOptions osbuild.ErofsStageOptions // set only when RootfsType is erofs

platform platform.Platform
Expand Down Expand Up @@ -79,7 +80,7 @@ func (p *BootcRootFS) serialize() (osbuild.Pipeline, error) {

// TODO this is shared with the ISO, should it be?
// Clean up the root filesystem's /boot to save space
erofsOptions.ExcludePaths = installerBootExcludePaths
erofsOptions.ExcludePaths = p.RootfsExcludes
erofsOptions.Source = "mount://-/"
erofsStage := osbuild.NewErofsWithMountsStage(&erofsOptions, nil, devices, mounts)
pipeline.AddStage(erofsStage)
Expand Down
Loading
Loading