summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/distro/include/container-host-containerd.conf14
-rw-r--r--conf/distro/include/container-host-docker.conf14
-rw-r--r--conf/distro/include/container-host-k3s-node.conf18
-rw-r--r--conf/distro/include/container-host-k3s.conf17
-rw-r--r--conf/distro/include/container-host-podman.conf17
-rw-r--r--conf/distro/include/container-registry.conf29
-rw-r--r--conf/distro/include/meta-virt-dev.conf28
-rw-r--r--conf/distro/include/meta-virt-host.conf20
-rw-r--r--conf/distro/include/xen-host.conf17
-rw-r--r--docs/build-profiles.md244
10 files changed, 418 insertions, 0 deletions
diff --git a/conf/distro/include/container-host-containerd.conf b/conf/distro/include/container-host-containerd.conf
new file mode 100644
index 00000000..c4a68845
--- /dev/null
+++ b/conf/distro/include/container-host-containerd.conf
@@ -0,0 +1,14 @@
1# Container host configuration fragment: Containerd
2#
3# Include from local.conf to set up a containerd-based container host.
4# Requires meta-virt-host.conf to be included first:
5#
6# require conf/distro/include/meta-virt-host.conf
7# require conf/distro/include/container-host-containerd.conf
8# MACHINE = "qemux86-64"
9# bitbake container-image-host
10#
11# Sets CONTAINER_PROFILE and the DISTRO_FEATURES required by
12# container-image-host with the containerd engine stack.
13
14CONTAINER_PROFILE = "containerd"
diff --git a/conf/distro/include/container-host-docker.conf b/conf/distro/include/container-host-docker.conf
new file mode 100644
index 00000000..5bf29359
--- /dev/null
+++ b/conf/distro/include/container-host-docker.conf
@@ -0,0 +1,14 @@
1# Container host configuration fragment: Docker
2#
3# Include from local.conf to set up a Docker-based container host.
4# Requires meta-virt-host.conf to be included first:
5#
6# require conf/distro/include/meta-virt-host.conf
7# require conf/distro/include/container-host-docker.conf
8# MACHINE = "qemux86-64"
9# bitbake container-image-host
10#
11# Sets CONTAINER_PROFILE and the DISTRO_FEATURES required by
12# container-image-host with the Docker engine stack.
13
14CONTAINER_PROFILE = "docker"
diff --git a/conf/distro/include/container-host-k3s-node.conf b/conf/distro/include/container-host-k3s-node.conf
new file mode 100644
index 00000000..75580d71
--- /dev/null
+++ b/conf/distro/include/container-host-k3s-node.conf
@@ -0,0 +1,18 @@
1# Container host configuration fragment: K3s agent node
2#
3# Include from local.conf to set up a K3s agent (worker) node.
4# Requires meta-virt-host.conf to be included first:
5#
6# require conf/distro/include/meta-virt-host.conf
7# require conf/distro/include/container-host-k3s-node.conf
8# MACHINE = "qemux86-64"
9# bitbake container-image-host
10#
11# Sets CONTAINER_PROFILE and the DISTRO_FEATURES required by
12# container-image-host with K3s agent-only orchestration. The
13# k3s-node profile bundles the k3s agent, embedded containerd,
14# and CNI plugins. The node joins an existing k3s server cluster.
15
16CONTAINER_PROFILE = "k3s-node"
17
18DISTRO_FEATURES:append = " k3s"
diff --git a/conf/distro/include/container-host-k3s.conf b/conf/distro/include/container-host-k3s.conf
new file mode 100644
index 00000000..6e3733b1
--- /dev/null
+++ b/conf/distro/include/container-host-k3s.conf
@@ -0,0 +1,17 @@
1# Container host configuration fragment: K3s server
2#
3# Include from local.conf to set up a K3s server (control plane + agent).
4# Requires meta-virt-host.conf to be included first:
5#
6# require conf/distro/include/meta-virt-host.conf
7# require conf/distro/include/container-host-k3s.conf
8# MACHINE = "qemux86-64"
9# bitbake container-image-host
10#
11# Sets CONTAINER_PROFILE and the DISTRO_FEATURES required by
12# container-image-host with K3s orchestration. The k3s-host profile
13# bundles the k3s server, embedded containerd, and CNI plugins.
14
15CONTAINER_PROFILE = "k3s-host"
16
17DISTRO_FEATURES:append = " k3s"
diff --git a/conf/distro/include/container-host-podman.conf b/conf/distro/include/container-host-podman.conf
new file mode 100644
index 00000000..7190e32b
--- /dev/null
+++ b/conf/distro/include/container-host-podman.conf
@@ -0,0 +1,17 @@
1# Container host configuration fragment: Podman
2#
3# Include from local.conf to set up a Podman-based container host.
4# Requires meta-virt-host.conf to be included first:
5#
6# require conf/distro/include/meta-virt-host.conf
7# require conf/distro/include/container-host-podman.conf
8# MACHINE = "qemux86-64"
9# bitbake container-image-host
10#
11# Sets CONTAINER_PROFILE and the DISTRO_FEATURES required by
12# container-image-host with the Podman engine stack.
13# Includes ipv6 which is required by the podman packagegroup.
14
15CONTAINER_PROFILE = "podman"
16
17DISTRO_FEATURES:append = " ipv6"
diff --git a/conf/distro/include/container-registry.conf b/conf/distro/include/container-registry.conf
new file mode 100644
index 00000000..357e7913
--- /dev/null
+++ b/conf/distro/include/container-registry.conf
@@ -0,0 +1,29 @@
1# Container registry configuration fragment
2#
3# Include from local.conf to enable a local development registry:
4#
5# require conf/distro/include/container-registry.conf
6#
7# Defaults to an insecure (HTTP) registry at localhost:5000 with
8# namespace "yocto". Override any variable after the require line.
9#
10# This fragment enables the container-registry IMAGE_FEATURES, which
11# installs registry configuration into the target rootfs (daemon.json
12# for Docker, registries.conf.d/ for Podman/containerd).
13#
14# For a secure (TLS + authentication) registry, override these after
15# the require:
16#
17# CONTAINER_REGISTRY_URL = "registry.example.com:5000"
18# CONTAINER_REGISTRY_SECURE = "1"
19# CONTAINER_REGISTRY_USERNAME = "myuser"
20# # Optional: enable htpasswd authentication
21# CONTAINER_REGISTRY_AUTH = "1"
22# # Optional: custom namespace
23# CONTAINER_REGISTRY_NAMESPACE = "myproject"
24
25CONTAINER_REGISTRY_URL ?= "localhost:5000"
26CONTAINER_REGISTRY_NAMESPACE ?= "yocto"
27CONTAINER_REGISTRY_INSECURE ?= "1"
28
29IMAGE_FEATURES:append = " container-registry"
diff --git a/conf/distro/include/meta-virt-dev.conf b/conf/distro/include/meta-virt-dev.conf
new file mode 100644
index 00000000..06dcbb95
--- /dev/null
+++ b/conf/distro/include/meta-virt-dev.conf
@@ -0,0 +1,28 @@
1# QEMU development and testing settings
2#
3# Include from local.conf when developing and testing with runqemu:
4#
5# require conf/distro/include/meta-virt-dev.conf
6#
7# This is separate from the build profiles (container-host-*, xen-host-*)
8# and provides settings that only matter for QEMU-based development:
9# image format, memory, debug features, etc.
10#
11# Typical local.conf for QEMU-based k3s development:
12#
13# require conf/distro/include/meta-virt-host.conf
14# BUILD_PROFILE ?= "k3s"
15# require conf/distro/include/container-host-${BUILD_PROFILE}.conf
16# require conf/distro/include/meta-virt-dev.conf
17# MACHINE = "qemux86-64"
18
19# Use raw ext4 for runqemu boot/test cycles.
20# Snapshot formats (qcow2) don't work well with repeated boots.
21IMAGE_FSTYPES = "ext4"
22
23# Xen QEMU settings: Dom0 memory cap and total VM memory
24QB_XEN_CMDLINE_EXTRA ?= "dom0_mem=512M"
25QB_MEM ?= "-m 1024"
26
27# Debug-friendly image features
28EXTRA_IMAGE_FEATURES ?= "allow-empty-password empty-root-password allow-root-login post-install-logging"
diff --git a/conf/distro/include/meta-virt-host.conf b/conf/distro/include/meta-virt-host.conf
new file mode 100644
index 00000000..99d5271e
--- /dev/null
+++ b/conf/distro/include/meta-virt-host.conf
@@ -0,0 +1,20 @@
1# Base virtualization host configuration fragment
2#
3# Common DISTRO_FEATURES for any virtualization work: containers, Xen,
4# k3s, or custom/mixed configurations.
5#
6# Use standalone for custom builds:
7#
8# require conf/distro/include/meta-virt-host.conf
9# MACHINE = "qemux86-64"
10#
11# Or let a specific profile (container-host-*, xen-host-*) inherit it.
12
13DISTRO_FEATURES:append = " virtualization systemd seccomp vmsep vcontainer"
14
15# Container runtime provider — the unified runc recipe provides both
16# runc-docker and runc-opencontainers via RPROVIDES
17PREFERRED_PROVIDER_virtual/runc ?= "runc"
18
19# Multiconfig for cross-arch vruntime builds (vdkr/vpdmn blobs)
20BBMULTICONFIG ?= "vruntime-aarch64 vruntime-x86-64"
diff --git a/conf/distro/include/xen-host.conf b/conf/distro/include/xen-host.conf
new file mode 100644
index 00000000..0d21cc63
--- /dev/null
+++ b/conf/distro/include/xen-host.conf
@@ -0,0 +1,17 @@
1# Xen host configuration fragment
2#
3# Include from local.conf for Xen Dom0 development and testing.
4# Requires meta-virt-host.conf to be included first:
5#
6# require conf/distro/include/meta-virt-host.conf
7# require conf/distro/include/xen-host.conf
8# MACHINE = "qemux86-64"
9# bitbake xen-image-minimal
10#
11# Enables Xen hypervisor support, vxn (Docker CLI for Xen), and containerd
12# for the OCI runtime path.
13
14DISTRO_FEATURES:append = " xen vxn"
15
16# Xen Dom0 image packages: vxn, containerd
17IMAGE_INSTALL:append:pn-xen-image-minimal = " vxn containerd-opencontainers"
diff --git a/docs/build-profiles.md b/docs/build-profiles.md
new file mode 100644
index 00000000..602d11b9
--- /dev/null
+++ b/docs/build-profiles.md
@@ -0,0 +1,244 @@
1# Build Profiles — Configuration Fragments for meta-virtualization
2
3## Overview
4
5meta-virtualization provides configuration fragments in `conf/distro/include/`
6that replace the manual DISTRO_FEATURES, CONTAINER_PROFILE, and related
7settings typically scattered across `local.conf`. Each fragment is a small
8`.conf` file that sets the minimum variables needed for a specific build
9profile.
10
11The fragments are organized in layers:
12
13```
14meta-virt-host.conf <- base (always required first)
15 container-host-docker.conf <- container profiles (pick one)
16 container-host-podman.conf
17 container-host-containerd.conf
18 container-host-k3s.conf
19 container-host-k3s-node.conf
20 xen-host.conf <- Xen support (composable)
21meta-virt-dev.conf <- QEMU dev settings (opt-in)
22container-registry.conf <- registry config (opt-in)
23```
24
25## Quick Start
26
27Add to `local.conf`:
28
29```bash
30# Base (always first)
31require conf/distro/include/meta-virt-host.conf
32
33# Container profile — change BUILD_PROFILE to switch
34BUILD_PROFILE ?= "podman"
35require conf/distro/include/container-host-${BUILD_PROFILE}.conf
36
37# Optional: Xen support (composable with any container profile)
38require conf/distro/include/xen-host.conf
39
40# Optional: QEMU development settings
41require conf/distro/include/meta-virt-dev.conf
42
43# Optional: Container registry
44require conf/distro/include/container-registry.conf
45
46MACHINE = "qemux86-64"
47```
48
49Then build:
50
51```bash
52bitbake container-image-host # container host image
53bitbake xen-image-minimal # Xen image (if xen-host.conf included)
54```
55
56## Switching Profiles
57
58Change one variable to switch the entire container stack:
59
60```bash
61BUILD_PROFILE ?= "docker" # Docker + runc + CNI
62BUILD_PROFILE ?= "podman" # Podman + crun + netavark
63BUILD_PROFILE ?= "containerd" # Containerd + crun + CNI
64BUILD_PROFILE ?= "k3s" # K3s server + embedded containerd + CNI
65BUILD_PROFILE ?= "k3s-node" # K3s agent node
66```
67
68Or override from the command line:
69
70```bash
71BUILD_PROFILE=docker bitbake container-image-host
72```
73
74## Fragment Reference
75
76### meta-virt-host.conf (Base — Required)
77
78The foundation for all virtualization work. Must be included first.
79
80**Sets:**
81- `DISTRO_FEATURES:append = " virtualization systemd seccomp vmsep vcontainer"`
82- `PREFERRED_PROVIDER_virtual/runc ?= "runc"`
83- `BBMULTICONFIG ?= "vruntime-aarch64 vruntime-x86-64"`
84
85**Use standalone** for custom/mixed configurations where you want to set
86CONTAINER_PROFILE and other variables manually.
87
88### container-host-docker.conf
89
90Docker engine stack.
91
92**Sets:**
93- `CONTAINER_PROFILE = "docker"`
94
95**Results in:** docker-moby, runc, CNI networking.
96
97### container-host-podman.conf
98
99Podman engine stack.
100
101**Sets:**
102- `CONTAINER_PROFILE = "podman"`
103- `DISTRO_FEATURES:append = " ipv6"` (required by podman packagegroup)
104
105**Results in:** podman, crun, netavark + aardvark-dns networking.
106
107### container-host-containerd.conf
108
109Standalone containerd stack.
110
111**Sets:**
112- `CONTAINER_PROFILE = "containerd"`
113
114**Results in:** containerd, crun, CNI networking.
115
116### container-host-k3s.conf
117
118K3s server (control plane + agent).
119
120**Sets:**
121- `CONTAINER_PROFILE = "k3s-host"`
122- `DISTRO_FEATURES:append = " k3s"`
123
124**Results in:** k3s-server, embedded containerd, CNI plugins.
125
126### container-host-k3s-node.conf
127
128K3s agent (worker node). Joins an existing k3s server cluster.
129
130**Sets:**
131- `CONTAINER_PROFILE = "k3s-node"`
132- `DISTRO_FEATURES:append = " k3s"`
133
134**Results in:** k3s-agent, embedded containerd, CNI plugins.
135
136### xen-host.conf
137
138Xen hypervisor support. Composable with any container profile.
139
140**Sets:**
141- `DISTRO_FEATURES:append = " xen vxn"`
142- `IMAGE_INSTALL:append:pn-xen-image-minimal = " vxn containerd-opencontainers"`
143
144**Use with:** `bitbake xen-image-minimal`
145
146### meta-virt-dev.conf
147
148QEMU development and testing settings. Only include when developing
149and testing with runqemu.
150
151**Sets:**
152- `IMAGE_FSTYPES = "ext4"` (raw ext4 for persistent boots, no snapshots)
153- `QB_XEN_CMDLINE_EXTRA ?= "dom0_mem=512M"`
154- `QB_MEM ?= "-m 1024"`
155- `EXTRA_IMAGE_FEATURES ?= "allow-empty-password empty-root-password allow-root-login post-install-logging"`
156
157### container-registry.conf
158
159Local development container registry. Defaults to insecure HTTP at
160localhost:5000 with namespace "yocto".
161
162**Sets:**
163- `CONTAINER_REGISTRY_URL ?= "localhost:5000"`
164- `CONTAINER_REGISTRY_NAMESPACE ?= "yocto"`
165- `CONTAINER_REGISTRY_INSECURE ?= "1"`
166- `IMAGE_FEATURES:append = " container-registry"`
167
168**For secure (TLS) registries,** override after the require:
169
170```bash
171require conf/distro/include/container-registry.conf
172CONTAINER_REGISTRY_URL = "registry.example.com:5000"
173CONTAINER_REGISTRY_SECURE = "1"
174CONTAINER_REGISTRY_USERNAME = "myuser"
175```
176
177## Design Notes
178
179**Profiles are pure deltas.** They do not include `meta-virt-host.conf`
180themselves. This avoids BitBake duplicate inclusion warnings when
181combining multiple fragments (e.g., a container profile + xen-host.conf).
182The user must always include `meta-virt-host.conf` first.
183
184**`meta-virt-dev.conf` is separate** from the build profiles. It contains
185settings that only matter for QEMU-based development (image format,
186memory, debug features) and should not be included in production builds.
187
188**Fragments use weak assignments (`?=`)** for most settings so they can
189be overridden in `local.conf`. The exceptions are `CONTAINER_PROFILE`
190and profile-specific `DISTRO_FEATURES:append` which use strong
191assignments since they define the profile's identity.
192
193## Example: Full Development local.conf
194
195```bash
196# After the standard Poky local.conf boilerplate...
197
198CONF_VERSION = "2"
199
200###############################################################################
201# Virtualization Profile & Development Configuration
202###############################################################################
203
204# Base: virtualization systemd seccomp vmsep vcontainer + BBMULTICONFIG
205require conf/distro/include/meta-virt-host.conf
206
207# Container profile (switch BUILD_PROFILE to change)
208BUILD_PROFILE ?= "podman"
209require conf/distro/include/container-host-${BUILD_PROFILE}.conf
210
211# Xen support (composable with any container profile)
212require conf/distro/include/xen-host.conf
213
214# QEMU development settings (IMAGE_FSTYPES, QB_MEM, debug features)
215require conf/distro/include/meta-virt-dev.conf
216
217# Container registry (insecure localhost:5000)
218require conf/distro/include/container-registry.conf
219
220# Additional local settings
221DISTRO_FEATURES:append = " pam"
222INIT_MANAGER = "systemd"
223MACHINE = "qemux86-64"
224
225# Provider overrides
226include bruce-providers.inc
227
228# Xen guest bundles
229IMAGE_INSTALL:append:pn-xen-image-minimal = " example-xen-guest-bundle"
230IMAGE_INSTALL:append:pn-xen-image-minimal = " alpine-xen-guest-bundle"
231```
232
233## Launch Commands
234
235```bash
236# Container host (podman/docker/containerd/k3s)
237runqemu qemux86-64 container-image-host ext4 nographic kvm slirp
238
239# Xen Dom0
240runqemu qemux86-64 xen-image-minimal wic nographic kvm qemuparams="-m 4096"
241
242# K3s with extra memory
243runqemu qemux86-64 container-image-host ext4 nographic kvm slirp qemuparams="-m 4096"
244```