diff --git a/0008-add-riscv-support.patch b/0008-add-riscv-support.patch deleted file mode 100644 index f25c50b34e584aa4c5cabe5d8da3c20367c62aa9..0000000000000000000000000000000000000000 --- a/0008-add-riscv-support.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff -ur kubernetes-1.25.3/hack/lib/golang.sh kubernetes-1.25.3/hack/lib/golang.sh ---- kubernetes-1.25.3/hack/lib/golang.sh 2023-07-28 16:07:07.873130748 +0800 -+++ kubernetes-1.25.3/hack/lib/golang.sh 2023-07-28 17:02:01.192415345 +0800 -@@ -27,6 +27,7 @@ - linux/arm64 - linux/s390x - linux/ppc64le -+ linux/riscv64 - ) - - # The node platforms we build for -@@ -36,6 +37,7 @@ - linux/arm64 - linux/s390x - linux/ppc64le -+ linux/riscv64 - windows/amd64 - ) - -@@ -48,6 +50,7 @@ - linux/arm64 - linux/s390x - linux/ppc64le -+ linux/riscv64 - darwin/amd64 - darwin/arm64 - windows/amd64 -@@ -63,6 +66,7 @@ - linux/arm64 - linux/s390x - linux/ppc64le -+ linux/riscv64 - darwin/amd64 - darwin/arm64 - windows/amd64 -@@ -213,8 +217,8 @@ - - elif [[ "${KUBE_FASTBUILD:-}" == "true" ]]; then - host_arch=$(kube::util::host_arch) -- if [[ "${host_arch}" != "amd64" && "${host_arch}" != "arm64" && "${host_arch}" != "ppc64le" && "${host_arch}" != "s390x" ]]; then -- # on any platform other than amd64, arm64, ppc64le and s390x, we just default to amd64 -+ if [[ "${host_arch}" != "amd64" && "${host_arch}" != "arm64" && "${host_arch}" != "ppc64le" && "${host_arch}" != "s390x" && "${host_arch}" != "riscv64" ]]; then -+ # on any platform other than amd64, arm64, ppc64le and s390x, riscv64, we just default to amd64 - host_arch="amd64" - fi - KUBE_SERVER_PLATFORMS=("linux/${host_arch}") -@@ -444,6 +448,10 @@ - export CGO_ENABLED=1 - export CC=${KUBE_LINUX_S390X_CC:-s390x-linux-gnu-gcc} - ;; -+ "linux/riscv64") -+ export CGO_ENABLED=1 -+ export CC=${KUBE_LINUX_S390X_CC:-riscv64-linux-gnu-gcc} -+ ;; - esac - fi - -diff -ur kubernetes-1.25.3/hack/lib/util.sh kubernetes-1.25.3/hack/lib/util.sh ---- kubernetes-1.25.3/hack/lib/util.sh 2022-10-12 18:47:25.000000000 +0800 -+++ kubernetes-1.25.3/hack/lib/util.sh 2023-07-28 16:09:27.117412982 +0800 -@@ -185,8 +185,11 @@ - ppc64le*) - host_arch=ppc64le - ;; -+ 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, riscv64, s390x or ppc64le." - exit 1 - ;; - esac -diff -ur kubernetes-1.25.3/hack/local-up-cluster.sh kubernetes-1.25.3/hack/local-up-cluster.sh ---- kubernetes-1.25.3/hack/local-up-cluster.sh 2022-10-12 18:47:25.000000000 +0800 -+++ kubernetes-1.25.3/hack/local-up-cluster.sh 2023-07-28 16:08:57.429352807 +0800 -@@ -316,8 +316,11 @@ - ppc64le*) - host_arch=ppc64le - ;; -+ 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, riscv64, s390x or ppc64le." >&2 - exit 1 - ;; - esac diff --git a/1000-add-riscv-support.patch b/1000-add-riscv-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..8e2ff70c9ed098c6377e8434aa5640efc787d852 --- /dev/null +++ b/1000-add-riscv-support.patch @@ -0,0 +1,185 @@ +From 20db0e90fdfb804c5639964c54df4854771d92f7 Mon Sep 17 00:00:00 2001 +From: misaka00251 +Date: Mon, 25 Sep 2023 10:49:49 +0800 +Subject: [PATCH] Add riscv64 support + +--- + build/pause/Makefile | 3 ++- + cluster/get-kube-binaries.sh | 5 ++++- + cluster/images/etcd/Makefile | 5 ++++- + hack/lib/golang.sh | 12 ++++++++++-- + hack/lib/util.sh | 5 ++++- + hack/local-up-cluster.sh | 5 ++++- + test/images/image-util.sh | 2 +- + 7 files changed, 29 insertions(+), 8 deletions(-) + +diff --git a/build/pause/Makefile b/build/pause/Makefile +index 256a9fd1..ac01e882 100644 +--- a/build/pause/Makefile ++++ b/build/pause/Makefile +@@ -32,7 +32,7 @@ OSVERSION ?= 1809 20H2 ltsc2022 + OUTPUT_TYPE ?= docker + + ALL_OS = linux windows +-ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x ++ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x riscv64 + ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch)) + ALL_ARCH.windows = amd64 + ALL_OSVERSIONS.windows := 1809 20H2 ltsc2022 +@@ -66,6 +66,7 @@ TRIPLE.linux-arm := arm-linux-gnueabihf + TRIPLE.linux-arm64 := aarch64-linux-gnu + TRIPLE.linux-ppc64le := powerpc64le-linux-gnu + TRIPLE.linux-s390x := s390x-linux-gnu ++TRIPLE.linux-riscv64 := riscv64-linux-gnu + TRIPLE := ${TRIPLE.${OS}-${ARCH}} + BASE.linux := scratch + # 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 +index 589a335f..81dc0a1c 100755 +--- a/cluster/get-kube-binaries.sh ++++ b/cluster/get-kube-binaries.sh +@@ -120,9 +120,12 @@ function detect_client_info() { + s390x*) + CLIENT_ARCH="s390x" + ;; ++ riscv64*) ++ CLIENT_ARCH="riscv64" ++ ;; + *) + echo "Unknown, unsupported architecture (${machine})." >&2 +- echo "Supported architectures x86_64, i686, arm, arm64, ppc64le, s390x." >&2 ++ echo "Supported architectures x86_64, i686, arm, arm64, ppc64le, s390x, riscv64." >&2 + echo "Bailing out." >&2 + exit 3 + ;; +diff --git a/cluster/images/etcd/Makefile b/cluster/images/etcd/Makefile +index 5543cc61..cde77f89 100644 +--- a/cluster/images/etcd/Makefile ++++ b/cluster/images/etcd/Makefile +@@ -51,7 +51,7 @@ OSVERSION ?= 1809 + OUTPUT_TYPE ?= docker + + ALL_OS = linux windows +-ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x ++ALL_ARCH.linux = amd64 arm arm64 ppc64le s390x riscv64 + ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch)) + ALL_ARCH.windows = amd64 + ALL_OSVERSIONS.windows := 1809 20H2 ltsc2022 +@@ -106,6 +106,9 @@ endif + ifeq ($(ARCH),s390x) + BASEIMAGE?=registry.k8s.io/build-image/debian-base-s390x:bullseye-v1.3.0 + endif ++ifeq ($(ARCH),riscv64) ++ BASEIMAGE?=registry.k8s.io/build-image/debian-base-riscv64:bullseye-v1.3.0 ++endif + + BASE.windows = mcr.microsoft.com/windows/nanoserver + +diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh +index c6cbce44..ccdb753e 100755 +--- a/hack/lib/golang.sh ++++ b/hack/lib/golang.sh +@@ -27,6 +27,7 @@ readonly KUBE_SUPPORTED_SERVER_PLATFORMS=( + linux/arm64 + linux/s390x + linux/ppc64le ++ linux/riscv64 + ) + + # The node platforms we build for +@@ -36,6 +37,7 @@ readonly KUBE_SUPPORTED_NODE_PLATFORMS=( + linux/arm64 + linux/s390x + linux/ppc64le ++ linux/riscv64 + windows/amd64 + ) + +@@ -48,6 +50,7 @@ readonly KUBE_SUPPORTED_CLIENT_PLATFORMS=( + linux/arm64 + linux/s390x + linux/ppc64le ++ linux/riscv64 + darwin/amd64 + darwin/arm64 + windows/amd64 +@@ -63,6 +66,7 @@ readonly KUBE_SUPPORTED_TEST_PLATFORMS=( + linux/arm64 + linux/s390x + linux/ppc64le ++ linux/riscv64 + darwin/amd64 + darwin/arm64 + windows/amd64 +@@ -213,8 +217,8 @@ kube::golang::setup_platforms() { + + elif [[ "${KUBE_FASTBUILD:-}" == "true" ]]; then + host_arch=$(kube::util::host_arch) +- if [[ "${host_arch}" != "amd64" && "${host_arch}" != "arm64" && "${host_arch}" != "ppc64le" && "${host_arch}" != "s390x" ]]; then +- # on any platform other than amd64, arm64, ppc64le and s390x, we just default to amd64 ++ if [[ "${host_arch}" != "amd64" && "${host_arch}" != "arm64" && "${host_arch}" != "ppc64le" && "${host_arch}" != "s390x" && "${host_arch}" != "riscv64" ]]; then ++ # on any platform other than amd64, arm64, ppc64le, s390x and riscv64, we just default to amd64 + host_arch="amd64" + fi + KUBE_SERVER_PLATFORMS=("linux/${host_arch}") +@@ -444,6 +448,10 @@ kube::golang::set_platform_envs() { + export CGO_ENABLED=1 + export CC=${KUBE_LINUX_S390X_CC:-s390x-linux-gnu-gcc} + ;; ++ "linux/riscv64") ++ export CGO_ENABLED=1 ++ export CC=${KUBE_LINUX_RISCV64_CC:-riscv64-linux-gnu-gcc} ++ ;; + esac + fi + +diff --git a/hack/lib/util.sh b/hack/lib/util.sh +index 67454132..d0b3d3ed 100755 +--- a/hack/lib/util.sh ++++ b/hack/lib/util.sh +@@ -185,8 +185,11 @@ kube::util::host_arch() { + ppc64le*) + host_arch=ppc64le + ;; ++ 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, ppc64le or riscv64." + exit 1 + ;; + esac +diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh +index 0a49b296..6c909be0 100755 +--- a/hack/local-up-cluster.sh ++++ b/hack/local-up-cluster.sh +@@ -316,8 +316,11 @@ function detect_binary { + ppc64le*) + host_arch=ppc64le + ;; ++ 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 + exit 1 + ;; + esac +diff --git a/test/images/image-util.sh b/test/images/image-util.sh +index 2b211868..5d6b91a4 100755 +--- a/test/images/image-util.sh ++++ b/test/images/image-util.sh +@@ -34,7 +34,7 @@ source "${KUBE_ROOT}/hack/lib/logging.sh" + source "${KUBE_ROOT}/hack/lib/util.sh" + + # Mapping of go ARCH to actual architectures shipped part of multiarch/qemu-user-static project +-declare -A QEMUARCHS=( ["amd64"]="x86_64" ["arm"]="arm" ["arm64"]="aarch64" ["ppc64le"]="ppc64le" ["s390x"]="s390x" ) ++declare -A QEMUARCHS=( ["amd64"]="x86_64" ["arm"]="arm" ["arm64"]="aarch64" ["ppc64le"]="ppc64le" ["s390x"]="s390x" ["riscv64"]="riscv64") + + # 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. +-- +2.39.3 (Apple Git-145) + diff --git a/kubernetes.spec b/kubernetes.spec index b976165c75b628ba7348c1c6d1e40967e1e34fc4..12e4d51e474f22971c71193ce766a2ed8a6c0920 100644 --- a/kubernetes.spec +++ b/kubernetes.spec @@ -3,7 +3,7 @@ Name: kubernetes Version: 1.25.3 -Release: 2 +Release: 3 Summary: Container cluster management License: ASL 2.0 URL: https://k8s.io/kubernetes @@ -31,7 +31,7 @@ Patch0004: 0004-Return-error-for-localhost-seccomp-type-with-no-loca.patch Patch0005: 0005-Validate-etcd-paths.patch Patch0006: 0006-fix-node-address-validation.patch Patch0007: 0007-Add-ephemeralcontainer-to-imagepolicy-securityaccoun.patch -Patch0008: 0008-add-riscv-support.patch +Patch1000: 1000-add-riscv-support.patch %description Container cluster management. @@ -263,6 +263,9 @@ getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \ %systemd_postun kubelet kube-proxy %changelog +* Mon Sep 25 2023 misaka00251 - 1.25.3-3 +- Fix add riscv64 support patch + * Fri Jul 28 2023 zhangxiang - 1.25.3-2 - DESC:add riscv64 support