Skip to content

WIP: Add riscv64 support#778

Open
andreabolognani wants to merge 17 commits intorhboot:mainfrom
andreabolognani:riscv64
Open

WIP: Add riscv64 support#778
andreabolognani wants to merge 17 commits intorhboot:mainfrom
andreabolognani:riscv64

Conversation

@andreabolognani
Copy link
Copy Markdown

@andreabolognani andreabolognani commented Sep 26, 2025

This is part of an attempt to bring riscv64 support into shim.

See #420 and #641 for previous discussion, as well as #777 which is a prerequisite of this PR.

Using this branch I was able to successfully build shim on both x86_64 and riscv64, and I was able to use the resulting binaries to boot Fedora 42 cloud images for both architectures, replacing the stock ones.

@andreabolognani
Copy link
Copy Markdown
Author

Tagging @xypron, @brianredbeard and @jmontleon since some of the changes come from them.

@andreabolognani
Copy link
Copy Markdown
Author

Rebased on top of #777.

Additionally, I have dropped all definitions related to va_list from shim's stdarg.h since they no longer appear to be necessary when using the latest upstream version of gnu-efi. I believe their existence was a point of contention in the past.

@xypron perhaps you could revisit your patch, integrating the follow-up fixes and improvements from me, @brianredbeard and @jmontleon? And of course any feedback from @vathpela would be much appreciated too :)

Thanks in advance!

@vathpela vathpela marked this pull request as ready for review January 21, 2026 14:41
@andreabolognani
Copy link
Copy Markdown
Author

Rebased to match the current contents of the main branch, matching #777. Fixed a couple of signoffs with the author's explicit agreement.

@andreabolognani
Copy link
Copy Markdown
Author

Rebased once again on top of the updated #777. Squashed some patches (with agreement from the authors) and fixed VPATH builds.

andreabolognani and others added 17 commits March 31, 2026 10:52
Replace the shim-specific fork with the upstream version,
specifically the most recent release. Some adjustment to
shim's code are necessary to adapt to this change.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
shim is a standalone EFI application so it shouldn't be
necessary to look at the glibc headers when building it, and
in fact attempting to do so results in a build failure.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
We could theoretically set GNU_EFI_USE_REALLOCATEPOOL_ABI=0
to keep using the legacy ABI, but since gnu-efi uses the
modern ABI internally and we call into its build systemd
directly, doing that messes things up.

Switching to the new ABI is just a matter of changing the
order of arguments.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
We could theoretically set GNU_EFI_USE_COMPARE_ABI=0 to keep
using the legacy ABI, but since gnu-efi uses the modern ABI
internally and we call into its build systemd directly, doing
that messes things up.

In a very small handful of cases we actually rely on the
behavior of the old ABI because we don't just need to know
whether or not the two GUIDs are identical, but also their
relative sorting order. CompareGuidForSorting(), which retains
the old behavior, is introduced to deal with those scenarios.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Jason Montleon <jmontleo@redhat.com>
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Add what is needed to build on riscv64.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
@davidlt and @xypron pointed out prior changed to binutils 2.42 which
added support for RISC-V EFI objects.  This reflects the upstream
preference to avoid adding additional architectures which are emitting
flat binary files via `objcopy` (i.e. `-O binary` architectures).

Signed-off-by: Brian 'redbeard' Harrington <redbeard@dead-city.org>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
They don't seem to be necessary when building against the
latest upstream version of gnu-efi.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
The SBAT-related definitions are missing from upstream
gnu-efi, so those are retained. The rest of the file is
completely identical to the upstream counterpart.

Signed-off-by: Jason Montleon <jmontleo@redhat.com>
Signed-off-by: Jason Montleon <jmontleo@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
@andreabolognani
Copy link
Copy Markdown
Author

Rebased on top of #777 and added CI jobs for riscv64 cross-builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants