Skip to content

Add support for Fedora riscv64 - #4450

Open
xjamesmorris wants to merge 6 commits into
systemd:mainfrom
xjamesmorris:fedora-44-riscv64-vm
Open

Add support for Fedora riscv64#4450
xjamesmorris wants to merge 6 commits into
systemd:mainfrom
xjamesmorris:fedora-44-riscv64-vm

Conversation

@xjamesmorris

Copy link
Copy Markdown
Contributor
  • dnf: Only read repositories and variables from the sandbox tree
  • qemu: Configure the network device explicitly on riscv64
  • qemu: Enable SMBIOS and fw_cfg support on riscv64
  • fedora: Add support for riscv64
  • mkosi-tools: Install qemu and edk2 for riscv64 on Fedora
  • Support building the default image for riscv64 on Fedora

@behrmann behrmann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, this already looks quite reasonable. I'm not super comfortable with the config file change, but I've not put any thought to it and I'll discuss that in #4449.

Comment thread mkosi/resources/man/mkosi.1.md Outdated
Comment thread mkosi/distribution/fedora.py Outdated
Comment thread mkosi/distribution/fedora.py

@keszybz keszybz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all reasonable. Some of the choices could be bikeshedded, but I think it makes sense to trust the folks actually working on this.

Comment thread mkosi/distribution/fedora.py Outdated

url = f"baseurl={join_mirror(mirror, f'repos-dist/{tag}/latest')}"
yield RpmRepository(
"fedora", f"{url}/$basearch", (), gpgcheck=False, repo_gpgcheck=False, priority=99

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this follow the same structure as the two four below.

@keszybz

keszybz commented Sep 8, 2026

Copy link
Copy Markdown
Member

Please rebase.

@xjamesmorris

Copy link
Copy Markdown
Contributor Author

Rebased on main; added riscv64 as a column to the mirror table; reformatted the RpmRepository call to match the others (both squashed into the fedora commit).

The riscv64 virt machine does not instantiate network devices from the
-nic shorthand:

  qemu-system-riscv64: warning: requested NIC (anonymous, model virtio-net-pci) was not created (not supported by this machine?)

Configure the network backend and the device explicitly on riscv64 so
that virtual machines get a network interface.
The riscv64 virt machine has a fw_cfg device and exposes SMBIOS tables,
which edk2's RiscVVirtQemu firmware publishes to the operating system,
so credentials and the extra kernel command line can be passed the same
way as on arm64 when booting via UEFI. Verified with Fedora 44 riscv64
by passing credentials via both SMBIOS type 11 and fw_cfg and extending
the kernel command line via SMBIOS type 11.
riscv64 is not a primary Fedora architecture yet. Its packages are built
by the Fedora RISC-V SIG on its own Koji instance and are not published
to the Fedora mirror network, so the metalink based repositories mkosi
configures by default cannot be used:

  Failed to download metadata (metalink: "https://mirrors.fedoraproject.org/metalink?repo=fedora-44&arch=riscv64") for repository "fedora"

Use the repositories from the fedora-repos package shipped by Fedora
RISC-V instead when building for riscv64. As these packages are not
signed, add a gpgcheck field to RpmRepository so that signature
verification can be disabled for individual repositories instead of
having to disable it globally with RepositoryKeyCheck=no, which also
affects the tools tree. Log a warning when building for riscv64 to make
this visible.

Snapshot= is not supported as the RISC-V Koji instance does not provide
composes.
Install qemu-system-riscv-core and edk2-riscv64 in Fedora tools trees so
that riscv64 images can be booted via UEFI with mkosi vm.
Fedora does not ship a signed shim for riscv64, so only install the shim
package on x86-64 and arm64 and boot systemd-boot directly on riscv64.

Fedora's riscv64 kernel is an EFI zboot image which qemu cannot boot
directly via -kernel, which is how directory images are booted, so build
a disk image on riscv64 and boot it via UEFI instead.

Finally, riscv64 virtual machines are emulated on other architectures,
which is slow enough for the root device to not show up within Fedora's
default 45s device timeout, so give the virtual machine a few cores and
bump systemd's default timeouts via the kernel command line.
xjamesmorris added a commit to xjamesmorris/particleos that referenced this pull request Sep 9, 2026
Fedora's RISC-V repositories currently target Fedora 44 rather than rawhide, so select that release for riscv64 builds and extend timeouts for emulated guests.

Fedora's RISC-V EDK2 firmware does not expose QEMU's TPM through ACPI or initialize measured-boot PCRs. Attach the TPM through the device tree and disable expected-PCR signing while retaining TPM-backed root and swap encryption.

Require the current systemd/mkosi#4450 head, which provides Fedora riscv64 repository, firmware, and VM support.

AI assistance: GitHub Copilot was used to develop and validate this change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants