Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
From 36b9aa5a8e071ac6349d2d7f9c23a25abcdc316d Mon Sep 17 00:00:00 2001
From: Adam Duskett <aduskett@gmail.com>
Date: Tue, 2 Nov 2021 10:30:55 -0700
Subject: [PATCH] pmu-query.py: fix python3 errors, add linux platform support
Unfortuantly, commit 0212b382624c744491a845c75dfb2a527d4a821f broke pmu-query
in some unexpected ways.
First, urllib.request.urlopen returns a bytes-object in Python3, which results
in the csv.DictReader throwing the error: `TypeError: initial_value must be
str or None, not HTTPResponse` A simple .read().decode('utf-8') appended to
the end of urlopen fixes the error.
Second, passing the map_file_raw string to DictReader results in a malformed
dictionary. Fix this by wrapping the raw text string in io.StringIO().
Third: During the python2 -> python3 refactoring, I accidentally switched some
logic in the pull request. `if core_path != ''` changed to `if not core_path`,
which breaks the logic, the same goes for
`if offcore_path != ''` -> `if not offcore_path`. Change these to
`if core_path` and `if offcore_path` respectively.
From upstream commit: 7a670261c2063595f2330e6cc2a7f19eb18b6ea8
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
pmu-query.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/pmu-query.py b/pmu-query.py
index 5595819..bc1e57b 100755
--- a/pmu-query.py
+++ b/pmu-query.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+import io
import urllib.request
import urllib.parse
import json
@@ -8,6 +9,7 @@ import sys
import platform
import getopt
import re
+import shutil
all_flag = False
download_flag = False
@@ -29,8 +31,8 @@ except getopt.GetoptError as err:
sys.exit(-2)
if filename is None:
- map_file_raw = urllib.request.urlopen("https://download.01.org/perfmon/mapfile.csv")
- map_dict = csv.DictReader(map_file_raw)
+ map_file_raw = urllib.request.urlopen("https://download.01.org/perfmon/mapfile.csv").read().decode('utf-8')
+ map_dict = csv.DictReader(io.StringIO(map_file_raw), delimiter=',')
map_file = []
core_path = ""
offcore_path = ""
@@ -45,20 +47,26 @@ if filename is None:
p = subprocess.Popen(["./pcm-core.exe -c"], stdout=subprocess.PIPE, shell=True)
elif platform.system() == "Windows":
p = subprocess.Popen(["pcm-core.exe", "-c"], stdout=subprocess.PIPE, shell=True)
+ elif platform.system() == "Linux":
+ pcm_core = shutil.which("pcm-core")
+ if not pcm_core:
+ print("Could not find pcm-core executable!")
+ sys.exit(-1)
+ p = subprocess.Popen([pcm_core, "-c"], stdout=subprocess.PIPE, shell=True)
else:
p = subprocess.Popen(["./pcm-core.x -c"], stdout=subprocess.PIPE, shell=True)
(output, err) = p.communicate()
p_status = p.wait()
for model in map_file:
- if re.search(model["Family-model"], output):
+ if re.search(model["Family-model"], output.decode("utf-8")):
if model["EventType"] == "core":
core_path = model["Filename"]
elif model["EventType"] == "offcore":
offcore_path = model["Filename"]
print(model)
- if not core_path:
+ if core_path:
json_core_data = urllib.request.urlopen(
"https://download.01.org/perfmon" + core_path
)
@@ -67,10 +75,10 @@ if filename is None:
with open(core_path.split("/")[-1], "w") as outfile:
json.dump(core_events, outfile, sort_keys=True, indent=4)
else:
- print("no core event found for %s CPU, program abort..." % output)
+ print("no core event found for %s CPU, program abort..." % output.decode("utf-8"))
sys.exit(-1)
- if not offcore_path:
+ if offcore_path:
json_offcore_data = urllib.request.urlopen(
"https://download.01.org/perfmon" + offcore_path
)
--
2.32.0

View File

@@ -0,0 +1,33 @@
comment "pcm-tools needs a toolchain w/ C++, NPTL"
depends on BR2_i386 || BR2_x86_64
depends on !BR2_INSTALL_LIBSTDCPP || \
!BR2_TOOLCHAIN_HAS_THREADS_NPTL
config BR2_PACKAGE_PCM_TOOLS
bool "pcm-tools"
depends on BR2_i386 || BR2_x86_64
depends on BR2_INSTALL_LIBSTDCPP
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
select BR2_PACKAGE_HWDATA
select BR2_PACKAGE_HWDATA_PCI_IDS
help
Processor Counter Monitor (PCM) is an application programming
interface (API) and a set of tools based on the API to monitor
performance and energy metrics of Intel(R) Core(TM), Xeon(R),
Atom(TM) and Xeon Phi(TM) processors.
https://github.com/opcm/pcm
if BR2_PACKAGE_PCM_TOOLS
config BR2_PACKAGE_PCM_TOOLS_PMU_QUERY
bool "install the pmu-query script"
default y
depends on BR2_PACKAGE_PYTHON3
select BR2_PACKAGE_CA_CERTIFICATES # https
select BR2_PACKAGE_PYTHON3_SSL # urllib2
comment "pmu-query needs Python3"
depends on !BR2_PACKAGE_PYTHON3
endif

View File

@@ -0,0 +1,3 @@
# Locally calculated
sha256 832929db1c84d1a50a40487a3c08b67182eabc99689050876430de59894c2714 pcm-tools-93fc9193a70e2f1f054be554c48f4a4791be5032-git4.tar.gz
sha256 0f476c77009f982dcc4bdff41e692ddd456a9862908e99f2ae3d57296decc649 LICENSE

View File

@@ -0,0 +1,45 @@
################################################################################
#
# pcm-tools
#
################################################################################
# Don't use the github helper, as pcm-tools uses git attributes that are
# replaced when generating the archive.
# 93fc9193a70e2f1f054be554c48f4a4791be5032 is the hash of the 202110 tag.
PCM_TOOLS_VERSION = 93fc9193a70e2f1f054be554c48f4a4791be5032
PCM_TOOLS_SITE = https://github.com/opcm/pcm
PCM_TOOLS_SITE_METHOD = git
PCM_TOOLS_LICENSE = BSD-3-Clause
PCM_TOOLS_LICENSE_FILES = LICENSE
PCM_TOOLS_EXE_FILES = \
pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
pcm-pcicfg pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
define PCM_TOOLS_BUILD_CMDS
touch $(@D)/daemon-binaries
$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
CXXFLAGS="$(TARGET_CXXFLAGS) -std=c++11 -fPIC" \
UNAME=Linux HOST=_LINUX \
$(foreach f,$(PCM_TOOLS_EXE_FILES),$(f).x)
endef
ifeq ($(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY),y)
define PCM_TOOLS_INSTALL_PMU_QUERY
$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query
endef
endif
define PCM_TOOLS_INSTALL_TARGET_CMDS
$(foreach f,$(PCM_TOOLS_EXE_FILES),\
$(INSTALL) -D -m 755 $(@D)/$(f).x $(TARGET_DIR)/usr/bin/$(f)
)
$(PCM_TOOLS_INSTALL_PMU_QUERY)
endef
define PCM_TOOLS_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_X86_MSR)
endef
$(eval $(generic-package))