Skip to content
This repository was archived by the owner on Sep 1, 2026. It is now read-only.

Commit d249fde

Browse files
committed
wip! doc: bootc configuration sources
Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
1 parent 4c274b9 commit d249fde

2 files changed

Lines changed: 249 additions & 0 deletions

File tree

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
# Sources of Configuration
2+
3+
In `bootc`-land it is preferred for the source of truth to be the container itself. For `image-builder` that means that certain instructions can be stored inside the container and will be used by `image-builder` when present. We get various bits and bobs from different places . This page describes what we get from where.
4+
5+
## `bootc print-config`
6+
7+
## Filesystem
8+
9+
`image-builder` will use several files with different purposes from the container filesystem if they exist. These files are expected to exist in the `/usr/lib/image-builder/bootc` directory.
10+
11+
For historical reasons `image-builder` will also see if these files exist in the `/usr/lib/bootc-image-builder` directory. The first directory has preference and any containers using the latter path should be migrated to the former.
12+
13+
### `disk.yaml`
14+
15+
A YAML file containing the partition layout to use when turning the container image into a disk image. The canonical location for this file is `/usr/lib/image-builder/bootc/disk.yaml`.
16+
17+
If present this will replace the base partition tables that `image-builder` uses during build. Blueprint customizations can be applied on top by end-users that want to modify their deployments.
18+
19+
A quick example that sets up a very default partition layout (BIOS boot, ESP, XBOOTLDR, and root partition) before explanation and more complex examples.
20+
21+
```yaml
22+
mount_configuration: "units"
23+
partition_table:
24+
type: "gpt"
25+
partitions:
26+
- size: "1 MiB"
27+
type: "21686148-6449-6e6F-744e-656564454649"
28+
bootable: true
29+
- size: "200 MiB"
30+
type: "c12a7328-f81f-11d2-ba4b-00a0c93ec93b"
31+
payload_type: "filesystem"
32+
payload:
33+
type: "vfat"
34+
mountpoint: "/boot/efi"
35+
label: "ESP"
36+
fstab_options: "defaults,uid=0,gid=0,umask=077,shortname=winnt"
37+
fstab_freq: 0
38+
fstab_passno: 2
39+
- size: "2 GiB"
40+
type: "bc13c2ff-59e6-4262-a352-b275fd6f7172"
41+
payload_type: "filesystem"
42+
payload:
43+
type: "ext4"
44+
label: "boot"
45+
mountpoint: "/boot"
46+
fstab_options: "defaults"
47+
fstab_freq: 0
48+
fstab_passno: 0
49+
- size: "4 GiB"
50+
type: "44479540-f297-41b2-9af7-d131d5f0458a"
51+
payload_type: "filesystem"
52+
payload:
53+
type: "ext4"
54+
label: "root"
55+
mountpoint: "/"
56+
fstab_options: "defaults"
57+
fstab_freq: 0
58+
fstab_passno: 0
59+
```
60+
61+
*The type UUIDs used in this example come from the [Discoverable Partitions Specification](https://uapi-group.org/specifications/specs/discoverable_partitions_specification/).*
62+
63+
*The BIOS boot partition is required by `bootupd`, hence we've included it here in every example.*
64+
65+
`mount_configuration` is an enum and can hold the values `fstab`, `units`, or `none`. It dictates how the mountpoints are configured in the disk image. `fstab` will write an `/etc/fstab`, `units` will write systemd mount unit files, and `none` will do neither; leaving it up to tooling such as `systemd-gpt-auto-generator` to figure out what to mount where.
66+
67+
`partition_table` is an object with the following properties:
68+
69+
- `type`, an `enum` that can be `gpt` or `dos` and sets the partition table format to use.
70+
- `partitions`, a list of objects each of which represents a partition.
71+
72+
#### Partitions
73+
74+
Each partition can have the following properties:
75+
76+
- `size`, a string with units to set the size of the partition.
77+
- `type`, the partition type GPT UUID *or* DOS ID.
78+
79+
- `bootable`, an *optional* boolean indicating that this partition is legacy BIOS bootable (GPT) or active (DOS).
80+
- `uuid`, an *optional* string containing the partition UUID itself. Should be omitted and will be based on a PRNG, fixing this value can lead to issues trying to mount the same disk multiple times.
81+
- `label`, an *optional* `string` containing the partition name (**not** the filesystem label) for GPT.
82+
- `attrs`, an *optional* array of unsigned integers that set partition attribute flags for GPT.
83+
84+
- `payload_type`, an `enum` that contains one `filesystem`, `luks`, `lvm`, `btrfs`, `raw`. This field dictates what goes into the `payload` object that comes next.
85+
- `payload`, an object based on the value of `payload_type`. `payload_type`s and their `payload` contents are explained below.
86+
87+
##### Payloads
88+
89+
###### Filesystem
90+
91+
For a `payload_type: filesystem` the `payload` has the following properties:
92+
93+
- `type`
94+
- `mountpoint`, a `string` that tells where this partition should be mounted.
95+
96+
97+
- `label`, an *optional* `string` that contains the filesystem label.
98+
- `fstab_options`
99+
- `fstab_freq`
100+
- `fstab_passno`
101+
102+
Here's an example defining a few partition with XFS filesystem(s):
103+
104+
```
105+
mount_configuration: "units"
106+
partition_table:
107+
type: "gpt"
108+
partitions:
109+
- size: "1 MiB"
110+
type: "21686148-6449-6e6F-744e-656564454649"
111+
bootable: true
112+
- size: "200 MiB"
113+
type: "c12a7328-f81f-11d2-ba4b-00a0c93ec93b"
114+
payload_type: "filesystem"
115+
payload:
116+
type: "vfat"
117+
mountpoint: "/boot/efi"
118+
label: "ESP"
119+
fstab_options: "defaults,uid=0,gid=0,umask=077,shortname=winnt"
120+
fstab_freq: 0
121+
fstab_passno: 2
122+
- size: "2 GiB"
123+
type: "bc13c2ff-59e6-4262-a352-b275fd6f7172"
124+
payload_type: "filesystem"
125+
payload:
126+
type: "xfs"
127+
label: "boot"
128+
mountpoint: "/boot"
129+
- size: "4 GiB"
130+
type: "44479540-f297-41b2-9af7-d131d5f0458a"
131+
payload_type: "filesystem"
132+
payload:
133+
type: "xfs"
134+
label: "root"
135+
mountpoint: "/"
136+
```
137+
138+
###### LVM
139+
140+
For a `payload_type: lvm` the `payload` has the following properties:
141+
142+
- `name`
143+
- `description`
144+
- `logical_volumes` a list of objects.
145+
146+
The `logical_volumes` objects have the following properties:
147+
148+
- `size`, a string with units to set the size of the partition.
149+
- `name`, a string.
150+
151+
- `payload_type`
152+
- `payload`
153+
154+
###### btrfs
155+
156+
For a `payload_type: btrfs` the `payload` has the following properties:
157+
158+
- `subvolumes`, a list of objects.
159+
160+
The `subvolumes` objects have the following properties:
161+
162+
- `name`
163+
- `mountpoint`
164+
165+
An example of using the `btrfs` payload:
166+
167+
```yaml
168+
mount_configuration: "units"
169+
partition_table:
170+
type: "gpt"
171+
partitions:
172+
- size: "1 MiB"
173+
bootable: true
174+
type: "21686148-6449-6e6F-744e-656564454649"
175+
- size: "200 MiB"
176+
type: "c12a7328-f81f-11d2-ba4b-00a0c93ec93b"
177+
payload_type: "filesystem"
178+
payload:
179+
type: "vfat"
180+
mountpoint: "/boot/efi"
181+
label: "ESP"
182+
fstab_options: "defaults,uid=0,gid=0,umask=077,shortname=winnt"
183+
fstab_freq: 0
184+
fstab_passno: 2
185+
- size: "2 GiB"
186+
type: "bc13c2ff-59e6-4262-a352-b275fd6f7172"
187+
payload_type: "filesystem"
188+
payload:
189+
type: "ext4"
190+
label: "boot"
191+
mountpoint: "/boot"
192+
fstab_options: "defaults"
193+
fstab_freq: 0
194+
fstab_passno: 0
195+
- size: "4 GiB"
196+
type: "44479540-f297-41b2-9af7-d131d5f0458a"
197+
payload_type: "btrfs"
198+
payload:
199+
subvolumes:
200+
- name: "root"
201+
mountpoint: "/"
202+
- name: "home"
203+
mountpoint: "/home"
204+
- name: "var"
205+
mountpoint: "/var"
206+
```
207+
208+
*To use `btrfs` your build host and container kernel must support `btrfs`.*
209+
210+
###### LUKS
211+
212+
Allows for setting up disk encryption with luks. Contains other payloads (filesystems).
213+
214+
For a `payload_type: luks` the `payload` has the following properties:
215+
216+
- `label`
217+
- `cipher`
218+
- `passphrase`
219+
- `pbkdf`
220+
- `clevis`
221+
222+
- `payload_type`
223+
- `payload`
224+
225+
An example of how you can use the `luks` payload.
226+
227+
```yaml
228+
229+
```
230+
231+
###### raw
232+
233+
For a `payload_type: raw` the `payload` has the following properties:
234+
235+
-
236+
237+
### `iso.yaml`
238+
239+
A YAML file containing instructions for constructing an ISO. This YAML file is only used for the `generic-iso` image type which makes as few assumptions as possible and thus needs extra instructions to tell it what to do. Read [more about the `generic-iso`](./10-installers.md) to see what you can do with this file.
240+
241+
```yaml
242+
label: "Fedora-bootc-Installer"
243+
grub2:
244+
entries:
245+
- name: "Install Fedora (bootc)"
246+
linux: "/images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Fedora-bootc-Installer console=tty0 inst.text selinux=0"
247+
initrd: "/images/pxeboot/initrd.img"
248+
```

doc/20-advanced/20-bootc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Advanced `bootc` Topics
22

3+
- [Sources of Configuration](./05-sources-of-configuration.md)
34
- [Installers](./10-installers.md)

0 commit comments

Comments
 (0)