From dc7b97ef622e40a810253d3cd7d718ffa3ceb2d1 Mon Sep 17 00:00:00 2001 From: U2FsdGVkX1 Date: Wed, 13 Dec 2023 18:01:11 +0800 Subject: [PATCH] Add riscv64 support --- add-riscv64-support.patch | 90 +++++++++++++++++++++++++++++++++++++++ kubernetes.spec | 15 ++++++- 2 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 add-riscv64-support.patch diff --git a/add-riscv64-support.patch b/add-riscv64-support.patch new file mode 100644 index 0000000..6317ca9 --- /dev/null +++ b/add-riscv64-support.patch @@ -0,0 +1,90 @@ +diff '--color=auto' -ru kubernetes/hack/lib/golang.sh kubernetes.new/hack/lib/golang.sh +--- kubernetes/hack/lib/golang.sh 2023-05-17 10:13:27.000000000 -0400 ++++ kubernetes.new/hack/lib/golang.sh 2023-11-09 21:44:02.270455823 -0500 +@@ -24,6 +24,7 @@ + readonly KUBE_SUPPORTED_SERVER_PLATFORMS=( + linux/amd64 + linux/arm64 ++ linux/riscv64 + linux/s390x + linux/ppc64le + ) +@@ -32,6 +33,7 @@ + readonly KUBE_SUPPORTED_NODE_PLATFORMS=( + linux/amd64 + linux/arm64 ++ linux/riscv64 + linux/s390x + linux/ppc64le + windows/amd64 +@@ -44,6 +46,7 @@ + linux/386 + linux/arm + linux/arm64 ++ linux/riscv64 + linux/s390x + linux/ppc64le + darwin/amd64 +@@ -58,6 +61,7 @@ + readonly KUBE_SUPPORTED_TEST_PLATFORMS=( + linux/amd64 + linux/arm64 ++ linux/riscv64 + linux/s390x + linux/ppc64le + darwin/amd64 +@@ -424,6 +428,10 @@ + export CGO_ENABLED=1 + export CC=${KUBE_LINUX_ARM64_CC:-aarch64-linux-gnu-gcc} + ;; ++ "linux/riscv64") ++ export CGO_ENABLED=1 ++ export CC=${KUBE_LINUX_RISCV64_CC:-riscv64-linux-gnu-gcc} ++ ;; + "linux/ppc64le") + export CGO_ENABLED=1 + export CC=${KUBE_LINUX_PPC64LE_CC:-powerpc64le-linux-gnu-gcc} +diff '--color=auto' -ru kubernetes/hack/lib/util.sh kubernetes.new/hack/lib/util.sh +--- kubernetes/hack/lib/util.sh 2023-05-17 10:13:27.000000000 -0400 ++++ kubernetes.new/hack/lib/util.sh 2023-11-09 21:44:47.740534910 -0500 +@@ -179,6 +179,9 @@ + i?86*) + host_arch=x86 + ;; ++ riscv64*) ++ host_arch=riscv64 ++ ;; + s390x*) + host_arch=s390x + ;; +@@ -186,7 +189,7 @@ + host_arch=ppc64le + ;; + *) +- kube::log::error "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x or ppc64le." ++ kube::log::error "Unsupported host arch. Must be x86_64, 386, arm, arm64, riscv64, s390x or ppc64le." + exit 1 + ;; + esac +diff '--color=auto' -ru kubernetes/hack/local-up-cluster.sh kubernetes.new/hack/local-up-cluster.sh +--- kubernetes/hack/local-up-cluster.sh 2023-05-17 10:13:27.000000000 -0400 ++++ kubernetes.new/hack/local-up-cluster.sh 2023-11-09 21:45:45.750635807 -0500 +@@ -299,6 +299,9 @@ + i?86*) + host_arch=x86 + ;; ++ riscv64*) ++ host_arch=riscv64 ++ ;; + s390x*) + host_arch=s390x + ;; +@@ -306,7 +309,7 @@ + host_arch=ppc64le + ;; + *) +- echo "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x or ppc64le." >&2 ++ echo "Unsupported host arch. Must be x86_64, 386, arm, arm64, riscv64, s390x or ppc64le." >&2 + exit 1 + ;; + esac diff --git a/kubernetes.spec b/kubernetes.spec index 9ab528c..1ede61c 100644 --- a/kubernetes.spec +++ b/kubernetes.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 %global with_debug 0 %if 0%{?with_debug} @@ -27,7 +27,7 @@ Release: %{anolis_release}%{?dist} Summary: Open Source Production-Grade Container Scheduling And Management Platform License: ASL 2.0 URL: https://%{import_path} -ExclusiveArch: x86_64 aarch64 ppc64le s390x %{arm} +ExclusiveArch: x86_64 aarch64 ppc64le s390x %{arm} riscv64 Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz Source101: kube-proxy.service @@ -49,6 +49,9 @@ Source116: %{name}.sysusers Patch3: build-with-debug-info.patch +# riscv64 support from Arch Linux riscv project +Patch4: add-riscv64-support.patch + # It obsoletes cadvisor but needs its source code (literally integrated) Obsoletes: cadvisor @@ -136,6 +139,10 @@ Kubernetes client tools like kubectl %patch3 -p1 %endif +%ifarch riscv64 +%patch4 -p1 +%endif + for dir in vendor/github.com/google/certificate-transparency/go/x509 pkg/util/certificates; do if [ -d "${dir}" ]; then pushd ${dir} @@ -378,6 +385,10 @@ fi ############################################ %changelog +* Tue Nov 7 2023 Guoguo - 1.27.2-2 +- add support for riscv64 +- Patch from https://raw.githubusercontent.com/felixonmars/archriscv-packages/master/kubernetes/add-riscv64-support.patch + * Fri May 26 2023 mgb01105731 - 1.27.2-1 - Update version to 1.27.2 -- Gitee