Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic support for RISC-V 64bit architecture #1856

Merged
merged 2 commits into from
Nov 27, 2023
Merged

Conversation

ldevulder
Copy link
Contributor

@ldevulder ldevulder commented Nov 9, 2023

Basic support of riscv64 architecture.

TODO:

  • shim is not supported yet, package is not available in Tumbleweed but could be compiled. More work needed, but not something that should block this PR, will be done when shim will be available in openSUSE.
  • Remove the hardcoded x86_64 path for GRUB loader directory.
  • Maybe find an elegant way to add DTB in EFI partition (/EFI/dtb/ for SUSE based distributions), could be useful for arm64 too. Followed in Find a way to add DTB in EFI partition (for ARM and RISC-V) #1861.

@ldevulder ldevulder self-assigned this Nov 9, 2023
@ldevulder ldevulder requested a review from a team as a code owner November 9, 2023 14:40
@ldevulder ldevulder marked this pull request as draft November 9, 2023 14:40
@ldevulder ldevulder force-pushed the add-riscv64-support branch 2 times, most recently from 85ba58e to 5f44860 Compare November 9, 2023 15:39
@codecov-commenter
Copy link

codecov-commenter commented Nov 9, 2023

Codecov Report

Attention: 27 lines in your changes are missing coverage. Please review.

Comparison is base (6358862) 75.29% compared to head (34d2031) 75.09%.
Report is 1 commits behind head on main.

Files Patch % Lines
pkg/live/green.go 63.63% 11 Missing and 1 partial ⚠️
pkg/utils/grub.go 53.33% 7 Missing ⚠️
pkg/constants/constants.go 73.33% 4 Missing ⚠️
pkg/types/v1/platform.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1856      +/-   ##
==========================================
- Coverage   75.29%   75.09%   -0.21%     
==========================================
  Files          67       67              
  Lines        6825     6869      +44     
==========================================
+ Hits         5139     5158      +19     
- Misses       1315     1340      +25     
  Partials      371      371              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ldevulder ldevulder changed the title Add support for RISC-V 64bit architecture [WIP] Add support for RISC-V 64bit architecture Nov 9, 2023
Copy link
Contributor

@kkaempf kkaempf left a comment

Choose a reason for hiding this comment

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

lgtm

@ldevulder ldevulder force-pushed the add-riscv64-support branch 5 times, most recently from dab8bc8 to 8f68137 Compare November 13, 2023 13:36
Copy link
Contributor

@frelon frelon left a comment

Choose a reason for hiding this comment

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

Really nice work, psyched to see riscv support!

That said, this PR breaks current multi-platform workflow. I would like to be able to write make PLATFORM=linux/amd64,linux/arm64,linux/riscv64 build and get a multi-platform image that can be pushed and has all dependencies needed to build other systems.

Dockerfile Show resolved Hide resolved
Dockerfile Show resolved Hide resolved
@ldevulder
Copy link
Contributor Author

Here the grub entry with the latest fixes, no more hardcoded x86_64 (checked on x86_64 and riscv64):

$ sudo mount -o loop build/elemental-tumbleweed.riscv64.iso /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
$ ls /mnt
boot  EFI  rootfs.squashfs
$ ls /mnt/boot/
grub2  riscv64
$ cat /mnt/boot/grub2/grub.cfg
[...]
menuentry "Elemental" --class os --unrestricted {
		echo Loading kernel...
		$linux ($root)/boot/riscv64/loader/linux cdroot root=live:CDLABEL=COS_LIVE rd.live.dir=/ rd.live.squashimg=rootfs.squashfs console=tty1 console=ttyS0 rd.cos.disable cos.setup=/run/initramfs/live/iso-config
		echo Loading initrd...
		$initrd ($root)/boot/riscv64/loader/initrd
	}
[...]

@ldevulder ldevulder changed the title [WIP] Add support for RISC-V 64bit architecture Add basic support for RISC-V 64bit architecture Nov 21, 2023
@ldevulder ldevulder marked this pull request as ready for review November 21, 2023 17:55
@ldevulder
Copy link
Contributor Author

I would like to be able to write make PLATFORM=linux/amd64,linux/arm64,linux/riscv64 build

It should be doable, but keep in mind that qemu docker configuration will be needed to be able to build the full OS stack (or native client on docker).

But the CLI can be compiled for all supported arch directly (thanks to cross-compiling) from x86_64 (test on my laptop) with the build-cli-with-docker target.

Copy link
Contributor

@davidcassany davidcassany left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Cool too see riscv

I think this PR should be merged before #1858

Dockerfile.toolkit Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
.goreleaser.yaml Outdated Show resolved Hide resolved
@ldevulder ldevulder force-pushed the add-riscv64-support branch 2 times, most recently from dff41ec to adb9464 Compare November 27, 2023 10:11
Copy link
Contributor

@frelon frelon left a comment

Choose a reason for hiding this comment

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

Very nice! 👍

Basic support of riscv64 architecture. Shim is not
supported yet, will be added later.

Signed-off-by: Loic Devulder <[email protected]>
As only 64 architectures are supported

Signed-off-by: Loic Devulder <[email protected]>
@ldevulder ldevulder merged commit b4ad085 into main Nov 27, 2023
14 checks passed
@ldevulder ldevulder deleted the add-riscv64-support branch November 27, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants