Skip to content

Commit 0515a94

Browse files
committed
osbuild: move the raw-image and raw-4k-image into separate files
These definitions are common across all architectures now so we can move them out of the arch specific top level files and into shared ones. I put their own files (one for 4k and one not) because diffing between the two to see the differences that enable 4k is useful.
1 parent a774313 commit 0515a94

7 files changed

Lines changed: 588 additions & 2810 deletions
Lines changed: 293 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,293 @@
1+
# This file defines the raw-4k-image pipeline.
2+
version: '2'
3+
pipelines:
4+
- name: raw-4k-image
5+
build:
6+
mpp-format-string: '{buildroot}'
7+
stages:
8+
- type: org.osbuild.truncate
9+
options:
10+
filename: disk.img
11+
size:
12+
mpp-format-string: '{image4k.size}'
13+
- type: org.osbuild.sfdisk
14+
devices:
15+
device:
16+
type: org.osbuild.loopback
17+
options:
18+
filename: disk.img
19+
sector-size:
20+
mpp-format-int: "{four_k_sector_size}"
21+
options:
22+
mpp-format-json: '{image4k.layout}'
23+
# Create EFI filesystem on EFI architectures
24+
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
25+
then:
26+
type: org.osbuild.mkfs.fat
27+
devices:
28+
device:
29+
type: org.osbuild.loopback
30+
options:
31+
filename: disk.img
32+
start:
33+
mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].start}'
34+
size:
35+
mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].size}'
36+
lock: true
37+
sector-size:
38+
mpp-format-int: "{four_k_sector_size}"
39+
options:
40+
label: EFI-SYSTEM
41+
volid: 7B7795E7
42+
- type: org.osbuild.mkfs.ext4
43+
devices:
44+
device:
45+
type: org.osbuild.loopback
46+
options:
47+
filename: disk.img
48+
start:
49+
mpp-format-int: '{image4k.layout[''boot''].start}'
50+
size:
51+
mpp-format-int: '{image4k.layout[''boot''].size}'
52+
lock: true
53+
sector-size:
54+
mpp-format-int: "{four_k_sector_size}"
55+
options:
56+
uuid:
57+
mpp-format-string: '{boot_fs_uuid}'
58+
label:
59+
mpp-format-string: '{boot_fs_label}'
60+
# Set manually the metadata_csum_seed ext4 option otherwise changing the
61+
# filesystem UUID while it's mounted doesn't work. Can remove this when
62+
# metadata_csum_seed is default in RHEL, which can be checked by looking
63+
# in /etc/mke2fs.conf.
64+
metadata_csum_seed: true
65+
- type: org.osbuild.mkfs.xfs
66+
devices:
67+
device:
68+
type: org.osbuild.loopback
69+
options:
70+
filename: disk.img
71+
start:
72+
mpp-format-int: '{image4k.layout[''root''].start}'
73+
size:
74+
mpp-format-int: '{image4k.layout[''root''].size}'
75+
lock: true
76+
sector-size:
77+
mpp-format-int: "{four_k_sector_size}"
78+
options:
79+
agcount:
80+
mpp-format-int: '{root_fs_agcount}'
81+
uuid:
82+
mpp-format-string: '{root_fs_uuid}'
83+
label:
84+
mpp-format-string: '{root_fs_label}'
85+
# We've created the filesystems. Now let's create the mountpoints (directories)
86+
# on the filesystems and label them with appropriate SELinux labels. This also
87+
# covers things like filesystem autogenerated files like 'lost+found'. The labeling
88+
# will happen once with just the root filesystem mounted and once with the boot
89+
# filesystem mounted too (to make sure we get all potentially hidden mountpoints).
90+
# https://github.com/coreos/fedora-coreos-tracker/issues/1771
91+
- type: org.osbuild.mkdir
92+
options:
93+
paths:
94+
- path: mount://root/boot
95+
mode: 493
96+
# Create /boot/efi mountpoint on EFI architectures
97+
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
98+
then:
99+
path: mount://boot/efi
100+
mode: 493
101+
devices:
102+
disk:
103+
type: org.osbuild.loopback
104+
options:
105+
filename: disk.img
106+
partscan: true
107+
sector-size:
108+
mpp-format-int: "{four_k_sector_size}"
109+
mounts:
110+
- name: root
111+
type: org.osbuild.xfs
112+
source: disk
113+
partition:
114+
mpp-format-int: '{image4k.layout[''root''].partnum}'
115+
target: /root-mount-point
116+
# Mount boot partition on EFI architectures for /boot/efi creation
117+
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
118+
then:
119+
name: boot
120+
type: org.osbuild.ext4
121+
source: disk
122+
partition:
123+
mpp-format-int: '{image4k.layout[''boot''].partnum}'
124+
target: /boot-mount-point
125+
- type: org.osbuild.selinux
126+
options:
127+
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
128+
target: mount://root/
129+
inputs:
130+
tree:
131+
type: org.osbuild.tree
132+
origin: org.osbuild.pipeline
133+
references:
134+
- name:deployed-tree
135+
devices:
136+
disk:
137+
type: org.osbuild.loopback
138+
options:
139+
filename: disk.img
140+
partscan: true
141+
sector-size:
142+
mpp-format-int: "{four_k_sector_size}"
143+
mounts:
144+
- name: root
145+
type: org.osbuild.xfs
146+
source: disk
147+
partition:
148+
mpp-format-int: '{image4k.layout[''root''].partnum}'
149+
target: /
150+
- type: org.osbuild.selinux
151+
options:
152+
file_contexts: input://tree/etc/selinux/targeted/contexts/files/file_contexts
153+
target: mount://root/boot/
154+
inputs:
155+
tree:
156+
type: org.osbuild.tree
157+
origin: org.osbuild.pipeline
158+
references:
159+
- name:deployed-tree
160+
devices:
161+
disk:
162+
type: org.osbuild.loopback
163+
options:
164+
filename: disk.img
165+
partscan: true
166+
sector-size:
167+
mpp-format-int: "{four_k_sector_size}"
168+
mounts:
169+
- name: root
170+
type: org.osbuild.xfs
171+
source: disk
172+
partition:
173+
mpp-format-int: '{image4k.layout[''root''].partnum}'
174+
target: /
175+
- name: boot
176+
type: org.osbuild.ext4
177+
source: disk
178+
partition:
179+
mpp-format-int: '{image4k.layout[''boot''].partnum}'
180+
target: /boot
181+
- type: org.osbuild.copy
182+
inputs:
183+
tree:
184+
type: org.osbuild.tree
185+
origin: org.osbuild.pipeline
186+
references:
187+
- name:tree
188+
options:
189+
paths:
190+
- from: input://tree/
191+
to: mount://root/
192+
devices:
193+
disk:
194+
type: org.osbuild.loopback
195+
options:
196+
filename: disk.img
197+
partscan: true
198+
sector-size:
199+
mpp-format-int: "{four_k_sector_size}"
200+
mounts:
201+
- name: root
202+
type: org.osbuild.xfs
203+
source: disk
204+
partition:
205+
mpp-format-int: '{image4k.layout[''root''].partnum}'
206+
target: /
207+
- name: boot
208+
type: org.osbuild.ext4
209+
source: disk
210+
partition:
211+
mpp-format-int: '{image4k.layout[''boot''].partnum}'
212+
target: /boot
213+
# Mount EFI partition on EFI architectures
214+
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
215+
then:
216+
name: efi
217+
type: org.osbuild.fat
218+
source: disk
219+
partition:
220+
mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].partnum}'
221+
target: /boot/efi
222+
# Install bootloader (not on s390x which uses zipl)
223+
- mpp-if: arch != 's390x'
224+
then:
225+
type: org.osbuild.bootupd
226+
options:
227+
# Install BIOS bootloader on ppc64le (x86_64 does not use BIOS on 4k disks)
228+
bios:
229+
mpp-if: arch == 'ppc64le'
230+
then:
231+
device: disk
232+
# ppc64le installs to the PReP partition, not the root of the disk
233+
partition:
234+
mpp-format-int: '{image4k.layout[''PowerPC-PReP-boot''].partnum}'
235+
static-configs: true
236+
deployment:
237+
default: true
238+
devices:
239+
disk:
240+
type: org.osbuild.loopback
241+
options:
242+
filename: disk.img
243+
partscan: true
244+
sector-size:
245+
mpp-format-int: "{four_k_sector_size}"
246+
mounts:
247+
- name: root
248+
type: org.osbuild.xfs
249+
source: disk
250+
partition:
251+
mpp-format-int: '{image4k.layout[''root''].partnum}'
252+
target: /
253+
- name: boot
254+
type: org.osbuild.ext4
255+
source: disk
256+
partition:
257+
mpp-format-int: '{image4k.layout[''boot''].partnum}'
258+
target: /boot
259+
# Mount EFI partition on EFI architectures
260+
- mpp-if: arch in ['x86_64', 'aarch64', 'riscv64']
261+
then:
262+
name: efi
263+
type: org.osbuild.fat
264+
source: disk
265+
partition:
266+
mpp-format-int: '{image4k.layout[''EFI-SYSTEM''].partnum}'
267+
target: /boot/efi
268+
- type: org.osbuild.chattr
269+
options:
270+
items:
271+
mount://root/:
272+
immutable: true
273+
devices:
274+
disk:
275+
type: org.osbuild.loopback
276+
options:
277+
filename: disk.img
278+
partscan: true
279+
sector-size:
280+
mpp-format-int: "{four_k_sector_size}"
281+
mounts:
282+
- name: root
283+
type: org.osbuild.xfs
284+
source: disk
285+
partition:
286+
mpp-format-int: '{image4k.layout[''root''].partnum}'
287+
target: /
288+
- name: ostree.deployment
289+
type: org.osbuild.ostree.deployment
290+
options:
291+
source: mount
292+
deployment:
293+
default: true

0 commit comments

Comments
 (0)