Skip to content

feat: add support for RISC-V architecture#303

Open
vhaudiquet wants to merge 1 commit into
canonical:masterfrom
vhaudiquet:master-riscv64
Open

feat: add support for RISC-V architecture#303
vhaudiquet wants to merge 1 commit into
canonical:masterfrom
vhaudiquet:master-riscv64

Conversation

@vhaudiquet

Copy link
Copy Markdown

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
Author

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

@vhaudiquet

Copy link
Copy Markdown
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
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.

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

Copy link
Copy Markdown
Author

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

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.

4 participants