.IP
.nf
\f[C]
-# mkosi -d fedora -p kernel -p systemd -p udev -o foobar.raw
+$ mkosi -d fedora -p kernel -p systemd -p udev -o foobar.raw
# mkosi --output foobar.raw boot
-# mkosi --output foobar.raw qemu
+$ mkosi --output foobar.raw qemu
\f[R]
.fi
.PP
-Create and run a \f[I]Fedora Linux\f[R] image into a plain directory:
+Create and run a \f[I]Fedora Linux\f[R] image in a plain directory:
.IP
.nf
\f[C]
\f[R]
.fi
.PP
-Create a compressed image \f[V]image.raw.xz\f[R] and add a checksum
-file, and install \f[I]SSH\f[R] into it:
+Create a compressed image \f[V]image.raw.xz\f[R] with \f[I]SSH\f[R]
+installed and add a checksum file:
.IP
.nf
\f[C]
-# mkosi --distribution fedora --format disk --checksum --compress-output --package=openssh-clients
+$ mkosi --distribution fedora --format disk --checksum --compress-output --package=openssh-clients
\f[R]
.fi
.PP
.IP
.nf
\f[C]
-# cat >mkosi.conf <<EOF
+$ cat >mkosi.conf <<EOF
[Distribution]
Distribution=fedora
Release=24
Packages=kernel,systemd,systemd-udev,openssh-clients,httpd
BuildPackages=make,gcc,libcurl-devel
EOF
-# cat >mkosi.build <<EOF
+$ cat >mkosi.build <<EOF
#!/bin/sh
cd $SRCDIR
\&./autogen.sh
make -j \[ga]nproc\[ga]
make install
EOF
-# chmod +x mkosi.build
+$ chmod +x mkosi.build
# mkosi --incremental boot
# systemd-nspawn -bi image.raw
\f[R]
.IP
.nf
\f[C]
-# mkosi qemu -kernel mkosi.output/fedora\[ti]38/image.efi
+$ mkosi qemu -kernel mkosi.output/fedora\[ti]38/image.efi
\f[R]
.fi
.PP
.IP
.nf
\f[C]
-# mkosi qemu -kernel /usr/lib/systemd/boot/efi/systemd-bootx64.efi
+$ mkosi qemu -kernel /usr/lib/systemd/boot/efi/systemd-bootx64.efi
\f[R]
.fi
.PP
.IP
.nf
\f[C]
-dnf install bubblewrap btrfs-progs apt dosfstools mtools edk2-ovmf e2fsprogs squashfs-tools gnupg python3 tar xfsprogs xz zypper sbsigntools
+# dnf install bubblewrap btrfs-progs apt dosfstools mtools edk2-ovmf e2fsprogs squashfs-tools gnupg python3 tar xfsprogs xz zypper sbsigntools
\f[R]
.fi
.PP
LWN
.SH SEE ALSO
.PP
-\f[V]systemd-nspawn(1)\f[R], \f[V]dnf(8)\f[R],
+\f[V]systemd-nspawn(1)\f[R], \f[V]dnf(8)\f[R]
Create and run a bootable *GPT* image, as `foobar.raw`:
```console
-# mkosi -d fedora -p kernel -p systemd -p udev -o foobar.raw
+$ mkosi -d fedora -p kernel -p systemd -p udev -o foobar.raw
# mkosi --output foobar.raw boot
-# mkosi --output foobar.raw qemu
+$ mkosi --output foobar.raw qemu
```
-Create and run a *Fedora Linux* image into a plain directory:
+Create and run a *Fedora Linux* image in a plain directory:
```console
# mkosi --distribution fedora --format directory boot
```
-Create a compressed image `image.raw.xz` and add a checksum file, and
-install *SSH* into it:
+Create a compressed image `image.raw.xz` with *SSH* installed and add a checksum file:
```console
-# mkosi --distribution fedora --format disk --checksum --compress-output --package=openssh-clients
+$ mkosi --distribution fedora --format disk --checksum --compress-output --package=openssh-clients
```
Inside the source directory of an `automake`-based project, configure
state:
```console
-# cat >mkosi.conf <<EOF
+$ cat >mkosi.conf <<EOF
[Distribution]
Distribution=fedora
Release=24
Packages=kernel,systemd,systemd-udev,openssh-clients,httpd
BuildPackages=make,gcc,libcurl-devel
EOF
-# cat >mkosi.build <<EOF
+$ cat >mkosi.build <<EOF
#!/bin/sh
cd $SRCDIR
./autogen.sh
make -j `nproc`
make install
EOF
-# chmod +x mkosi.build
+$ chmod +x mkosi.build
# mkosi --incremental boot
# systemd-nspawn -bi image.raw
```
`mkosi` builds a Unified Kernel Image (UKI).
It is also copied into the output directory and may be booted directly:
```console
-# mkosi qemu -kernel mkosi.output/fedora~38/image.efi
+$ mkosi qemu -kernel mkosi.output/fedora~38/image.efi
```
When booting using an external kernel, we don't need the kernel *in* the image,
It is also possible to do a "direct kernel boot" into a boot loader,
taking advantage of the fact that `systemd-boot(7)` is a valid UEFI binary:
```console
-# mkosi qemu -kernel /usr/lib/systemd/boot/efi/systemd-bootx64.efi
+$ mkosi qemu -kernel /usr/lib/systemd/boot/efi/systemd-bootx64.efi
```
In this scenario, the kernel is loaded from the ESP in the image by `systemd-boot`.
necessary dependencies. For example, on *Fedora Linux* you need:
```bash
-dnf install bubblewrap btrfs-progs apt dosfstools mtools edk2-ovmf e2fsprogs squashfs-tools gnupg python3 tar xfsprogs xz zypper sbsigntools
+# dnf install bubblewrap btrfs-progs apt dosfstools mtools edk2-ovmf e2fsprogs squashfs-tools gnupg python3 tar xfsprogs xz zypper sbsigntools
```
On Debian/Ubuntu it might be necessary to install the `ubuntu-keyring`,
* [The mkosi OS generation tool](https://lwn.net/Articles/726655/) story on LWN
# SEE ALSO
-`systemd-nspawn(1)`, `dnf(8)`,
+`systemd-nspawn(1)`, `dnf(8)`