File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed
Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ aarch64
179179
180180For full configuration documentation, see [ config.md] ( ./docs/config.md ) .
181181
182+ For tips on creating a rootfs (if you don't want to just use your host system's
183+ one), see [ rootfs.md] ( ./docs/rootfs.md ) .
184+
182185## Usage in Github CI
183186
184187[ vmtest-action] ( https://github.com/danobi/vmtest-action ) is a convenient
Original file line number Diff line number Diff line change @@ -47,6 +47,9 @@ The following fields are supported:
4747 * UIDs from the host will be passed through directly; if you built your
4848 rootfs without privileges in the host, try running ` vmtest ` via
4949 ` unshare -r ` , so that QEMU (and hence the guest) sees UID 0.
50+ * For tips on creating a rootfs (if you don't want to just use your host
51+ system's one), see [ rootfs.md] ( ./docs/rootfs.md ) .
52+
5053* ` arch ` (string)
5154 * Default: the architecture vmtest was built for.
5255 * Under which machine architecture to run the kernel.
Original file line number Diff line number Diff line change 1+ # Getting a rootfs
2+
3+ There are many ways to produce a directory to pass to the ` rootfs ` config field,
4+ here are a couple of potential solutions.
5+
6+ ## From a container image
7+
8+ OCI images can be turned into tarballs which can be extracted into a rootfs. For
9+ example:
10+
11+ ``` sh
12+ ❯❯ mkdir $rootfs_dir && cd $rootfs_dir
13+ ❯❯ cat > Containerfile
14+ FROM docker.io/library/debian
15+ RUN apt update
16+ RUN apt install -y qemu-guest-agent
17+
18+ ❯❯ podman build -t deb-qga # Docker would work exactly the same
19+ ❯❯ podman export -o deb.tar $( podman create deb-qga)
20+ ❯❯ tar xf deb.tar
21+ ❯❯ rm Containerfile deb.tar
22+ ```
23+
24+ ## Using mkosi
25+
26+ [ ` mkosi ` ] ( https://github.com/systemd/mkosi ) is a more advanced tool for building
27+ OS images, as well as just producing a rootfs it can build full disk images with
28+ a bootloader, plus many other features. You'll need to refer to the full
29+ documentation to really understand ` mkosi ` , but here's a minimal example. This
30+ will only work if you host system has ` apt ` (on Ubuntu you'll also need to
31+ install the ` debian-archive-keyring ` package), otherwise you'll need to adapt it
32+ for your host distro or run it in a container.
33+
34+ ` mkosi.conf ` :
35+
36+ ``` ini
37+ [Output]
38+ Format =directory
39+
40+ [Distribution]
41+ Distribution =debian
42+ Release =bookworm
43+
44+ [Content]
45+ Packages =
46+ mount
47+ qemu-guest-agent
48+ ```
49+
50+ Then from the directory containing that file, run ` mkosi -f ` . This should
51+ produce a directory named ` image ` that you can use for your ` rootfs ` config
52+ field.
You can’t perform that action at this time.
0 commit comments