riscv64: Reapply RISC-V Support Patch

Signed-off-by: Ruoqing He <ruoqing@isrc.iscas.ac.cn>
(cherry picked from commit ac3c2af59e98e6327d0efeab5e0fd6d352f7b0e9)
This commit is contained in:
Ruoqing He 2024-07-03 19:44:41 +08:00 committed by openeuler-sync-bot
parent c56a666c6a
commit 8dc5256cde
2 changed files with 39 additions and 30 deletions

View File

@ -1,23 +1,24 @@
From 20db0e90fdfb804c5639964c54df4854771d92f7 Mon Sep 17 00:00:00 2001 From 4f3aea675fd7652bab6dc68bf919dedc0069d286 Mon Sep 17 00:00:00 2001
From: misaka00251 <liuxin@iscas.ac.cn> From: Ruoqing He <ruoqing@isrc.iscas.ac.cn>
Date: Mon, 25 Sep 2023 10:49:49 +0800 Date: Wed, 3 Jul 2024 22:31:26 +0800
Subject: [PATCH] Add riscv64 support Subject: [PATCH 1/1] Add riscv64 support for v1.29.1 kubernetes
Signed-off-by: Ruoqing He <ruoqing@isrc.iscas.ac.cn>
--- ---
build/pause/Makefile | 3 ++- build/pause/Makefile | 3 ++-
cluster/get-kube-binaries.sh | 5 ++++- cluster/get-kube-binaries.sh | 5 ++++-
cluster/images/etcd/Makefile | 5 ++++- cluster/images/etcd/Makefile | 5 ++++-
hack/lib/golang.sh | 12 ++++++++++-- hack/lib/golang.sh | 12 ++++++++++--
hack/lib/util.sh | 5 ++++- hack/lib/util.sh | 5 ++++-
hack/local-up-cluster.sh | 5 ++++- hack/local-up-cluster.sh | 6 +++++-
test/images/image-util.sh | 2 +- test/images/image-util.sh | 2 +-
7 files changed, 29 insertions(+), 8 deletions(-) 7 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/build/pause/Makefile b/build/pause/Makefile diff --git a/build/pause/Makefile b/build/pause/Makefile
index 256a9fd1..ac01e882 100644 index 1c49bf2f..de27a9f2 100644
--- a/build/pause/Makefile --- a/build/pause/Makefile
+++ b/build/pause/Makefile +++ b/build/pause/Makefile
@@ -32,7 +32,7 @@ OSVERSION ?= 1809 20H2 ltsc2022 @@ -32,7 +32,7 @@ OSVERSION ?= 1809 ltsc2022
OUTPUT_TYPE ?= docker OUTPUT_TYPE ?= docker
ALL_OS = linux windows ALL_OS = linux windows
@ -25,7 +26,7 @@ index 256a9fd1..ac01e882 100644
+ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x riscv64 +ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x riscv64
ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch)) ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch))
ALL_ARCH.windows = amd64 ALL_ARCH.windows = amd64
ALL_OSVERSIONS.windows := 1809 20H2 ltsc2022 ALL_OSVERSIONS.windows := 1809 ltsc2022
@@ -66,6 +66,7 @@ TRIPLE.linux-arm := arm-linux-gnueabihf @@ -66,6 +66,7 @@ TRIPLE.linux-arm := arm-linux-gnueabihf
TRIPLE.linux-arm64 := aarch64-linux-gnu TRIPLE.linux-arm64 := aarch64-linux-gnu
TRIPLE.linux-ppc64le := powerpc64le-linux-gnu TRIPLE.linux-ppc64le := powerpc64le-linux-gnu
@ -35,7 +36,7 @@ index 256a9fd1..ac01e882 100644
BASE.linux := scratch BASE.linux := scratch
# Source for windows pause image base is located at https://github.com/microsoft/windows-pause-image-base # Source for windows pause image base is located at https://github.com/microsoft/windows-pause-image-base
diff --git a/cluster/get-kube-binaries.sh b/cluster/get-kube-binaries.sh diff --git a/cluster/get-kube-binaries.sh b/cluster/get-kube-binaries.sh
index 589a335f..81dc0a1c 100755 index 13b916fd..e81e30a2 100755
--- a/cluster/get-kube-binaries.sh --- a/cluster/get-kube-binaries.sh
+++ b/cluster/get-kube-binaries.sh +++ b/cluster/get-kube-binaries.sh
@@ -120,9 +120,12 @@ function detect_client_info() { @@ -120,9 +120,12 @@ function detect_client_info() {
@ -53,7 +54,7 @@ index 589a335f..81dc0a1c 100755
exit 3 exit 3
;; ;;
diff --git a/cluster/images/etcd/Makefile b/cluster/images/etcd/Makefile diff --git a/cluster/images/etcd/Makefile b/cluster/images/etcd/Makefile
index 5543cc61..cde77f89 100644 index 85e3737a..c9ae52e0 100644
--- a/cluster/images/etcd/Makefile --- a/cluster/images/etcd/Makefile
+++ b/cluster/images/etcd/Makefile +++ b/cluster/images/etcd/Makefile
@@ -51,7 +51,7 @@ OSVERSION ?= 1809 @@ -51,7 +51,7 @@ OSVERSION ?= 1809
@ -64,19 +65,19 @@ index 5543cc61..cde77f89 100644
+ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x riscv64 +ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x riscv64
ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch)) ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch))
ALL_ARCH.windows = amd64 ALL_ARCH.windows = amd64
ALL_OSVERSIONS.windows := 1809 20H2 ltsc2022 ALL_OSVERSIONS.windows := 1809 ltsc2022
@@ -106,6 +106,9 @@ endif @@ -106,6 +106,9 @@ endif
ifeq ($(ARCH),s390x) ifeq ($(ARCH),s390x)
BASEIMAGE?=registry.k8s.io/build-image/debian-base-s390x:bullseye-v1.3.0 BASEIMAGE?=registry.k8s.io/build-image/debian-base-s390x:bookworm-v1.0.0
endif endif
+ifeq ($(ARCH),riscv64) +ifeq ($(ARCH),riscv64)
+ BASEIMAGE?=registry.k8s.io/build-image/debian-base-riscv64:bullseye-v1.3.0 + BASEIMAGE?=registry.k8s.io/build-image/debian-base-riscv64:bookworm-v1.0.0
+endif +endif
BASE.windows = mcr.microsoft.com/windows/nanoserver BASE.windows = mcr.microsoft.com/windows/nanoserver
diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh
index c6cbce44..ccdb753e 100755 index f3466ff7..e01db83e 100755
--- a/hack/lib/golang.sh --- a/hack/lib/golang.sh
+++ b/hack/lib/golang.sh +++ b/hack/lib/golang.sh
@@ -27,6 +27,7 @@ readonly KUBE_SUPPORTED_SERVER_PLATFORMS=( @@ -27,6 +27,7 @@ readonly KUBE_SUPPORTED_SERVER_PLATFORMS=(
@ -87,7 +88,7 @@ index c6cbce44..ccdb753e 100755
) )
# The node platforms we build for # The node platforms we build for
@@ -36,6 +37,7 @@ readonly KUBE_SUPPORTED_NODE_PLATFORMS=( @@ -35,6 +36,7 @@ readonly KUBE_SUPPORTED_NODE_PLATFORMS=(
linux/arm64 linux/arm64
linux/s390x linux/s390x
linux/ppc64le linux/ppc64le
@ -95,7 +96,7 @@ index c6cbce44..ccdb753e 100755
windows/amd64 windows/amd64
) )
@@ -48,6 +50,7 @@ readonly KUBE_SUPPORTED_CLIENT_PLATFORMS=( @@ -47,6 +49,7 @@ readonly KUBE_SUPPORTED_CLIENT_PLATFORMS=(
linux/arm64 linux/arm64
linux/s390x linux/s390x
linux/ppc64le linux/ppc64le
@ -103,7 +104,7 @@ index c6cbce44..ccdb753e 100755
darwin/amd64 darwin/amd64
darwin/arm64 darwin/arm64
windows/amd64 windows/amd64
@@ -63,6 +66,7 @@ readonly KUBE_SUPPORTED_TEST_PLATFORMS=( @@ -61,6 +64,7 @@ readonly KUBE_SUPPORTED_TEST_PLATFORMS=(
linux/arm64 linux/arm64
linux/s390x linux/s390x
linux/ppc64le linux/ppc64le
@ -111,7 +112,7 @@ index c6cbce44..ccdb753e 100755
darwin/amd64 darwin/amd64
darwin/arm64 darwin/arm64
windows/amd64 windows/amd64
@@ -213,8 +217,8 @@ kube::golang::setup_platforms() { @@ -210,8 +214,8 @@ kube::golang::setup_platforms() {
elif [[ "${KUBE_FASTBUILD:-}" == "true" ]]; then elif [[ "${KUBE_FASTBUILD:-}" == "true" ]]; then
host_arch=$(kube::util::host_arch) host_arch=$(kube::util::host_arch)
@ -122,7 +123,7 @@ index c6cbce44..ccdb753e 100755
host_arch="amd64" host_arch="amd64"
fi fi
KUBE_SERVER_PLATFORMS=("linux/${host_arch}") KUBE_SERVER_PLATFORMS=("linux/${host_arch}")
@@ -444,6 +448,10 @@ kube::golang::set_platform_envs() { @@ -435,6 +439,10 @@ kube::golang::set_platform_envs() {
export CGO_ENABLED=1 export CGO_ENABLED=1
export CC=${KUBE_LINUX_S390X_CC:-s390x-linux-gnu-gcc} export CC=${KUBE_LINUX_S390X_CC:-s390x-linux-gnu-gcc}
;; ;;
@ -134,7 +135,7 @@ index c6cbce44..ccdb753e 100755
fi fi
diff --git a/hack/lib/util.sh b/hack/lib/util.sh diff --git a/hack/lib/util.sh b/hack/lib/util.sh
index 67454132..d0b3d3ed 100755 index 70568f76..0b65b148 100755
--- a/hack/lib/util.sh --- a/hack/lib/util.sh
+++ b/hack/lib/util.sh +++ b/hack/lib/util.sh
@@ -185,8 +185,11 @@ kube::util::host_arch() { @@ -185,8 +185,11 @@ kube::util::host_arch() {
@ -143,7 +144,7 @@ index 67454132..d0b3d3ed 100755
;; ;;
+ riscv64*) + riscv64*)
+ host_arch=riscv64 + host_arch=riscv64
+ ;; + ;;
*) *)
- 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, s390x or ppc64le."
+ kube::log::error "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x, ppc64le or riscv64." + kube::log::error "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x, ppc64le or riscv64."
@ -151,24 +152,24 @@ index 67454132..d0b3d3ed 100755
;; ;;
esac esac
diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh
index 0a49b296..6c909be0 100755 index 83bdd694..9319c094 100755
--- a/hack/local-up-cluster.sh --- a/hack/local-up-cluster.sh
+++ b/hack/local-up-cluster.sh +++ b/hack/local-up-cluster.sh
@@ -316,8 +316,11 @@ function detect_binary { @@ -293,7 +293,11 @@ function detect_arch {
ppc64le*)
host_arch=ppc64le host_arch=ppc64le
;; ;;
*)
- echo "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x or ppc64le." >&2
+ riscv64*) + riscv64*)
+ host_arch=riscv64 + host_arch=riscv64
+ ;; + ;;
*) + *)
- 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, s390x, ppc64le or riscv64." >&2 + echo "Unsupported host arch. Must be x86_64, 386, arm, arm64, s390x, ppc64le or riscv64." >&2
exit 1 exit 1
;; ;;
esac esac
diff --git a/test/images/image-util.sh b/test/images/image-util.sh diff --git a/test/images/image-util.sh b/test/images/image-util.sh
index 2b211868..5d6b91a4 100755 index 9b729b34..b6940f73 100755
--- a/test/images/image-util.sh --- a/test/images/image-util.sh
+++ b/test/images/image-util.sh +++ b/test/images/image-util.sh
@@ -34,7 +34,7 @@ source "${KUBE_ROOT}/hack/lib/logging.sh" @@ -34,7 +34,7 @@ source "${KUBE_ROOT}/hack/lib/logging.sh"
@ -181,5 +182,5 @@ index 2b211868..5d6b91a4 100755
# NOTE(claudiub): In the test image build jobs, this script is not being run in a git repository, # NOTE(claudiub): In the test image build jobs, this script is not being run in a git repository,
# which would cause git log to fail. Instead, we can use the GIT_COMMIT_ID set in cloudbuild.yaml. # which would cause git log to fail. Instead, we can use the GIT_COMMIT_ID set in cloudbuild.yaml.
-- --
2.39.3 (Apple Git-145) 2.45.2

View File

@ -3,7 +3,7 @@
Name: kubernetes Name: kubernetes
Version: 1.29.1 Version: 1.29.1
Release: 5 Release: 6
Summary: Container cluster management Summary: Container cluster management
License: ASL 2.0 License: ASL 2.0
URL: https://k8s.io/kubernetes URL: https://k8s.io/kubernetes
@ -27,7 +27,12 @@ Source15: kubernetes.conf
Patch0001: 0001-fix-compile-options.patch Patch0001: 0001-fix-compile-options.patch
Patch0002: 0002-kubelet-support-exec-and-attach-websocket-protocol.patch Patch0002: 0002-kubelet-support-exec-and-attach-websocket-protocol.patch
Patch0003: 0003-Add-envFrom-to-serviceaccount-admission-plugin.patch Patch0003: 0003-Add-envFrom-to-serviceaccount-admission-plugin.patch
%ifarch riscv64
Patch1000: 1000-Add-riscv64-support-for-v1.29.1-kubernetes.patch
%endif
%ifarch loong64
Patch1001: 1001-Add-loong64-host-build-support.patch Patch1001: 1001-Add-loong64-host-build-support.patch
%endif
%description %description
Container cluster management. Container cluster management.
@ -266,6 +271,9 @@ getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \
%systemd_postun kubelet kube-proxy %systemd_postun kubelet kube-proxy
%changelog %changelog
* Wed Jul 03 2024 heruoqing <ruoqing@iscas.ac.cn> - 1.29.1-6
- DESC: reapply riscv64 patch
* Fri Jun 14 2024 wangweijie <wangweijie@loongson.cn> - 1.29.1-5 * Fri Jun 14 2024 wangweijie <wangweijie@loongson.cn> - 1.29.1-5
- DESC:add loong64 host build support - DESC:add loong64 host build support