From 5ad3f968e140f9c6d298ef7c41d016478951cd51 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Tue, 21 Nov 2023 22:11:57 -0500 Subject: [PATCH] manifests: add example metal4k disk image for Fedora CoreOS The created disk image would be written to 4k native disks. --- test/cases/ostree-images | 3 + .../manifests/fedora-coreos-container.json | 262 ++++++++++++++++++ .../fedora-coreos-container.mpp.yaml | 201 ++++++++++++++ 3 files changed, 466 insertions(+) diff --git a/test/cases/ostree-images b/test/cases/ostree-images index 0e218c9b..0088c328 100755 --- a/test/cases/ostree-images +++ b/test/cases/ostree-images @@ -100,6 +100,9 @@ def run_tests(args, tmpdir): }, "metal": { "artifact": "metal.raw" + }, + "metal4k": { + "artifact": "metal4k.raw" } }, } diff --git a/test/data/manifests/fedora-coreos-container.json b/test/data/manifests/fedora-coreos-container.json index 9f4a0778..02ca9608 100644 --- a/test/data/manifests/fedora-coreos-container.json +++ b/test/data/manifests/fedora-coreos-container.json @@ -731,6 +731,188 @@ } ] }, + { + "name": "raw-4k-image", + "build": "name:build", + "stages": [ + { + "type": "org.osbuild.truncate", + "options": { + "filename": "disk.img", + "size": "10737418240" + } + }, + { + "type": "org.osbuild.sfdisk", + "devices": { + "device": { + "type": "org.osbuild.loopback", + "options": { + "filename": "disk.img", + "sector-size": 4096 + } + } + }, + "options": { + "uuid": "00000000-0000-4000-a000-000000000001", + "label": "gpt", + "partitions": [ + { + "start": 256, + "size": 256, + "type": "21686148-6449-6E6F-744E-656564454649", + "bootable": true, + "uuid": "FAC7F1FB-3E8D-4137-A512-961DE09A5549" + }, + { + "start": 512, + "size": 32512, + "type": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B", + "uuid": "68B2905B-DF3E-4FB3-80FA-49D1E773AA33" + }, + { + "start": 33024, + "size": 98304, + "type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4", + "uuid": "61B2905B-DF3E-4FB3-80FA-49D1E773AA32" + }, + { + "start": 131328, + "size": 524288, + "type": "0FC63DAF-8483-4772-8E79-3D69D8477DE4", + "uuid": "CA7D7CCB-63ED-4C53-861C-1742536059CC" + } + ] + } + }, + { + "type": "org.osbuild.mkfs.fat", + "devices": { + "device": { + "type": "org.osbuild.loopback", + "options": { + "filename": "disk.img", + "start": 512, + "size": 32512, + "lock": true, + "sector-size": 4096 + } + } + }, + "options": { + "label": "EFI-SYSTEM", + "volid": "7B7795E7" + } + }, + { + "type": "org.osbuild.mkfs.ext4", + "devices": { + "device": { + "type": "org.osbuild.loopback", + "options": { + "filename": "disk.img", + "start": 33024, + "size": 98304, + "lock": true, + "sector-size": 4096 + } + } + }, + "options": { + "uuid": "96d15588-3596-4b3c-adca-a2ff7279ea63", + "label": "boot" + } + }, + { + "type": "org.osbuild.mkfs.xfs", + "devices": { + "device": { + "type": "org.osbuild.loopback", + "options": { + "filename": "disk.img", + "start": 131328, + "size": 524288, + "lock": true, + "sector-size": 4096 + } + } + }, + "options": { + "uuid": "910678ff-f77e-4a7d-8d53-86f2ac47a823", + "label": "root" + } + }, + { + "type": "org.osbuild.copy", + "inputs": { + "tree": { + "type": "org.osbuild.tree", + "origin": "org.osbuild.pipeline", + "references": [ + "name:tree" + ] + } + }, + "options": { + "paths": [ + { + "from": "input://tree/", + "to": "mount://root/" + } + ] + }, + "devices": { + "efi": { + "type": "org.osbuild.loopback", + "options": { + "filename": "disk.img", + "start": 512, + "size": 32512, + "sector-size": 4096 + } + }, + "boot": { + "type": "org.osbuild.loopback", + "options": { + "filename": "disk.img", + "start": 33024, + "size": 98304, + "sector-size": 4096 + } + }, + "root": { + "type": "org.osbuild.loopback", + "options": { + "filename": "disk.img", + "start": 131328, + "size": 524288, + "sector-size": 4096 + } + } + }, + "mounts": [ + { + "name": "root", + "type": "org.osbuild.xfs", + "source": "root", + "target": "/" + }, + { + "name": "boot", + "type": "org.osbuild.ext4", + "source": "boot", + "target": "/boot" + }, + { + "name": "efi", + "type": "org.osbuild.fat", + "source": "efi", + "target": "/boot/efi" + } + ] + } + ] + }, { "name": "raw-metal-image", "build": "name:build", @@ -784,6 +966,60 @@ } ] }, + { + "name": "raw-metal4k-image", + "build": "name:build", + "stages": [ + { + "type": "org.osbuild.copy", + "inputs": { + "tree": { + "type": "org.osbuild.tree", + "origin": "org.osbuild.pipeline", + "references": [ + "name:raw-4k-image" + ] + } + }, + "options": { + "paths": [ + { + "from": "input://tree/disk.img", + "to": "tree:///disk.img" + } + ] + } + }, + { + "type": "org.osbuild.kernel-cmdline.bls-append", + "options": { + "bootpath": "mount:///", + "kernel_opts": [ + "ignition.platform.id=metal" + ] + }, + "devices": { + "boot": { + "type": "org.osbuild.loopback", + "options": { + "filename": "disk.img", + "start": 33024, + "size": 98304, + "sector-size": 4096 + } + } + }, + "mounts": [ + { + "name": "boot", + "type": "org.osbuild.ext4", + "source": "boot", + "target": "/" + } + ] + } + ] + }, { "name": "raw-qemu-image", "build": "name:build", @@ -865,6 +1101,32 @@ } ] }, + { + "name": "metal4k", + "build": "name:build", + "stages": [ + { + "type": "org.osbuild.copy", + "inputs": { + "tree": { + "type": "org.osbuild.tree", + "origin": "org.osbuild.pipeline", + "references": [ + "name:raw-metal4k-image" + ] + } + }, + "options": { + "paths": [ + { + "from": "input://tree/disk.img", + "to": "tree:///metal4k.raw" + } + ] + } + } + ] + }, { "name": "qemu", "build": "name:build", diff --git a/test/data/manifests/fedora-coreos-container.mpp.yaml b/test/data/manifests/fedora-coreos-container.mpp.yaml index 6d192438..2caf556b 100644 --- a/test/data/manifests/fedora-coreos-container.mpp.yaml +++ b/test/data/manifests/fedora-coreos-container.mpp.yaml @@ -6,6 +6,7 @@ mpp-vars: boot_size_mb: 384 root_size_mb: 2048 sector_size: 512 + four_k_sector_size: 4096 mpp-define-images: - id: image size: @@ -35,6 +36,36 @@ mpp-define-images: uuid: CA7D7CCB-63ED-4C53-861C-1742536059CC size: mpp-format-int: "{root_size_mb * 1024 * 1024 / sector_size}" + - id: image4k + sector_size: + mpp-format-int: "{four_k_sector_size}" + size: + mpp-format-string: "{disk_size_gb * 1024 * 1024 * 1024}" + table: + uuid: 00000000-0000-4000-a000-000000000001 + label: gpt + partitions: + - id: BIOS-BOOT + type: 21686148-6449-6E6F-744E-656564454649 + bootable: true + uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549 + size: + mpp-format-int: "{bios_boot_size_mb * 1024 * 1024 / four_k_sector_size}" + - id: EFI-SYSTEM + type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B + uuid: 68B2905B-DF3E-4FB3-80FA-49D1E773AA33 + size: + mpp-format-int: "{efi_system_size_mb * 1024 * 1024 / four_k_sector_size}" + - id: boot + type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + uuid: 61B2905B-DF3E-4FB3-80FA-49D1E773AA32 + size: + mpp-format-int: "{boot_size_mb * 1024 * 1024 / four_k_sector_size}" + - id: root + type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + uuid: CA7D7CCB-63ED-4C53-861C-1742536059CC + size: + mpp-format-int: "{root_size_mb * 1024 * 1024 / four_k_sector_size}" pipelines: - mpp-import-pipelines: path: fedora-vars.ipp.yaml @@ -224,6 +255,127 @@ pipelines: number: mpp-format-int: '{image.layout[''boot''].index}' path: /grub2 + - name: raw-4k-image + build: name:build + stages: + - type: org.osbuild.truncate + options: + filename: disk.img + size: + mpp-format-string: '{image4k.size}' + - type: org.osbuild.sfdisk + devices: + device: + type: org.osbuild.loopback + options: + filename: disk.img + sector-size: + mpp-format-int: "{four_k_sector_size}" + options: + mpp-format-json: '{image4k.layout}' + - type: org.osbuild.mkfs.fat + devices: + device: + type: org.osbuild.loopback + options: + filename: disk.img + start: + mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].start}' + size: + mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].size}' + lock: true + sector-size: + mpp-format-int: "{four_k_sector_size}" + options: + label: EFI-SYSTEM + volid: 7B7795E7 + - type: org.osbuild.mkfs.ext4 + devices: + device: + type: org.osbuild.loopback + options: + filename: disk.img + start: + mpp-format-int: '{image4k.layout[''boot''].start}' + size: + mpp-format-int: '{image4k.layout[''boot''].size}' + lock: true + sector-size: + mpp-format-int: "{four_k_sector_size}" + options: + uuid: 96d15588-3596-4b3c-adca-a2ff7279ea63 + label: boot + - type: org.osbuild.mkfs.xfs + devices: + device: + type: org.osbuild.loopback + options: + filename: disk.img + start: + mpp-format-int: '{image4k.layout[''root''].start}' + size: + mpp-format-int: '{image4k.layout[''root''].size}' + lock: true + sector-size: + mpp-format-int: "{four_k_sector_size}" + options: + uuid: 910678ff-f77e-4a7d-8d53-86f2ac47a823 + label: root + - type: org.osbuild.copy + inputs: + tree: + type: org.osbuild.tree + origin: org.osbuild.pipeline + references: + - name:tree + options: + paths: + - from: input://tree/ + to: mount://root/ + devices: + efi: + type: org.osbuild.loopback + options: + filename: disk.img + start: + mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].start}' + size: + mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].size}' + sector-size: + mpp-format-int: "{four_k_sector_size}" + boot: + type: org.osbuild.loopback + options: + filename: disk.img + start: + mpp-format-int: '{image4k.layout[''boot''].start}' + size: + mpp-format-int: '{image4k.layout[''boot''].size}' + sector-size: + mpp-format-int: "{four_k_sector_size}" + root: + type: org.osbuild.loopback + options: + filename: disk.img + start: + mpp-format-int: '{image4k.layout[''root''].start}' + size: + mpp-format-int: '{image4k.layout[''root''].size}' + sector-size: + mpp-format-int: "{four_k_sector_size}" + mounts: + - name: root + type: org.osbuild.xfs + source: root + target: / + - name: boot + type: org.osbuild.ext4 + source: boot + target: /boot + - name: efi + type: org.osbuild.fat + source: efi + target: /boot/efi - name: raw-metal-image build: name:build stages: @@ -257,6 +409,41 @@ pipelines: type: org.osbuild.ext4 source: boot target: / + - name: raw-metal4k-image + build: name:build + stages: + - type: org.osbuild.copy + inputs: + tree: + type: org.osbuild.tree + origin: org.osbuild.pipeline + references: + - name:raw-4k-image + options: + paths: + - from: input://tree/disk.img + to: tree:///disk.img + - type: org.osbuild.kernel-cmdline.bls-append + options: + bootpath: mount:/// + kernel_opts: + - ignition.platform.id=metal + devices: + boot: + type: org.osbuild.loopback + options: + filename: disk.img + start: + mpp-format-int: '{image4k.layout[''boot''].start}' + size: + mpp-format-int: '{image4k.layout[''boot''].size}' + sector-size: + mpp-format-int: "{four_k_sector_size}" + mounts: + - name: boot + type: org.osbuild.ext4 + source: boot + target: / - name: raw-qemu-image build: name:build stages: @@ -306,6 +493,20 @@ pipelines: paths: - from: input://tree/disk.img to: tree:///metal.raw + - name: metal4k + build: name:build + stages: + - type: org.osbuild.copy + inputs: + tree: + type: org.osbuild.tree + origin: org.osbuild.pipeline + references: + - name:raw-metal4k-image + options: + paths: + - from: input://tree/disk.img + to: tree:///metal4k.raw - name: qemu build: name:build stages: