mirror of
https://github.com/coreos/fedora-coreos-config.git
synced 2026-11-03 22:59:47 -09:00
build-rootfs: inject disk partition layouts for image-builder
bootc-image-builder needs a disk partition table definition at /usr/lib/image-builder/bootc/disk.yaml to produce disk images. Each architecture has a different partition layout (e.g. BIOS boot on x86_64, PReP on ppc64le, no boot partition on s390x), so the correct file must be selected at build time. This follows the same injection pattern already used for platforms.json and image.json: build-rootfs links the correct partitioncorrect partition table from the disk-image overlay. Authored-by: Opencode.ai claude-opus-4-6@default
This commit is contained in:
parent
8fa6ab4fde
commit
af0d6638f0
6 changed files with 199 additions and 1 deletions
|
|
@ -16,6 +16,7 @@
|
|||
!/manifest.yaml
|
||||
!/overlay.d/
|
||||
!/overrides/
|
||||
!/image-builder/
|
||||
!/platforms.yaml
|
||||
|
||||
# Useful for testing development versions.
|
||||
|
|
|
|||
10
build-rootfs
10
build-rootfs
|
|
@ -4,7 +4,7 @@
|
|||
# 1. It gathers the list of FCOS-specific packages using the manifests.
|
||||
# 2. It gathers the list of FCOS-specific overlays using the manifests.
|
||||
# 3. It runs `bootc-base-imagectl rebuild`, passing in the packages and overlays.
|
||||
# 4. It injects various metadata (e.g. image.json, live/ bits, and platforms.json).
|
||||
# 4. It injects various metadata (e.g. image.json, live/ bits, platforms.json, and disk.yaml).
|
||||
# 5. It runs the postprocess scripts defined in the manifest.
|
||||
|
||||
import argparse
|
||||
|
|
@ -211,6 +211,7 @@ def build_rootfs(target_rootfs, srcdir, manifest_name,
|
|||
inject_live(target_rootfs, srcdir)
|
||||
inject_image_json(target_rootfs, image_cfg_path, stream)
|
||||
inject_platforms_json(target_rootfs, srcdir)
|
||||
inject_disk_yaml(target_rootfs, srcdir)
|
||||
inject_content_manifest(target_rootfs, manifest)
|
||||
|
||||
inject_version_info(
|
||||
|
|
@ -649,5 +650,12 @@ def inject_platforms_json(rootfs, srcdir):
|
|||
f.write('\n')
|
||||
|
||||
|
||||
def inject_disk_yaml(rootfs, srcdir):
|
||||
dst = os.path.join(rootfs, 'usr/lib/image-builder/bootc/disk.yaml')
|
||||
# We write a relative symlink otherwise it get resolved under `/target-rootfs`
|
||||
# which does not exist in the final image.
|
||||
os.symlink(f'{ARCH}.yaml', dst)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
# We don't want osbuild to inject mount units for the
|
||||
# disks as we will change the disks uuids anyway
|
||||
mount_configuration: none
|
||||
partition_table:
|
||||
type: "gpt"
|
||||
uuid: "00000000-0000-4000-a000-000000000001"
|
||||
# Reserve the last 2048 512-byte blocks for CoreOS which moves the
|
||||
# secondary GPT header to the end of the disk on first boot.
|
||||
# See https://github.com/coreos/fedora-coreos-config/blob/7fbf510367d495529d2a915707b547d4c663f609/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-gpt-setup.sh#L30
|
||||
extra_padding: 1031168
|
||||
partitions:
|
||||
# Reserved partition — placeholder at position 1, mirrors the BIOS-BOOT
|
||||
# slot on x86_64 so partition numbering stays consistent across arches
|
||||
- size: "1 MiB"
|
||||
type: 8DA63339-0007-60C0-C436-083AC8230908
|
||||
|
||||
# EFI System Partition — aarch64 is UEFI-only, no legacy BIOS boot
|
||||
- size: "127 MiB"
|
||||
type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "vfat"
|
||||
mountpoint: "/boot/efi"
|
||||
label: "EFI-SYSTEM"
|
||||
fstab_options: "umask=0077,shortname=winnt"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 2
|
||||
|
||||
# Extended Boot Loader partition
|
||||
- size: "384 MiB"
|
||||
type: BC13C2FF-59E6-4262-A352-B275FD6F7172
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
uuid: "96d15588-3596-4b3c-adca-a2ff7279ea63"
|
||||
mountpoint: "/boot"
|
||||
label: "boot"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
|
||||
# Root partition — DPS type for aarch64
|
||||
- type: B921B045-1DF0-41C3-AF44-4C6F280D3FAE
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "xfs"
|
||||
uuid: "910678ff-f77e-4a7d-8d53-86f2ac47a823"
|
||||
mountpoint: "/"
|
||||
label: "root"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# We don't want osbuild to inject mount units for the
|
||||
# disks as we will change the disks uuids anyway
|
||||
mount_configuration: none
|
||||
partition_table:
|
||||
type: "gpt"
|
||||
uuid: "00000000-0000-4000-a000-000000000001"
|
||||
# Reserve the last 2048 512-byte blocks for CoreOS which moves the
|
||||
# secondary GPT header to the end of the disk on first boot.
|
||||
# See https://github.com/coreos/fedora-coreos-config/blob/7fbf510367d495529d2a915707b547d4c663f609/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-gpt-setup.sh#L30
|
||||
extra_padding: 1031168
|
||||
partitions:
|
||||
# PowerPC PReP Boot partition — required for GRUB on ppc64le (petitboot)
|
||||
- size: "4 MiB"
|
||||
bootable: true
|
||||
type: 9E1A2D38-C612-4316-AA26-8B49521E5A8B
|
||||
|
||||
# Reserved partition — placeholder at position 2, no EFI on ppc64le
|
||||
- size: "1 MiB"
|
||||
type: 8DA63339-0007-60C0-C436-083AC8230908
|
||||
|
||||
# Extended Boot Loader partition
|
||||
- size: "384 MiB"
|
||||
type: BC13C2FF-59E6-4262-A352-B275FD6F7172
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
uuid: "96d15588-3596-4b3c-adca-a2ff7279ea63"
|
||||
mountpoint: "/boot"
|
||||
label: "boot"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
|
||||
# Root partition — DPS type for ppc64le
|
||||
- type: C31C45E6-3F39-412E-80FB-4809C4980599
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "xfs"
|
||||
uuid: "910678ff-f77e-4a7d-8d53-86f2ac47a823"
|
||||
mountpoint: "/"
|
||||
label: "root"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
# We don't want osbuild to inject mount units for the
|
||||
# disks as we will change the disks uuids anyway
|
||||
mount_configuration: none
|
||||
partition_table:
|
||||
type: "gpt"
|
||||
uuid: "00000000-0000-4000-a000-000000000001"
|
||||
# Reserve the last 2048 512-byte blocks for CoreOS which moves the
|
||||
# secondary GPT header to the end of the disk on first boot.
|
||||
# See https://github.com/coreos/fedora-coreos-config/blob/7fbf510367d495529d2a915707b547d4c663f609/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-gpt-setup.sh#L30
|
||||
extra_padding: 1031168
|
||||
partitions:
|
||||
# s390x has no BIOS/EFI/PReP boot partition. Partition numbers are
|
||||
# explicitly set to 3 and 4 to keep them consistent with other arches
|
||||
# (slots 1 and 2 are left unused).
|
||||
|
||||
# Extended Boot Loader partition
|
||||
- partnum: 3
|
||||
size: "384 MiB"
|
||||
type: BC13C2FF-59E6-4262-A352-B275FD6F7172
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
uuid: "96d15588-3596-4b3c-adca-a2ff7279ea63"
|
||||
mountpoint: "/boot"
|
||||
label: "boot"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
|
||||
# Root partition — DPS type for s390x
|
||||
- partnum: 4
|
||||
type: 5EEAD9A9-FE09-4A1E-A1D7-520D00531306
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "xfs"
|
||||
uuid: "910678ff-f77e-4a7d-8d53-86f2ac47a823"
|
||||
mountpoint: "/"
|
||||
label: "root"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
# We don't want osbuild to inject mount units for the
|
||||
# disks as we will change the disks uuids anyway
|
||||
mount_configuration: none
|
||||
partition_table:
|
||||
type: "gpt"
|
||||
uuid: "00000000-0000-4000-a000-000000000001"
|
||||
# Reserve the last 2048 512-byte blocks for CoreOS which moves the
|
||||
# secondary GPT header to the end of the disk on first boot.
|
||||
# See https://github.com/coreos/fedora-coreos-config/blob/7fbf510367d495529d2a915707b547d4c663f609/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-gpt-setup.sh#L30
|
||||
extra_padding: 1031168
|
||||
partitions:
|
||||
# BIOS Boot partition — required for legacy BIOS boot on x86_64
|
||||
- size: "1 MiB"
|
||||
bootable: true
|
||||
type: 21686148-6449-6E6F-744E-656564454649
|
||||
|
||||
# EFI System Partition
|
||||
- size: "127 MiB"
|
||||
type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "vfat"
|
||||
mountpoint: "/boot/efi"
|
||||
label: "EFI-SYSTEM"
|
||||
fstab_options: "umask=0077,shortname=winnt"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 2
|
||||
|
||||
# Extended Boot Loader partition
|
||||
- size: "384 MiB"
|
||||
type: BC13C2FF-59E6-4262-A352-B275FD6F7172
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "ext4"
|
||||
uuid: "96d15588-3596-4b3c-adca-a2ff7279ea63"
|
||||
mountpoint: "/boot"
|
||||
label: "boot"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
|
||||
# Root partition — DPS type for x86_64
|
||||
- type: 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
|
||||
payload_type: "filesystem"
|
||||
payload:
|
||||
type: "xfs"
|
||||
uuid: "910678ff-f77e-4a7d-8d53-86f2ac47a823"
|
||||
mountpoint: "/"
|
||||
label: "root"
|
||||
fstab_options: "defaults"
|
||||
fstab_freq: 0
|
||||
fstab_passno: 0
|
||||
Loading…
Reference in a new issue