File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
Expand file tree Collapse file tree 3 files changed +57
-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 ` , otherwise you'll need to adapt it
31+ for your host distro or run it in a container.
32+
33+ ` mkosi.conf ` :
34+
35+ ``` ini
36+ [Output]
37+ Format =directory
38+
39+ [Distribution]
40+ Distribution =debian
41+ Release =testing
42+
43+ [Content]
44+ Packages =
45+ mount
46+ qemu-guest-agent
47+ ```
48+
49+ Then from the directory containing that file, run ` mkosi -f ` . This should
50+ produce a directory named ` image ` that you can use for your ` rootfs ` config
51+ field.
You can’t perform that action at this time.
0 commit comments