!14 Add riscv64 support

From: @misaka00251 
Reviewed-by: @pangbanme 
Signed-off-by: @pangbanme
This commit is contained in:
openeuler-ci-bot 2023-09-25 08:25:23 +00:00 committed by Gitee
commit 8ee6a2fb2d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 145 additions and 1 deletions

View File

@ -0,0 +1,137 @@
From ecd04092d1b751367ceb26fa33e0bdd2dcdc9a2f Mon Sep 17 00:00:00 2001
From: misaka00251 <liuxin@iscas.ac.cn>
Date: Fri, 15 Sep 2023 18:15:28 +0800
Subject: [PATCH] Add riscv64 support
---
edge/hack/setup_for_IEF.sh | 4 ++++
keadm/cmd/keadm/app/cmd/util/common.go | 1 +
.../cmd/keadm/app/cmd/util/pacmaninstaller.go | 2 ++
keadm/cmd/keadm/app/cmd/util/rpminstaller.go | 2 ++
.../containerd/platforms/database.go | 3 +++
.../github.com/prometheus/procfs/cpuinfo.go | 1 +
.../prometheus/procfs/cpuinfo_riscv64.go | 19 +++++++++++++++++++
.../seccomp/libseccomp-golang/seccomp.go | 2 ++
8 files changed, 34 insertions(+)
create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_riscv64.go
diff --git a/edge/hack/setup_for_IEF.sh b/edge/hack/setup_for_IEF.sh
index b265753..61f7cee 100755
--- a/edge/hack/setup_for_IEF.sh
+++ b/edge/hack/setup_for_IEF.sh
@@ -78,6 +78,10 @@ EOF
archInfo="arm64"
sed -i "s/{ARCH}/${archInfo}/g" ${CURRENT_PATH}/conf/system.yaml
;;
+ "riscv64")
+ archInfo="riscv64"
+ sed -i "s/{ARCH}/${archInfo}/g" ${CURRENT_PATH}/conf/system.yaml
+ ;;
"i386")
archInfo="i386"
sed -i "s/{ARCH}/${archInfo}/g" ${CURRENT_PATH}/conf/system.yaml
diff --git a/keadm/cmd/keadm/app/cmd/util/common.go b/keadm/cmd/keadm/app/cmd/util/common.go
index c54918e..7a9d366 100644
--- a/keadm/cmd/keadm/app/cmd/util/common.go
+++ b/keadm/cmd/keadm/app/cmd/util/common.go
@@ -74,6 +74,7 @@ const (
OSArchAMD64 string = "amd64"
OSArchARM64 string = "arm64"
OSArchARM32 string = "arm"
+ OSArchRISCV64 string="riscv64"
APT string = "apt"
YUM string = "yum"
diff --git a/keadm/cmd/keadm/app/cmd/util/pacmaninstaller.go b/keadm/cmd/keadm/app/cmd/util/pacmaninstaller.go
index fed0474..96bf437 100644
--- a/keadm/cmd/keadm/app/cmd/util/pacmaninstaller.go
+++ b/keadm/cmd/keadm/app/cmd/util/pacmaninstaller.go
@@ -67,6 +67,8 @@ func (o *PacmanOS) InstallKubeEdge(options types.InstallOptions) error {
arch = OSArchARM64
case "x86_64":
arch = OSArchAMD64
+ case "riscv64":
+ arch = OSArchRISCV64
default:
return fmt.Errorf("can't support this architecture of PacmanOS: %s", result)
}
diff --git a/keadm/cmd/keadm/app/cmd/util/rpminstaller.go b/keadm/cmd/keadm/app/cmd/util/rpminstaller.go
index 0e8fa4b..058008b 100644
--- a/keadm/cmd/keadm/app/cmd/util/rpminstaller.go
+++ b/keadm/cmd/keadm/app/cmd/util/rpminstaller.go
@@ -106,6 +106,8 @@ func (r *RpmOS) InstallKubeEdge(options types.InstallOptions) error {
arch = OSArchARM64
case "x86_64":
arch = OSArchAMD64
+ case "riscv64":
+ arch = OSArchRISCV64
default:
return fmt.Errorf("can't support this architecture of RpmOS: %s", result)
}
diff --git a/vendor/github.com/containerd/containerd/platforms/database.go b/vendor/github.com/containerd/containerd/platforms/database.go
index 6ede940..6bfae5d 100644
--- a/vendor/github.com/containerd/containerd/platforms/database.go
+++ b/vendor/github.com/containerd/containerd/platforms/database.go
@@ -89,6 +89,9 @@ func normalizeArch(arch, variant string) (string, string) {
case "x86_64", "x86-64":
arch = "amd64"
variant = ""
+ case "riscv64":
+ arch = "riscv64"
+ variant = ""
case "aarch64", "arm64":
arch = "arm64"
switch variant {
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go
index b9fb589..edc88b4 100644
--- a/vendor/github.com/prometheus/procfs/cpuinfo.go
+++ b/vendor/github.com/prometheus/procfs/cpuinfo.go
@@ -362,6 +362,7 @@ func parseCPUInfoMips(info []byte) ([]CPUInfo, error) {
return cpuinfo, nil
}
+
func parseCPUInfoPPC(info []byte) ([]CPUInfo, error) {
scanner := bufio.NewScanner(bytes.NewReader(info))
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_riscv64.go b/vendor/github.com/prometheus/procfs/cpuinfo_riscv64.go
new file mode 100644
index 0000000..e83c2e2
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/cpuinfo_riscv64.go
@@ -0,0 +1,19 @@
+// Copyright 2020 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build linux
+// +build riscv riscv64
+
+package procfs
+
+var parseCPUInfo = parseCPUInfoRISCV
diff --git a/vendor/github.com/seccomp/libseccomp-golang/seccomp.go b/vendor/github.com/seccomp/libseccomp-golang/seccomp.go
index a3cc538..08e2e9d 100644
--- a/vendor/github.com/seccomp/libseccomp-golang/seccomp.go
+++ b/vendor/github.com/seccomp/libseccomp-golang/seccomp.go
@@ -196,6 +196,8 @@ func GetArchFromString(arch string) (ScmpArch, error) {
return ArchMIPS, nil
case "mips64":
return ArchMIPS64, nil
+ case "riscv64":
+ return ArchRISCV64, nil
case "mips64n32":
return ArchMIPS64N32, nil
case "mipsel":
--
2.39.2 (Apple Git-143)

View File

@ -4,12 +4,15 @@
%ifarch aarch64
%global gohostarch arm64
%endif
%ifarch riscv64
%global gohostarch riscv64
%endif
%define debug_package %{nil}
Name: kubeedge
Version: 1.8.0
Release: 3
Release: 4
Summary: Kubernetes Native Edge Computing Framework
License: Apache-2.0
URL: https://github.com/kubeedge/kubeedge
@ -17,6 +20,7 @@ Source0: https://github.com/kubeedge/kubeedge/archive/refs/tags/v%{version}.tar.
BuildRequires: golang glibc-static make tar systemd git
Patch0001: 0001-rpminstaller-add-support-for-openEuler.patch
Patch1000: 1000-add-riscv64-support.patch
%description
KubeEdge is an open source system for extending native containerized application
@ -165,6 +169,9 @@ install -Dpm0550 checksum_%{tarball_name}.tar.gz.txt %{buildroot}%{_sysconfdir}/
%attr(550,root,root) %{_prefix}/local/bin/edgesite-server
%changelog
* Fri Sep 15 2023 misaka00251 <liuxin@iscas.ac.cn> - 1.8.0-4
- Add riscv64 support
* Tue Mar 7 2023 caodongxia<caodongxia@h-partners.com> - 1.8.0-3
- Fix not stripped problem