Compare commits
10 Commits
5b2fd4e926
...
8c9474e6bc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c9474e6bc | ||
|
|
2da38ac208 | ||
|
|
fd71d38ac5 | ||
|
|
6380cdc963 | ||
|
|
667265f91a | ||
|
|
2c6d7bf37c | ||
|
|
17a37c4a03 | ||
|
|
36667e1b98 | ||
|
|
22543d576f | ||
|
|
76d5edb9ef |
185
1000-add-riscv64-support-for-crc32-and-procfs.patch
Normal file
185
1000-add-riscv64-support-for-crc32-and-procfs.patch
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
From 7d847af2666ca6204d66b253b87019eb961f5812 Mon Sep 17 00:00:00 2001
|
||||||
|
From: misaka00251 <liuxin@iscas.ac.cn>
|
||||||
|
Date: Fri, 1 Sep 2023 16:25:48 +0800
|
||||||
|
Subject: [PATCH] Add riscv64 support for crc32 & procfs
|
||||||
|
|
||||||
|
---
|
||||||
|
.../klauspost/crc32/crc32_generic.go | 2 +-
|
||||||
|
.../github.com/prometheus/procfs/cpuinfo.go | 40 +++++++++++++++++++
|
||||||
|
.../prometheus/procfs/cpuinfo_riscvx.go | 20 ++++++++++
|
||||||
|
.../github.com/prometheus/procfs/cpuinfo.go | 41 +++++++++++++++++++
|
||||||
|
.../prometheus/procfs/cpuinfo_riscvx.go | 20 +++++++++
|
||||||
|
5 files changed, 121 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 cmd/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
|
||||||
|
create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
|
||||||
|
|
||||||
|
diff --git a/cmd/vendor/github.com/klauspost/crc32/crc32_generic.go b/cmd/vendor/github.com/klauspost/crc32/crc32_generic.go
|
||||||
|
index c4d06a2..e2673f5 100644
|
||||||
|
--- a/cmd/vendor/github.com/klauspost/crc32/crc32_generic.go
|
||||||
|
+++ b/cmd/vendor/github.com/klauspost/crc32/crc32_generic.go
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
-// +build 386 arm arm64 ppc64 ppc64le appengine loong64
|
||||||
|
+// +build 386 arm arm64 ppc64 ppc64le appengine loong64 riscv64
|
||||||
|
|
||||||
|
package crc32
|
||||||
|
|
||||||
|
diff --git a/cmd/vendor/github.com/prometheus/procfs/cpuinfo.go b/cmd/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
index 2c2a27f..ad9761b 100644
|
||||||
|
--- a/cmd/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
+++ b/cmd/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
@@ -443,6 +443,46 @@ func parseCPUInfoPPC(info []byte) ([]CPUInfo, error) {
|
||||||
|
return cpuinfo, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
+func parseCPUInfoRISCV(info []byte) ([]CPUInfo, error) {
|
||||||
|
+ scanner := bufio.NewScanner(bytes.NewReader(info))
|
||||||
|
+
|
||||||
|
+ firstLine := firstNonEmptyLine(scanner)
|
||||||
|
+ if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") {
|
||||||
|
+ return nil, errors.New("invalid cpuinfo file: " + firstLine)
|
||||||
|
+ }
|
||||||
|
+ field := strings.SplitN(firstLine, ": ", 2)
|
||||||
|
+ v, err := strconv.ParseUint(field[1], 0, 32)
|
||||||
|
+ if err != nil {
|
||||||
|
+ return nil, err
|
||||||
|
+ }
|
||||||
|
+ firstcpu := CPUInfo{Processor: uint(v)}
|
||||||
|
+ cpuinfo := []CPUInfo{firstcpu}
|
||||||
|
+ i := 0
|
||||||
|
+
|
||||||
|
+ for scanner.Scan() {
|
||||||
|
+ line := scanner.Text()
|
||||||
|
+ if !strings.Contains(line, ":") {
|
||||||
|
+ continue
|
||||||
|
+ }
|
||||||
|
+ field := strings.SplitN(line, ": ", 2)
|
||||||
|
+ switch strings.TrimSpace(field[0]) {
|
||||||
|
+ case "processor":
|
||||||
|
+ v, err := strconv.ParseUint(field[1], 0, 32)
|
||||||
|
+ if err != nil {
|
||||||
|
+ return nil, err
|
||||||
|
+ }
|
||||||
|
+ i = int(v)
|
||||||
|
+ cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
|
||||||
|
+ cpuinfo[i].Processor = uint(v)
|
||||||
|
+ case "hart":
|
||||||
|
+ cpuinfo[i].CoreID = field[1]
|
||||||
|
+ case "isa":
|
||||||
|
+ cpuinfo[i].ModelName = field[1]
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return cpuinfo, nil
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
// firstNonEmptyLine advances the scanner to the first non-empty line
|
||||||
|
// and returns the contents of that line
|
||||||
|
func firstNonEmptyLine(scanner *bufio.Scanner) string {
|
||||||
|
diff --git a/cmd/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go b/cmd/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1c9b731
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/cmd/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
|
||||||
|
@@ -0,0 +1,20 @@
|
||||||
|
+// 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.
|
||||||
|
+
|
||||||
|
+//go:build linux && (riscv || riscv64)
|
||||||
|
+// +build linux
|
||||||
|
+// +build riscv riscv64
|
||||||
|
+
|
||||||
|
+package procfs
|
||||||
|
+
|
||||||
|
+var parseCPUInfo = parseCPUInfoRISCV
|
||||||
|
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
index 81db195..abd85d8 100644
|
||||||
|
--- a/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
+++ b/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
@@ -444,6 +444,46 @@ func parseCPUInfoPPC(info []byte) ([]CPUInfo, error) {
|
||||||
|
return cpuinfo, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
+func parseCPUInfoRISCV(info []byte) ([]CPUInfo, error) {
|
||||||
|
+ scanner := bufio.NewScanner(bytes.NewReader(info))
|
||||||
|
+
|
||||||
|
+ firstLine := firstNonEmptyLine(scanner)
|
||||||
|
+ if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") {
|
||||||
|
+ return nil, errors.New("invalid cpuinfo file: " + firstLine)
|
||||||
|
+ }
|
||||||
|
+ field := strings.SplitN(firstLine, ": ", 2)
|
||||||
|
+ v, err := strconv.ParseUint(field[1], 0, 32)
|
||||||
|
+ if err != nil {
|
||||||
|
+ return nil, err
|
||||||
|
+ }
|
||||||
|
+ firstcpu := CPUInfo{Processor: uint(v)}
|
||||||
|
+ cpuinfo := []CPUInfo{firstcpu}
|
||||||
|
+ i := 0
|
||||||
|
+
|
||||||
|
+ for scanner.Scan() {
|
||||||
|
+ line := scanner.Text()
|
||||||
|
+ if !strings.Contains(line, ":") {
|
||||||
|
+ continue
|
||||||
|
+ }
|
||||||
|
+ field := strings.SplitN(line, ": ", 2)
|
||||||
|
+ switch strings.TrimSpace(field[0]) {
|
||||||
|
+ case "processor":
|
||||||
|
+ v, err := strconv.ParseUint(field[1], 0, 32)
|
||||||
|
+ if err != nil {
|
||||||
|
+ return nil, err
|
||||||
|
+ }
|
||||||
|
+ i = int(v)
|
||||||
|
+ cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
|
||||||
|
+ cpuinfo[i].Processor = uint(v)
|
||||||
|
+ case "hart":
|
||||||
|
+ cpuinfo[i].CoreID = field[1]
|
||||||
|
+ case "isa":
|
||||||
|
+ cpuinfo[i].ModelName = field[1]
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return cpuinfo, nil
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
// firstNonEmptyLine advances the scanner to the first non-empty line
|
||||||
|
// and returns the contents of that line
|
||||||
|
func firstNonEmptyLine(scanner *bufio.Scanner) string {
|
||||||
|
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1c9b731
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
|
||||||
|
@@ -0,0 +1,20 @@
|
||||||
|
+// 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.
|
||||||
|
+
|
||||||
|
+//go:build linux && (riscv || riscv64)
|
||||||
|
+// +build linux
|
||||||
|
+// +build riscv riscv64
|
||||||
|
+
|
||||||
|
+package procfs
|
||||||
|
+
|
||||||
|
+var parseCPUInfo = parseCPUInfoRISCV
|
||||||
|
--
|
||||||
|
2.39.2 (Apple Git-143)
|
||||||
|
|
||||||
200
Add-loong64-support-for-runc-procfs-and-crc32.patch
Normal file
200
Add-loong64-support-for-runc-procfs-and-crc32.patch
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
From 1740c129b687031aac3f9383ca242d82877a3a4a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jingyun Hua <huajingyun@loongson.cn>
|
||||||
|
Date: Tue, 6 Jun 2023 12:58:28 +0000
|
||||||
|
Subject: [PATCH] Add loong64 support for runc,procfs and crc32
|
||||||
|
|
||||||
|
Signed-off-by: Jingyun Hua <huajingyun@loongson.cn>
|
||||||
|
---
|
||||||
|
.../klauspost/crc32/crc32_generic.go | 2 +-
|
||||||
|
.../libcontainer/system/syscall_linux_64.go | 2 +-
|
||||||
|
.../github.com/prometheus/procfs/cpuinfo.go | 36 +++++++++++++++++++
|
||||||
|
.../prometheus/procfs/cpuinfo_loong64.go | 19 ++++++++++
|
||||||
|
.../libcontainer/system/syscall_linux_64.go | 2 +-
|
||||||
|
.../github.com/prometheus/procfs/cpuinfo.go | 36 +++++++++++++++++++
|
||||||
|
.../prometheus/procfs/cpuinfo_loong64.go | 19 ++++++++++
|
||||||
|
7 files changed, 113 insertions(+), 3 deletions(-)
|
||||||
|
create mode 100644 cmd/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
|
||||||
|
create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
|
||||||
|
|
||||||
|
diff --git a/cmd/vendor/github.com/klauspost/crc32/crc32_generic.go b/cmd/vendor/github.com/klauspost/crc32/crc32_generic.go
|
||||||
|
index d6f8f85..c4d06a2 100644
|
||||||
|
--- a/cmd/vendor/github.com/klauspost/crc32/crc32_generic.go
|
||||||
|
+++ b/cmd/vendor/github.com/klauspost/crc32/crc32_generic.go
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
-// +build 386 arm arm64 ppc64 ppc64le appengine
|
||||||
|
+// +build 386 arm arm64 ppc64 ppc64le appengine loong64
|
||||||
|
|
||||||
|
package crc32
|
||||||
|
|
||||||
|
diff --git a/cmd/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go b/cmd/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go
|
||||||
|
index e05e30a..14d33f1 100644
|
||||||
|
--- a/cmd/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go
|
||||||
|
+++ b/cmd/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
// +build linux
|
||||||
|
-// +build arm64 amd64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x
|
||||||
|
+// +build arm64 amd64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x loong64
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
diff --git a/cmd/vendor/github.com/prometheus/procfs/cpuinfo.go b/cmd/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
index 31d42f7..2c2a27f 100644
|
||||||
|
--- a/cmd/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
+++ b/cmd/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
@@ -362,6 +362,42 @@ func parseCPUInfoMips(info []byte) ([]CPUInfo, error) {
|
||||||
|
return cpuinfo, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
+func parseCPUInfoLoong(info []byte) ([]CPUInfo, error) {
|
||||||
|
+ scanner := bufio.NewScanner(bytes.NewReader(info))
|
||||||
|
+ // find the first "processor" line
|
||||||
|
+ firstLine := firstNonEmptyLine(scanner)
|
||||||
|
+ if !strings.HasPrefix(firstLine, "system type") || !strings.Contains(firstLine, ":") {
|
||||||
|
+ return nil, errors.New("invalid cpuinfo file: " + firstLine)
|
||||||
|
+ }
|
||||||
|
+ field := strings.SplitN(firstLine, ": ", 2)
|
||||||
|
+ cpuinfo := []CPUInfo{}
|
||||||
|
+ systemType := field[1]
|
||||||
|
+ i := 0
|
||||||
|
+ for scanner.Scan() {
|
||||||
|
+ line := scanner.Text()
|
||||||
|
+ if !strings.Contains(line, ":") {
|
||||||
|
+ continue
|
||||||
|
+ }
|
||||||
|
+ field := strings.SplitN(line, ": ", 2)
|
||||||
|
+ switch strings.TrimSpace(field[0]) {
|
||||||
|
+ case "processor":
|
||||||
|
+ v, err := strconv.ParseUint(field[1], 0, 32)
|
||||||
|
+ if err != nil {
|
||||||
|
+ return nil, err
|
||||||
|
+ }
|
||||||
|
+ i = int(v)
|
||||||
|
+ cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
|
||||||
|
+ cpuinfo[i].Processor = uint(v)
|
||||||
|
+ cpuinfo[i].VendorID = systemType
|
||||||
|
+ case "CPU Family":
|
||||||
|
+ cpuinfo[i].CPUFamily = field[1]
|
||||||
|
+ case "Model Name":
|
||||||
|
+ cpuinfo[i].ModelName = field[1]
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return cpuinfo, nil
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
func parseCPUInfoPPC(info []byte) ([]CPUInfo, error) {
|
||||||
|
scanner := bufio.NewScanner(bytes.NewReader(info))
|
||||||
|
|
||||||
|
diff --git a/cmd/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go b/cmd/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..d88442f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/cmd/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
|
||||||
|
@@ -0,0 +1,19 @@
|
||||||
|
+// Copyright 2022 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.
|
||||||
|
+
|
||||||
|
+//go:build linux
|
||||||
|
+// +build linux
|
||||||
|
+
|
||||||
|
+package procfs
|
||||||
|
+
|
||||||
|
+var parseCPUInfo = parseCPUInfoLoong
|
||||||
|
diff --git a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go
|
||||||
|
index e05e30a..14d33f1 100644
|
||||||
|
--- a/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go
|
||||||
|
+++ b/vendor/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go
|
||||||
|
@@ -1,5 +1,5 @@
|
||||||
|
// +build linux
|
||||||
|
-// +build arm64 amd64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x
|
||||||
|
+// +build arm64 amd64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x loong64
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
index 31d42f7..2c2a27f 100644
|
||||||
|
--- a/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
+++ b/vendor/github.com/prometheus/procfs/cpuinfo.go
|
||||||
|
@@ -362,6 +362,42 @@ func parseCPUInfoMips(info []byte) ([]CPUInfo, error) {
|
||||||
|
return cpuinfo, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
+func parseCPUInfoLoong(info []byte) ([]CPUInfo, error) {
|
||||||
|
+ scanner := bufio.NewScanner(bytes.NewReader(info))
|
||||||
|
+ // find the first "processor" line
|
||||||
|
+ firstLine := firstNonEmptyLine(scanner)
|
||||||
|
+ if !strings.HasPrefix(firstLine, "system type") || !strings.Contains(firstLine, ":") {
|
||||||
|
+ return nil, errors.New("invalid cpuinfo file: " + firstLine)
|
||||||
|
+ }
|
||||||
|
+ field := strings.SplitN(firstLine, ": ", 2)
|
||||||
|
+ cpuinfo := []CPUInfo{}
|
||||||
|
+ systemType := field[1]
|
||||||
|
+ i := 0
|
||||||
|
+ for scanner.Scan() {
|
||||||
|
+ line := scanner.Text()
|
||||||
|
+ if !strings.Contains(line, ":") {
|
||||||
|
+ continue
|
||||||
|
+ }
|
||||||
|
+ field := strings.SplitN(line, ": ", 2)
|
||||||
|
+ switch strings.TrimSpace(field[0]) {
|
||||||
|
+ case "processor":
|
||||||
|
+ v, err := strconv.ParseUint(field[1], 0, 32)
|
||||||
|
+ if err != nil {
|
||||||
|
+ return nil, err
|
||||||
|
+ }
|
||||||
|
+ i = int(v)
|
||||||
|
+ cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
|
||||||
|
+ cpuinfo[i].Processor = uint(v)
|
||||||
|
+ cpuinfo[i].VendorID = systemType
|
||||||
|
+ case "CPU Family":
|
||||||
|
+ cpuinfo[i].CPUFamily = field[1]
|
||||||
|
+ case "Model Name":
|
||||||
|
+ cpuinfo[i].ModelName = field[1]
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return cpuinfo, nil
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
func parseCPUInfoPPC(info []byte) ([]CPUInfo, error) {
|
||||||
|
scanner := bufio.NewScanner(bytes.NewReader(info))
|
||||||
|
|
||||||
|
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go b/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..d88442f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
|
||||||
|
@@ -0,0 +1,19 @@
|
||||||
|
+// Copyright 2022 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.
|
||||||
|
+
|
||||||
|
+//go:build linux
|
||||||
|
+// +build linux
|
||||||
|
+
|
||||||
|
+package procfs
|
||||||
|
+
|
||||||
|
+var parseCPUInfo = parseCPUInfoLoong
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
35
add-parameters-to-solve-the-strip.patch
Normal file
35
add-parameters-to-solve-the-strip.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
From 0bd8cba374f1c735f48945fb14f165f087d49bd1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: jxy_git <jiangxinyu@kylinos.cn>
|
||||||
|
Date: Tue, 7 Mar 2023 16:54:00 +0800
|
||||||
|
Subject: [PATCH] add parameters to solve the strip
|
||||||
|
|
||||||
|
---
|
||||||
|
build/build.sh | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/build/build.sh b/build/build.sh
|
||||||
|
index b8cae39..79cec50 100755
|
||||||
|
--- a/build/build.sh
|
||||||
|
+++ b/build/build.sh
|
||||||
|
@@ -37,12 +37,12 @@ if [ "${go_version:0:3}" = "1.4" ]; then
|
||||||
|
fi
|
||||||
|
|
||||||
|
ldflags="
|
||||||
|
- -X ${repo_path}/version.Version${ldseparator}${version}
|
||||||
|
- -X ${repo_path}/version.Revision${ldseparator}${revision}
|
||||||
|
- -X ${repo_path}/version.Branch${ldseparator}${branch}
|
||||||
|
- -X ${repo_path}/version.BuildUser${ldseparator}${BUILD_USER}
|
||||||
|
- -X ${repo_path}/version.BuildDate${ldseparator}${BUILD_DATE}
|
||||||
|
- -X ${repo_path}/version.GoVersion${ldseparator}${go_version}"
|
||||||
|
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X ${repo_path}/version.Version${ldseparator}${version}
|
||||||
|
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X ${repo_path}/version.Revision${ldseparator}${revision}
|
||||||
|
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X ${repo_path}/version.Branch${ldseparator}${branch}
|
||||||
|
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X ${repo_path}/version.BuildUser${ldseparator}${BUILD_USER}
|
||||||
|
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X ${repo_path}/version.BuildDate${ldseparator}${BUILD_DATE}
|
||||||
|
+ -w -s -linkmode=external -extldflags '-Wl,-z,relro -Wl,-z,now -pie' -X ${repo_path}/version.GoVersion${ldseparator}${go_version}"
|
||||||
|
|
||||||
|
echo ">> building cadvisor"
|
||||||
|
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
||||||
33
backport-Set-verbosity-after-flag-definition.patch
Normal file
33
backport-Set-verbosity-after-flag-definition.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
From a5141527ab5fd51c1776547ab806a7098f1cc952 Mon Sep 17 00:00:00 2001
|
||||||
|
From: jiangxinyu <jiangxinyu@kylinos.cn>
|
||||||
|
Date: Thu, 19 Sep 2024 13:37:57 +0800
|
||||||
|
Subject: [PATCH] Set verbosity after flag definition
|
||||||
|
Reference: https://github.com/google/cadvisor/pull/3384/commits/20317bfa449ae54cb2f9135482f08fb70a01c16f
|
||||||
|
|
||||||
|
---
|
||||||
|
cmd/cadvisor.go | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/cmd/cadvisor.go b/cmd/cadvisor.go
|
||||||
|
index 505d091..b474512 100644
|
||||||
|
--- a/cmd/cadvisor.go
|
||||||
|
+++ b/cmd/cadvisor.go
|
||||||
|
@@ -141,13 +141,13 @@ func (ml *metricSetValue) Set(value string) error {
|
||||||
|
func init() {
|
||||||
|
flag.Var(&ignoreMetrics, "disable_metrics", "comma-separated list of `metrics` to be disabled. Options are 'accelerator', 'cpu_topology','disk', 'diskIO', 'network', 'tcp', 'udp', 'percpu', 'sched', 'process', 'hugetlb', 'referenced_memory', 'resctrl'.")
|
||||||
|
|
||||||
|
- // Default logging verbosity to V(2)
|
||||||
|
- flag.Set("v", "2")
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
klog.InitFlags(nil)
|
||||||
|
defer klog.Flush()
|
||||||
|
+ // Default logging verbosity to V(2)
|
||||||
|
+ _ = flag.Set("v", "2")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
if *versionFlag {
|
||||||
|
--
|
||||||
|
2.46.0
|
||||||
|
|
||||||
@ -2,17 +2,22 @@
|
|||||||
|
|
||||||
Name: cadvisor
|
Name: cadvisor
|
||||||
Version: 0.37.0
|
Version: 0.37.0
|
||||||
Release: 1
|
Release: 6
|
||||||
Summary: Analyzes resource usage and performance characteristics of running containers.
|
Summary: Analyzes resource usage and performance characteristics of running containers.
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
URL: https://github.com/google/cadvisor
|
URL: https://github.com/google/cadvisor
|
||||||
|
|
||||||
Source0: https://github.com/google/cadvisor/archive/v%{version}.tar.gz
|
Source0: https://github.com/google/cadvisor/archive/v%{version}.tar.gz
|
||||||
Source1: vendor.tar.gz
|
Source1: vendor.tar.gz
|
||||||
|
#source2 version sys@v0.0.0-20220908164124-27713097b956
|
||||||
|
Source2: sys.tar.gz
|
||||||
Patch0: use_preinstalled_go-bindata.patch
|
Patch0: use_preinstalled_go-bindata.patch
|
||||||
|
Patch1: add-parameters-to-solve-the-strip.patch
|
||||||
|
Patch2: Add-loong64-support-for-runc-procfs-and-crc32.patch
|
||||||
|
Patch3: backport-Set-verbosity-after-flag-definition.patch
|
||||||
|
Patch1000: 1000-add-riscv64-support-for-crc32-and-procfs.patch
|
||||||
|
|
||||||
BuildRequires: golang >= 1.13
|
BuildRequires: golang >= 1.13
|
||||||
BuildRequires: go-bindata
|
|
||||||
|
|
||||||
Conflicts: cadvisor
|
Conflicts: cadvisor
|
||||||
Provides: %{name} = %{version}
|
Provides: %{name} = %{version}
|
||||||
@ -29,10 +34,23 @@ and network statistics. This data is exported by container and machine-wide.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -T -n %{name}-%{version} -b 0 -b 1
|
%setup -q -T -n %{name}-%{version} -b 0 -b 1
|
||||||
%patch0 -p1
|
%patch 0 -p1
|
||||||
|
%patch 1 -p1
|
||||||
|
%patch 2 -p1
|
||||||
|
%patch 3 -p1
|
||||||
|
%ifarch loongarch64
|
||||||
|
rm -rf vendor/golang.org/x/sys
|
||||||
|
rm -rf cmd/vendor/golang.org/x/sys/
|
||||||
|
tar -xf %{SOURCE2} -C vendor/golang.org/x/
|
||||||
|
tar -xf %{SOURCE2} -C cmd/vendor/golang.org/x/
|
||||||
|
%endif
|
||||||
|
%ifarch riscv64
|
||||||
|
%patch1000 -p1
|
||||||
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
GOFLAGS=-mod=vendor make build
|
export GOFLAGS="-mod=vendor -buildmode=pie"
|
||||||
|
make build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
install -D -m 755 cadvisor %{buildroot}%{_bindir}/cadvisor
|
install -D -m 755 cadvisor %{buildroot}%{_bindir}/cadvisor
|
||||||
@ -44,5 +62,23 @@ install -D -m 755 cadvisor %{buildroot}%{_bindir}/cadvisor
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 19 2024 jiangxinyu <jiangxinyu@kylinos.cn> - 0.37.0-6
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: Set verbosity after flag definition
|
||||||
|
|
||||||
|
* Thu Aug 31 2023 misaka00251 <liuxin@iscas.ac.cn> - 0.37.0-5
|
||||||
|
- Add riscv64 support
|
||||||
|
|
||||||
|
* Tue Jul 11 2023 huajingyun <huajingyun@loongson.cn> - 0.37.0-4
|
||||||
|
- Add loong64 support
|
||||||
|
|
||||||
|
* Tue Mar 07 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 0.37.0-3
|
||||||
|
- Add strip and pie
|
||||||
|
|
||||||
|
* Fri Jul 22 2022 wo_cow <niuqianqian@huawei.com> - 0.37.0-2
|
||||||
|
- Fix build err: nothing provides go-bindata
|
||||||
|
|
||||||
* Tue Dec 15 2020 yangzhao <yangzhao1@kylinos.cn> - 0.37.0-1
|
* Tue Dec 15 2020 yangzhao <yangzhao1@kylinos.cn> - 0.37.0-1
|
||||||
- Init project cadvisor
|
- Init project cadvisor
|
||||||
|
|||||||
BIN
sys.tar.gz
Normal file
BIN
sys.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user