kubeedge/1000-add-riscv64-support.patch
2023-09-15 18:17:01 +08:00

138 lines
5.2 KiB
Diff

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)