Skip to content

feat: add support for RISC-V architecture - #303

Merged
wyattrees merged 1 commit into
canonical:masterfrom
vhaudiquet:master-riscv64
Sep 22, 2026
Merged

wyattrees merged 1 commit into
canonical:masterfrom
vhaudiquet:master-riscv64

Conversation

@vhaudiquet

Copy link
Copy Markdown
Member

Original MP on Launchpad: https://code.launchpad.net/~vhaudiquet/maas/+git/maas/+merge/501672

WIP: Add support for riscv64 architecture

I added support for riscv64 architecture on 3.7, and used it to network boot a RISC-V board, the VisionFive 2. With custom-built maas-images, and a small diff to maas-ui, I could see RISC-V images in the UI, see my VisionFive2 board, and boot it properly via MAAS.

I rebased the modifications onto master directly.

This is still experimental, but some parts might be directly mergeable. For example, code matching architecture string to debian architecture: it already has riscv64 in some places, but not everywhere.

It might be a bit too agressive as I added riscv64 everywhere I thought it was missing. Someone needs to check if this does not break stuff on other arches, but otherwise it did work on riscv64 during my experiments.

I also only added UEFI TFTP boot on riscv64, and not HTTP boot.

@vhaudiquet
vhaudiquet requested a review from a team June 3, 2026 10:13
@maas-lander

Copy link
Copy Markdown
Collaborator

Check where you would like a Mattermost message to be sent to when CI completes and this PR is merged

  • Direct message
  • ~maas

@vhaudiquet vhaudiquet changed the title Add support for RISC-V architecture feat: add support for RISC-V architecture Jun 3, 2026
@r00ta

r00ta commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

can you please run make format && make lint and push if it's successful?

@vhaudiquet
vhaudiquet force-pushed the master-riscv64 branch 2 times, most recently from a57cc15 to d51d537 Compare June 3, 2026 12:59
@vhaudiquet

Copy link
Copy Markdown
Member Author

Now lint is passing but there seems to be a lot of test errors.

@vhaudiquet

Copy link
Copy Markdown
Member Author

For testing purposes, I also modified maas-images and maas-ui.

For maas-images I had the following diff:

diff --git a/conf/bootloaders.yaml b/conf/bootloaders.yaml
index d788a6a..e1b15ac 100644
--- a/conf/bootloaders.yaml
+++ b/conf/bootloaders.yaml
@@ -41,6 +41,16 @@ bootloaders:
     - usr/lib/shim/shimaa64.efi.signed.latest, bootaa64.efi
     - usr/lib/shim/mmaa64.efi, mmaa64.efi
     - usr/lib/grub/arm64-efi-signed/grubnetaa64.efi.signed, grubaa64.efi
+ - firmware-platform: uefi
+   packages:
+    - grub-efi-riscv64-bin
+   arch: riscv64
+   arches: riscv64
+   archive: http://ports.ubuntu.com
+   release: noble
+   os: grub-efi
+   files:
+    - usr/lib/grub/riscv64-efi/monolithic/grubnetriscv64.efi, grubriscv64.efi
  - firmware-platform: open-firmware
    packages:
     - grub-ieee1275-bin

For maas-ui I had the following diff:

diff --git a/src/app/apiclient/types.gen.ts b/src/app/apiclient/types.gen.ts
index 6fa5bb4c3..ae243a609 100644
--- a/src/app/apiclient/types.gen.ts
+++ b/src/app/apiclient/types.gen.ts
@@ -1112,6 +1112,7 @@ export type KnownArchesEnum =
   | "armhf"
   | "i386"
   | "ppc64el"
+  | "riscv64"
   | "s390x";

 /**
diff --git a/src/app/store/general/types/base.ts b/src/app/store/general/types/base.ts
index c1d996d47..f9fe589e6 100644
--- a/src/app/store/general/types/base.ts
+++ b/src/app/store/general/types/base.ts
@@ -113,6 +113,7 @@ export type KnownArchitecture =
   | "armhf"
   | "i386"
   | "ppc64el"
+  | "riscv64"
   | "s390x";

 export type KnownArchitecturesState = {

I'm not sure this is super helpful but just FYI 😃

Comment thread src/maasserver/migrations/maasserver/0073_migrate_package_repositories.py Outdated
Comment thread src/maasserver/migrations/maasserver/0086_remove_powerpc_from_ports_arches.py Outdated
Comment thread src/maasserver/migrations/maasserver/0166_auto_select_s390x_extra_arches.py Outdated
Comment thread src/maasservicelayer/db/alembic/versions/0000_initial.py Outdated
@vhaudiquet

Copy link
Copy Markdown
Member Author

Thanks for the review @bjornt. My approach must have been a bit too agressive as I added riscv64 everywhere I saw other architectures present, sometimes without understanding the purpose of the files. I will remove from src/maasserver/migrations/maasserver/* as well as src/maasservicelayer/db/alembic/versions/0000_initial.py.

@vhaudiquet
vhaudiquet force-pushed the master-riscv64 branch 2 times, most recently from 25fe8ee to ba38823 Compare July 1, 2026 13:30
@vhaudiquet

Copy link
Copy Markdown
Member Author

I pushed an update to the tests that should fix all failures hopefully 😃

Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
@vhaudiquet

Copy link
Copy Markdown
Member Author

Rebased the PR on top of master

@bjornt

bjornt commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

/review

@bjornt bjornt 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.

Looks good to me, thanks for the contribution!

@bjornt
bjornt added this pull request to the merge queue Sep 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 22, 2026
@vhaudiquet

Copy link
Copy Markdown
Member Author

I'm not sure I understand why "ci-check" and "test-python" are passing in CI and failing in merge queue? Is that a real failure that surfaced somehow or an infrastructure / temporary error?

I tried to check the logs but they don't seem related to the PR:

src/tests/maasapiserver/v3/api/public/models/requests/test_ipranges.py::TestIPRangeCreateRequest::test_mandatory_params
  src/tests/maasapiserver/v3/api/public/models/requests/test_ipranges.py:60: PytestWarning: The test <Function test_mandatory_params> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove the asyncio mark. If the test is not marked explicitly, check for global marks applied via 'pytestmark'.
    def test_mandatory_params(self):

@wyattrees
wyattrees added this pull request to the merge queue Sep 22, 2026
@wyattrees

Copy link
Copy Markdown
Contributor

@vhaudiquet it looks like test-python failed due to a flaky test (ci-check only failed because test-python did). In this case we just need to try again. I've added this back into the queue.

Merged via the queue into canonical:master with commit 183199d Sep 22, 2026
9 checks passed
bjornt added a commit that referenced this pull request Sep 23, 2026
> WIP: Add support for riscv64 architecture
>
> I added support for riscv64 architecture on 3.7, and used it to
network boot a RISC-V board, the VisionFive 2. With custom-built
maas-images, and a small diff to maas-ui, I could see RISC-V images in
the UI, see my VisionFive2 board, and boot it properly via MAAS.
>
> I rebased the modifications onto master directly.
>
> This is still experimental, but some parts might be directly
mergeable. For example, code matching architecture string to debian
architecture: it already has riscv64 in some places, but not everywhere.
    
It might be a bit too agressive as I added riscv64 everywhere I thought
it was missing. Someone needs to check if this does not break stuff on
other arches, but otherwise it did work on riscv64 during my
experiments.
    
I also only added UEFI TFTP boot on riscv64, and not HTTP boot.
    
Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
(cherry picked from commit 183199d)

Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Co-authored-by: Valentin Haudiquet <vhaudiquet343@hotmail.fr>
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