From a6ff39e47d93ff2387f78c064cc930d64d53dfef Mon Sep 17 00:00:00 2001 From: U2FsdGVkX1 Date: Wed, 16 Apr 2025 14:16:50 +0800 Subject: [PATCH] Add initial RISC-V support (#2206) It depends upon https://github.com/IceWhaleTech/github/pull/3 resolved https://github.com/IceWhaleTech/CasaOS/issues/1669 --- .goreleaser.debug.yaml | 35 +++++++++++++++ .goreleaser.yaml | 45 +++++++++++++++++++ .../migration/script.d/03-migrate-casaos.sh | 3 ++ 3 files changed, 83 insertions(+) diff --git a/.goreleaser.debug.yaml b/.goreleaser.debug.yaml index 04e112a..9016b43 100644 --- a/.goreleaser.debug.yaml +++ b/.goreleaser.debug.yaml @@ -59,6 +59,22 @@ builds: - arm goarm: - "7" + - id: casaos-riscv64 + binary: build/sysroot/usr/bin/casaos + env: + - CC=riscv64-linux-gnu-gcc + gcflags: + - all=-N -l + ldflags: + - -extldflags "-static" + tags: + - musl + - netgo + - osusergo + goos: + - linux + goarch: + - riscv64 - id: casaos-migration-tool-amd64 binary: build/sysroot/usr/bin/casaos-migration-tool main: ./cmd/migration-tool @@ -112,6 +128,23 @@ builds: - arm goarm: - "7" + - id: casaos-migration-tool-riscv64 + binary: build/sysroot/usr/bin/casaos-migration-tool + main: ./cmd/migration-tool + env: + - CC=riscv64-linux-gnu-gcc + gcflags: + - all=-N -l + ldflags: + - -extldflags "-static" + tags: + - musl + - netgo + - osusergo + goos: + - linux + goarch: + - riscv64 archives: - name_template: >- {{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-v{{ .Version }} @@ -120,6 +153,7 @@ archives: - casaos-amd64 - casaos-arm64 - casaos-arm-7 + - casaos-riscv64 files: - build/**/* - name_template: >- @@ -129,6 +163,7 @@ archives: - casaos-migration-tool-amd64 - casaos-migration-tool-arm64 - casaos-migration-tool-arm-7 + - casaos-migration-tool-riscv64 files: - build/sysroot/etc/**/* checksum: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 30707eb..e1b7aca 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -92,6 +92,30 @@ builds: - arm goarm: - "7" + - id: casaos-riscv64 + binary: build/sysroot/usr/bin/casaos + env: + - CC=riscv64-linux-gnu-gcc + ldflags: + - -X main.commit={{.Commit}} + - -X main.date={{.Date}} + - -X github.com/IceWhaleTech/CasaOS/drivers/google_drive.client_id={{.Env.GoogleID}} + - -X github.com/IceWhaleTech/CasaOS/drivers/google_drive.client_secret={{.Env.GoogleSecret}} + - -X github.com/IceWhaleTech/CasaOS/drivers/onedrive.client_id={{.Env.OneDriveID}} + - -X github.com/IceWhaleTech/CasaOS/drivers/onedrive.client_secret={{.Env.OneDriveSecret}} + - -X github.com/IceWhaleTech/CasaOS/drivers/dropbox.app_key={{.Env.DropboxKey}} + - -X github.com/IceWhaleTech/CasaOS/drivers/dropbox.app_secret={{.Env.DropboxSecret}} + - -s + - -w + - -extldflags "-static" + tags: + - musl + - netgo + - osusergo + goos: + - linux + goarch: + - riscv64 - id: casaos-migration-tool-amd64 binary: build/sysroot/usr/bin/casaos-migration-tool hooks: @@ -160,6 +184,25 @@ builds: - arm goarm: - "7" + - id: casaos-migration-tool-riscv64 + binary: build/sysroot/usr/bin/casaos-migration-tool + main: ./cmd/migration-tool + env: + - CC=riscv64-linux-gnu-gcc + ldflags: + - -X main.commit={{.Commit}} + - -X main.date={{.Date}} + - -s + - -w + - -extldflags "-static" + tags: + - musl + - netgo + - osusergo + goos: + - linux + goarch: + - riscv64 archives: - name_template: >- {{ .Os }}-{{- if eq .Arch "arm" }}arm-7{{- else }}{{ .Arch }}{{- end }}-{{ .ProjectName }}-v{{ .Version }} @@ -168,6 +211,7 @@ archives: - casaos-amd64 - casaos-arm64 - casaos-arm-7 + - casaos-riscv64 files: - build/**/* - name_template: >- @@ -177,6 +221,7 @@ archives: - casaos-migration-tool-amd64 - casaos-migration-tool-arm64 - casaos-migration-tool-arm-7 + - casaos-migration-tool-riscv64 files: - build/sysroot/etc/**/* checksum: diff --git a/build/scripts/migration/script.d/03-migrate-casaos.sh b/build/scripts/migration/script.d/03-migrate-casaos.sh index 0901568..1313f27 100644 --- a/build/scripts/migration/script.d/03-migrate-casaos.sh +++ b/build/scripts/migration/script.d/03-migrate-casaos.sh @@ -111,6 +111,9 @@ aarch64) armv7l) ARCH="arm-7" ;; +riscv64) + ARCH="riscv64" + ;; *) __error "Unsupported architecture" ;;