tools: power: cpupower: Allow overriding cross-compiling envs
v2 cover tools: power: cpupower: Allow overriding cross-compiling envs
Two minor patches:
Patch 1 is not relevant for cross-compiling, but done when I playing with cpupower on ARM64 boards.
Patch 2 is to make it easier for Yocto users to cross-compiling cpupower tools.
V2:
subject update, commit log update in patch 1, 2 Use strerror in patch 1
without patch 2, need update Makefile with 'CROSS = [cross toolchain path]/aarch64-poky-linux-'
---
Peng Fan (2):
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
pm: cpupower: Makefile: Allow overriding cross-compiling env params
tools/power/cpupower/Makefile | 12 ++++++------ tools/power/cpupower/bench/parse.c | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-)
---
base-commit: 6708132e80a2ced620bde9b9c36e426183544a23
change-id: 20240917-pm-08147f104e70
Best regards,
Signature · 1 line
Peng Fan <[email protected]>
PATCH v2 1/2 pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
From: Peng Fan <[email protected]>
Print out the config file path when fopen failed. It will be easy for users to know where to create the file.
Since we are here, use strerror to drop the usage of perror.
--- tools/power/cpupower/bench/parse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/power/cpupower/bench/parse.c +3 -2
@@ -4,6 +4,7 @@* Copyright (C) 2008 Christian Kornacker <[email protected]> */ +#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h>
@@ -165,8 +166,8 @@ int prepare_config(const char *path, struct config *config) configfile =fopen (path,"r" );if (configfile ==NULL ) { -perror ("fopen" ); -fprintf (stderr,"error: unable to read configfile\n" ); +fprintf (stderr,"error: unable to read configfile: %s, %s\n" , + path,strerror (errno));free (config);return 1 ; }
Signature · 1 line
2.37.1
PATCH v2 2/2 pm: cpupower: Makefile: Allow overriding cross-compiling env params
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Allow overriding the cross-comple env parameters to make it easier for Yocto users. Then cross-compiler toolchains to build cpupower with only two steps:
- source (toolchain path)/environment-setup-armv8a-poky-linux
- make
--- tools/power/cpupower/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/power/cpupower/Makefile +6 -6
@@ -86,12 +86,12 @@ INSTALL_SCRIPT = ${INSTALL} -m 644 # If you are running a cross compiler, you may want to set this # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. -CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- -CC = $(CROSS)gcc -LD = $(CROSS)gcc -AR = $(CROSS)ar -STRIP = $(CROSS)strip -RANLIB = $(CROSS)ranlib +CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- +CC ?= $(CROSS)gcc +LD ?= $(CROSS)gcc +AR ?= $(CROSS)ar +STRIP ?= $(CROSS)strip +RANLIB ?= $(CROSS)ranlib HOSTCC = gcc MKDIR = mkdir
Signature · 1 line
2.37.1
Re: [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding cross-compiling env params
Hi Peng,
Quoted 7 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Allow overriding the cross-comple env parameters to make it easier for Yocto users. Then cross-compiler toolchains to build cpupower with only two steps:
- source (toolchain path)/environment-setup-armv8a-poky-linux
- make
This patch breaks the way that buildroot builds cpupower:
https://git.buildroot.net/buildroot/tree/package/linux-tools/linux-tool-cpupower.mk.in
and after enabling verbose it becomes clear as to why, see below:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
linux-tools Configuring
linux-tools Building
GIT_DIR=. PATH="/local/users/fainelli/buildroot-upstream/output/arm/host/bin:/local/users/fainelli/buildroot-upstream/output/arm/host/sbin:/projects/firepath/tools/bin:/home/ff944844/bin:/home/ff944844/.local/bin:/opt/stblinux/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/toolchains/metaware-vctools-0.4.1/bin/" /usr/bin/make -j97 CROSS=/local/users/fainelli/buildroot-upstream/output/arm/host/bin/arm-linux- CPUFREQ_BENCH=false NLS=false LDFLAGS="-L. -L/local/users/fainelli/buildroot-upstream/output/arm/target/usr/lib" DEBUG=false V=1 -C /local/users/fainelli/buildroot-upstream/output/arm/build/linux-custom/tools cpupower mkdir -p power/cpupower && /usr/bin/make subdir=power/cpupower --no-print-directory -C power/cpupower
cc -DVERSION=\"6.12.0\" -DPACKAGE=\"cpupower\" -DPACKAGE_BUGREPORT=\"[email protected]\" -D_GNU_SOURCE -pipe -Wall -Wchar-subscripts -Wpointer-arith -Wsign-compare -Wno-pointer-sign -Wdeclaration-after-statement -Wshadow -Os -fomit-frame-pointer -fPIC -o lib/cpufreq.o -c lib/cpufreq.c
Here we use cc, aka host compiler, rather than $(CROSS)gcc as we should, so we are no longer cross compiling at all.
The issue is the use of the lazy set if absent for *all* of CC, LD, AR, STRIP, RANLIB, rather than just for CROSS. The following fixes it for me:
tools/power/cpupower/Makefile +5 -5
@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644 # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- -CC ?= $(CROSS)gcc -LD ?= $(CROSS)gcc -AR ?= $(CROSS)ar -STRIP ?= $(CROSS)strip -RANLIB ?= $(CROSS)ranlib +CC = $(CROSS)gcc +LD = $(CROSS)gcc +AR = $(CROSS)ar +STRIP = $(CROSS)strip +RANLIB = $(CROSS)ranlib HOSTCC = gcc MKDIR = mkdir
Signature · 1 line
Florian
RE: [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding cross-compiling env params
Quoted 47 lines
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allow overriding cross-compiling env paramsHi Peng,
Quoted 3 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Allow overriding the cross-comple env parameters to make it easier
for
Quoted 4 lines
Yocto users. Then cross-compiler toolchains to build cpupower with only two steps:
- source (toolchain path)/environment-setup-armv8a-poky-linux
- makeThis patch breaks the way that buildroot builds cpupower:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
git.buildroot.net%2Fbuildroot%2Ftree%2Fpackage%2Flinux- tools%2Flinux-tool- cpupower.mk.in&data=05%7C02%7Cpeng.fan%40nxp.com%7C246da9 2d8b6243d138c808dd09e6d644%7C686ea1d3bc2b4c6fa92cd99c5c3 01635%7C0%7C0%7C638677609234547728%7CUnknown%7CTWFpb GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJX aW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdat a=nL1YUl%2F07Vd8F0GpW7uRqdpZT74avOku1ox9N3%2FFkUg%3D&r eserved=0and after enabling verbose it becomes clear as to why, see below:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
linux-tools Configuring
linux-tools BuildingGIT_DIR=.
PATH="/local/users/fainelli/buildroot- upstream/output/arm/host/bin:/local/users/fainelli/buildroot- upstream/output/arm/host/sbin:/projects/firepath/tools/bin:/home/ff 944844/bin:/home/ff944844/.local/bin:/opt/stblinux/bin:/usr/local/sb in:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ga mes:/snap/bin:/opt/toolchains/metaware-vctools-0.4.1/bin/"/usr/bin/make-j97
CROSS=/local/users/fainelli/buildroot- upstream/output/arm/host/bin/arm-linux-
CPUFREQ_BENCH=false NLS=false LDFLAGS="-L. -L/local/users/fainelli/buildroot-upstream/output/arm/target/usr/lib" DEBUG=false V=1 -C /local/users/fainelli/buildroot-upstream/output/arm/build/linux- custom/tools
Quoted 8 lines
cpupower
mkdir -p power/cpupower &&/usr/bin/makesubdir=power/cpupower --no-print-directory -C power/cpupower cc -DVERSION=\"6.12.0\" - DPACKAGE=\"cpupower\" -DPACKAGE_BUGREPORT=\"[email protected]\" -D_GNU_SOURCE-pipe -Wall -Wchar-subscripts -Wpointer-arith -Wsign- compare -Wno-pointer-sign -Wdeclaration-after-statement -Wshadow - Os -fomit-frame-pointer -fPIC -olib/cpufreq.o-clib/cpufreq.c
You are building on an ARM host? Or you are cross compiling with cc is actually arm gcc?
Quoted 3 lines
Here we use cc, aka host compiler, rather than $(CROSS)gcc as we should, so we are no longer cross compiling at all.
I not understand. CROSS was set, but using cc to compile for host?
Quoted 13 lines
The issue is the use of the lazy set if absent for *all* of CC, LD, AR, STRIP, RANLIB, rather than just for CROSS. The following fixes it for me:
(quoted diff) +0
-0b/tools/power/cpupower/Makefile index
175004ce44b2..96bb1e5f3970100644tools/power/cpupower/Makefile +0
-0@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644 # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
tools/power/cpupower/Makefile INSTALL_SCRIPT = ${INSTALL} -m 644 · line 94
Quoted 10 lines
tools/power/cpupower/Makefile +5
-5-CC ?= $(CROSS)gcc -LD ?= $(CROSS)gcc -AR ?= $(CROSS)ar -STRIP ?= $(CROSS)strip -RANLIB ?= $(CROSS)ranlib +CC = $(CROSS)gcc +LD = $(CROSS)gcc +AR = $(CROSS)ar +STRIP = $(CROSS)strip +RANLIB = $(CROSS)ranlib
The ? is just allow to override CC/LD/AR.., so in your env, CC is set, but should not be used for cpupower compling?
Thanks,
Peng.
Quoted 5 lines
tools/power/cpupower/Makefile +0
-1HOSTCC = gcc MKDIR = mkdir --Florian
Re: [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding cross-compiling env params
Quoted 50 lines · Peng Fan
Quoted 50 lines
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allow overriding cross-compiling env paramsHi Peng,
Quoted 3 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Allow overriding the cross-comple env parameters to make it easier
for
Quoted 4 lines
Yocto users. Then cross-compiler toolchains to build cpupower with only two steps:
- source (toolchain path)/environment-setup-armv8a-poky-linux
- makeThis patch breaks the way that buildroot builds cpupower:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
git.buildroot.net%2Fbuildroot%2Ftree%2Fpackage%2Flinux- tools%2Flinux-tool- cpupower.mk.in&data=05%7C02%7Cpeng.fan%40nxp.com%7C246da9 2d8b6243d138c808dd09e6d644%7C686ea1d3bc2b4c6fa92cd99c5c3 01635%7C0%7C0%7C638677609234547728%7CUnknown%7CTWFpb GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJX aW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdat a=nL1YUl%2F07Vd8F0GpW7uRqdpZT74avOku1ox9N3%2FFkUg%3D&r eserved=0and after enabling verbose it becomes clear as to why, see below:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
linux-tools Configuring
linux-tools BuildingGIT_DIR=.
PATH="/local/users/fainelli/buildroot- upstream/output/arm/host/bin:/local/users/fainelli/buildroot- upstream/output/arm/host/sbin:/projects/firepath/tools/bin:/home/ff 944844/bin:/home/ff944844/.local/bin:/opt/stblinux/bin:/usr/local/sb in:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ga mes:/snap/bin:/opt/toolchains/metaware-vctools-0.4.1/bin/"/usr/bin/make-j97
CROSS=/local/users/fainelli/buildroot- upstream/output/arm/host/bin/arm-linux-
CPUFREQ_BENCH=false NLS=false LDFLAGS="-L. -L/local/users/fainelli/buildroot-upstream/output/arm/target/usr/lib" DEBUG=false V=1 -C /local/users/fainelli/buildroot-upstream/output/arm/build/linux- custom/tools
cpupower
mkdir -p power/cpupower &&/usr/bin/makesubdir=power/cpupower --no-print-directory -C power/cpupower cc -DVERSION=\"6.12.0\" -
Quoted 8 lines
Quoted 5 lines
DPACKAGE=\"cpupower\" -DPACKAGE_BUGREPORT=\"[email protected]\" -
D_GNU_SOURCE-pipe -Wall -Wchar-subscripts -Wpointer-arith -Wsign- compare -Wno-pointer-sign -Wdeclaration-after-statement -Wshadow - Os -fomit-frame-pointer -fPIC -olib/cpufreq.o-clib/cpufreq.cYou are building on an ARM host? Or you are cross compiling with cc is actually arm gcc?
This is cross compiling targeting ARM, which is why CROSS is set to ../arm-linux-
Quoted 6 lines
Quoted 4 lines
Here we use cc, aka host compiler, rather than $(CROSS)gcc as we should, so we are no longer cross compiling at all.
I not understand. CROSS was set, but using cc to compile for host?
See below.
Quoted 19 lines
Quoted 19 lines
The issue is the use of the lazy set if absent for *all* of CC, LD, AR, STRIP, RANLIB, rather than just for CROSS. The following fixes it for me:
(quoted diff) +0
-0b/tools/power/cpupower/Makefile index
175004ce44b2..96bb1e5f3970100644tools/power/cpupower/Makefile +0
-5@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644 # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- -CC ?= $(CROSS)gcc -LD ?= $(CROSS)gcc -AR ?= $(CROSS)ar -STRIP ?= $(CROSS)strip -RANLIB ?= $(CROSS)ranlib
Quoted 8 lines
tools/power/cpupower/Makefile INSTALL_SCRIPT = ${INSTALL} -m 644 · line 94
Quoted 5 lines
tools/power/cpupower/Makefile +5
-0+CC = $(CROSS)gcc +LD = $(CROSS)gcc +AR = $(CROSS)ar +STRIP = $(CROSS)strip +RANLIB = $(CROSS)ranlibThe ? is just allow to override CC/LD/AR.., so in your env, CC is set, but should not be used for cpupower compling?
Adding debug to show the origin of the CC variable shows the following:
CROSS=/local/users/fainelli/buildroot-upstream/output/arm/host/bin/arm-linux- CC origin is (default) and value is (cc)
LD origin is (default) and value is (ld)
CC=cc
LD=ld
AR=ar
STRIP=
RANLIB=
See https://www.gnu.org/software/make/manual/html_node/Origin-Function.html#Origin-Function
Signature · 1 line
Florian
RE: [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding cross-compiling env params
Quoted 120 lines
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allow overriding cross-compiling env paramsQuoted 1 line · Peng Fan
Quoted 1 line
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allowoverriding
Quoted 8 lines
Quoted 8 lines
cross-compiling env params
Hi Peng,
Quoted 3 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Allow overriding the cross-comple env parameters to make it
easier
Quoted 2 lines
Quoted 2 lines
for
Quoted 1 line
Yocto users. Then cross-compiler toolchains to build cpupower
with
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
only two steps:
- source (toolchain path)/environment-setup-armv8a-poky-linux
- makeThis patch breaks the way that buildroot builds cpupower:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
Quoted 3 lines
Quoted 3 lines
git.buildroot.net%2Fbuildroot%2Ftree%2Fpackage%2Flinux- tools%2Flinux-tool-
cpupower.mk.in&data=05%7C02%7Cpeng.fan%40nxp.com%7C246da9
Quoted 1 line
Quoted 1 line
2d8b6243d138c808dd09e6d644%7C686ea1d3bc2b4c6fa92cd99c5c3
Quoted 1 line
Quoted 1 line
01635%7C0%7C0%7C638677609234547728%7CUnknown%7CTWFpb
Quoted 1 line
Quoted 1 line
GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJX
Quoted 1 line
Quoted 1 line
aW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdat
Quoted 1 line
Quoted 1 line
a=nL1YUl%2F07Vd8F0GpW7uRqdpZT74avOku1ox9N3%2FFkUg%3D&r
Quoted 10 lines
Quoted 10 lines
eserved=0
and after enabling verbose it becomes clear as to why, see below:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
linux-tools Configuring
linux-tools BuildingGIT_DIR=.
PATH="/local/users/fainelli/buildroot- upstream/output/arm/host/bin:/local/users/fainelli/buildroot-upstream/output/arm/host/sbin:/projects/firepath/tools/bin:/home/ff
Quoted 1 line
Quoted 1 line
944844/bin:/home/ff944844/.local/bin:/opt/stblinux/bin:/usr/local/sb
Quoted 7 lines
Quoted 7 lines
in:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local /ga mes:/snap/bin:/opt/toolchains/metaware-vctools-0.4.1/bin/"
/usr/bin/make-j97
CROSS=/local/users/fainelli/buildroot- upstream/output/arm/host/bin/arm-linux- CPUFREQ_BENCH=false NLS=false LDFLAGS="-L. -L/local/users/fainelli/buildroot-upstream/output/arm/target/usr/lib"
Quoted 5 lines
Quoted 5 lines
DEBUG=false V=1 -C /local/users/fainelli/buildroot-upstream/output/arm/build/linux- custom/tools
cpupower
mkdir -p power/cpupower &&/usr/bin/makesubdir=power/cpupower
Quoted 3 lines
Quoted 3 lines
--no-print-directory -C power/cpupower cc -DVERSION=\"6.12.0\" - DPACKAGE=\"cpupower\" -DPACKAGE_BUGREPORT=\"[email protected]\" -
D_GNU_SOURCE-pipeQuoted 5 lines
Review
Quoted 3 lines
(quoted diff) +0
-3-Wall -Wchar-subscripts -Wpointer-arith -Wsign- compare -Wno-pointer-sign -Wdeclaration-after-statement -Wshadow - Os -fomit-frame-pointer -fPIC -o lib/cpufreq.o -c lib/cpufreq.cYou are building on an ARM host? Or you are cross compiling with cc
is
Quoted 1 line
actually arm gcc?
This is cross compiling targeting ARM, which is why CROSS is set to ../arm-linux-
Quoted 6 lines
Quoted 4 lines
Here we use cc, aka host compiler, rather than $(CROSS)gcc as we should, so we are no longer cross compiling at all.
I not understand. CROSS was set, but using cc to compile for host?
See below.
Quoted 4 lines
Quoted 4 lines
The issue is the use of the lazy set if absent for *all* of CC, LD, AR, STRIP, RANLIB, rather than just for CROSS. The following fixes it
for me:
Quoted 15 lines
Quoted 15 lines
(quoted diff) +0
-0b/tools/power/cpupower/Makefile index
175004ce44b2..96bb1e5f3970100644tools/power/cpupower/Makefile +0
-5@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644 # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- -CC ?= $(CROSS)gcc -LD ?= $(CROSS)gcc -AR ?= $(CROSS)ar -STRIP ?= $(CROSS)strip -RANLIB ?= $(CROSS)ranlibQuoted 8 lines
tools/power/cpupower/Makefile INSTALL_SCRIPT = ${INSTALL} -m 644 · line 94
Quoted 5 lines
tools/power/cpupower/Makefile +5
-0+CC = $(CROSS)gcc +LD = $(CROSS)gcc +AR = $(CROSS)ar +STRIP = $(CROSS)strip +RANLIB = $(CROSS)ranlibThe ? is just allow to override CC/LD/AR.., so in your env, CC is set, but should not be used for cpupower compling?
Quoted 6 lines
Adding debug to show the origin of the CC variable shows the following:
CROSS=/local/users/fainelli/buildroot- upstream/output/arm/host/bin/arm-linux-
CC origin is (default) and value is (cc) LD origin is (default) and value is (ld) CC=cc LD=ld AR=ar STRIP= RANLIB=
How about
CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- ifneq ($(CROSS), )
CC = $(CROSS)gcc
LD = $(CROSS)gcc
AR = $(CROSS)ar
STRIP = $(CROSS)strip
RANLIB = $(CROSS)ranlib
else
CC ?= $(CROSS)gcc
LD ?= $(CROSS)gcc
AR ?= $(CROSS)ar
STRIP ?= $(CROSS)strip
RANLIB ?= $(CROSS)ranlib
Endif
Thanks,
Peng.
Quoted 13 lines
See
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
www.gnu.org%2Fsoftware%2Fmake%2Fmanual%2Fhtml_node%2FOrig in-Function.html%23Origin- Function&data=05%7C02%7Cpeng.fan%40nxp.com%7C02c643288e1e 456e69e108dd0a4e58d7%7C686ea1d3bc2b4c6fa92cd99c5c301635% 7C0%7C0%7C638678053808856433%7CUnknown%7CTWFpbGZsb3d8 eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiI sIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=L4xd4j ijUJXibguQnxUTzcAUA%2FGSUGUQzmA5FfVaaAQ%3D&reserved=0 --
Florian
Re: [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding cross-compiling env params
Quoted 128 lines · Peng Fan
Quoted 120 lines
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allow overriding cross-compiling env paramsQuoted 1 line · Peng Fan
Quoted 1 line
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allowoverriding
Quoted 8 lines
Quoted 8 lines
cross-compiling env params
Hi Peng,
Quoted 3 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Allow overriding the cross-comple env parameters to make it
easier
Quoted 2 lines
Quoted 2 lines
for
Quoted 1 line
Yocto users. Then cross-compiler toolchains to build cpupower
with
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
only two steps:
- source (toolchain path)/environment-setup-armv8a-poky-linux
- makeThis patch breaks the way that buildroot builds cpupower:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
Quoted 3 lines
Quoted 3 lines
git.buildroot.net%2Fbuildroot%2Ftree%2Fpackage%2Flinux- tools%2Flinux-tool-
cpupower.mk.in&data=05%7C02%7Cpeng.fan%40nxp.com%7C246da9
Quoted 1 line
Quoted 1 line
2d8b6243d138c808dd09e6d644%7C686ea1d3bc2b4c6fa92cd99c5c3
Quoted 1 line
Quoted 1 line
01635%7C0%7C0%7C638677609234547728%7CUnknown%7CTWFpb
Quoted 1 line
Quoted 1 line
GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJX
Quoted 1 line
Quoted 1 line
aW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdat
Quoted 1 line
Quoted 1 line
a=nL1YUl%2F07Vd8F0GpW7uRqdpZT74avOku1ox9N3%2FFkUg%3D&r
Quoted 10 lines
Quoted 10 lines
eserved=0
and after enabling verbose it becomes clear as to why, see below:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
linux-tools Configuring
linux-tools BuildingGIT_DIR=.
PATH="/local/users/fainelli/buildroot- upstream/output/arm/host/bin:/local/users/fainelli/buildroot-upstream/output/arm/host/sbin:/projects/firepath/tools/bin:/home/ff
Quoted 1 line
Quoted 1 line
944844/bin:/home/ff944844/.local/bin:/opt/stblinux/bin:/usr/local/sb
Quoted 7 lines
Quoted 7 lines
in:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local /ga mes:/snap/bin:/opt/toolchains/metaware-vctools-0.4.1/bin/"
/usr/bin/make-j97
CROSS=/local/users/fainelli/buildroot- upstream/output/arm/host/bin/arm-linux- CPUFREQ_BENCH=false NLS=false LDFLAGS="-L. -L/local/users/fainelli/buildroot-upstream/output/arm/target/usr/lib"
Quoted 5 lines
Quoted 5 lines
DEBUG=false V=1 -C /local/users/fainelli/buildroot-upstream/output/arm/build/linux- custom/tools
cpupower
mkdir -p power/cpupower &&/usr/bin/makesubdir=power/cpupower
Quoted 3 lines
Quoted 3 lines
--no-print-directory -C power/cpupower cc -DVERSION=\"6.12.0\" - DPACKAGE=\"cpupower\" -DPACKAGE_BUGREPORT=\"[email protected]\" -
D_GNU_SOURCE-pipeQuoted 5 lines
Review
Quoted 3 lines
(quoted diff) +0
-3-Wall -Wchar-subscripts -Wpointer-arith -Wsign- compare -Wno-pointer-sign -Wdeclaration-after-statement -Wshadow - Os -fomit-frame-pointer -fPIC -o lib/cpufreq.o -c lib/cpufreq.cYou are building on an ARM host? Or you are cross compiling with cc
is
Quoted 1 line
actually arm gcc?
This is cross compiling targeting ARM, which is why CROSS is set to ../arm-linux-
Quoted 6 lines
Quoted 4 lines
Here we use cc, aka host compiler, rather than $(CROSS)gcc as we should, so we are no longer cross compiling at all.
I not understand. CROSS was set, but using cc to compile for host?
See below.
Quoted 4 lines
Quoted 4 lines
The issue is the use of the lazy set if absent for *all* of CC, LD, AR, STRIP, RANLIB, rather than just for CROSS. The following fixes it
for me:
Quoted 15 lines
Quoted 15 lines
(quoted diff) +0
-0b/tools/power/cpupower/Makefile index
175004ce44b2..96bb1e5f3970100644tools/power/cpupower/Makefile +0
-5@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644 # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- -CC ?= $(CROSS)gcc -LD ?= $(CROSS)gcc -AR ?= $(CROSS)ar -STRIP ?= $(CROSS)strip -RANLIB ?= $(CROSS)ranlibQuoted 8 lines
tools/power/cpupower/Makefile INSTALL_SCRIPT = ${INSTALL} -m 644 · line 94
Quoted 5 lines
tools/power/cpupower/Makefile +5
-0+CC = $(CROSS)gcc +LD = $(CROSS)gcc +AR = $(CROSS)ar +STRIP = $(CROSS)strip +RANLIB = $(CROSS)ranlibThe ? is just allow to override CC/LD/AR.., so in your env, CC is set, but should not be used for cpupower compling?
Quoted 6 lines
Adding debug to show the origin of the CC variable shows the following:
CROSS=/local/users/fainelli/buildroot- upstream/output/arm/host/bin/arm-linux-
CC origin is (default) and value is (cc) LD origin is (default) and value is (ld) CC=cc LD=ld AR=ar STRIP= RANLIB=
Quoted 15 lines
How about
CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- ifneq ($(CROSS), )
CC = $(CROSS)gcc
LD = $(CROSS)gcc
AR = $(CROSS)ar
STRIP = $(CROSS)strip
RANLIB = $(CROSS)ranlib
else
CC ?= $(CROSS)gcc
LD ?= $(CROSS)gcc
AR ?= $(CROSS)ar
STRIP ?= $(CROSS)strip
RANLIB ?= $(CROSS)ranlib
Endif
Yes, this works just as well, do you want to submit this if that works in your environment as well?
Signature · 1 line
Florian
RE: [PATCH v2 2/2] pm: cpupower: Makefile: Allow overriding cross-compiling env params
Quoted 164 lines
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allow overriding cross-compiling env paramsQuoted 1 line · Peng Fan
Quoted 1 line
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allowoverriding
Quoted 17 lines
Quoted 17 lines
cross-compiling env params
Quoted 1 line · Peng Fan
Quoted 1 line
Subject: Re: [PATCH v2 2/2] pm: cpupower:
Makefile: Allowoverriding
Quoted 8 lines
Quoted 8 lines
cross-compiling env params
Hi Peng,
Quoted 3 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Allow overriding the cross-comple env parameters to make it
easier
Quoted 2 lines
Quoted 2 lines
for
Quoted 1 line
Yocto users. Then cross-compiler toolchains to build cpupower
with
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
only two steps:
- source (toolchain path)/environment-setup-armv8a-poky-linux
- makeThis patch breaks the way that buildroot builds cpupower:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
git.buildroot.net%2Fbuildroot%2Ftree%2Fpackage%2Flinux- tools%2Flinux-tool-
cpupower.mk.in&data=05%7C02%7Cpeng.fan%40nxp.com%7C246da9
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
2d8b6243d138c808dd09e6d644%7C686ea1d3bc2b4c6fa92cd99c5c3
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
01635%7C0%7C0%7C638677609234547728%7CUnknown%7CTWFpb
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
GZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJX
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
aW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdat
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
a=nL1YUl%2F07Vd8F0GpW7uRqdpZT74avOku1ox9N3%2FFkUg%3D&r
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
eserved=0
and after enabling verbose it becomes clear as to why, see below:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
linux-tools Configuring
linux-tools BuildingGIT_DIR=.
PATH="/local/users/fainelli/buildroot- upstream/output/arm/host/bin:/local/users/fainelli/buildroot-upstream/output/arm/host/sbin:/projects/firepath/tools/bin:/home/ff
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
944844/bin:/home/ff944844/.local/bin:/opt/stblinux/bin:/usr/local/sb
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
in:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/loc al /ga mes:/snap/bin:/opt/toolchains/metaware-vctools-
0.4.1/bin/"
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
/usr/bin/make-j97
CROSS=/local/users/fainelli/buildroot-
upstream/output/arm/host/bin/arm-linux-
CPUFREQ_BENCH=false NLS=false LDFLAGS="-L.
-L/local/users/fainelli/buildroot-Quoted 8 lines
Quoted 8 lines
upstream/output/arm/target/usr/lib"
Quoted 5 lines
Quoted 5 lines
DEBUG=false V=1 -C /local/users/fainelli/buildroot-upstream/output/arm/build/linux- custom/tools
cpupower
mkdir -p power/cpupower &&/usr/bin/makesubdir=power/cpupower
Quoted 1 line
Quoted 1 line
--no-print-directory -C power/cpupower cc -DVERSION=\"6.12.0\"
-
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
DPACKAGE=\"cpupower\" -DPACKAGE_BUGREPORT=\"[email protected]\" -
D_GNU_SOURCE-pipeQuoted 5 lines
Review
Quoted 3 lines
(quoted diff) +0
-3-Wall -Wchar-subscripts -Wpointer-arith -Wsign- compare -Wno-pointer-sign -Wdeclaration-after-statement -Wshadow - Os -fomit-frame-pointer -fPIC -o lib/cpufreq.o -c lib/cpufreq.cYou are building on an ARM host? Or you are cross compiling with
cc
Quoted 45 lines
Quoted 45 lines
is
Quoted 1 line
actually arm gcc?
This is cross compiling targeting ARM, which is why CROSS is set to ../arm-linux-
Quoted 6 lines
Quoted 4 lines
Here we use cc, aka host compiler, rather than $(CROSS)gcc as we should, so we are no longer cross compiling at all.
I not understand. CROSS was set, but using cc to compile for host?
See below.
Quoted 5 lines
Quoted 5 lines
The issue is the use of the lazy set if absent for *all* of CC, LD, AR, STRIP, RANLIB, rather than just for CROSS. The following fixes it
for me:
Quoted 23 lines
Quoted 10 lines
(quoted diff) +0
-0b/tools/power/cpupower/Makefile index
175004ce44b2..96bb1e5f3970100644tools/power/cpupower/Makefile +0
-0@@ -87,11 +87,11 @@ INSTALL_SCRIPT = ${INSTALL} -m 644 # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-tools/power/cpupower/Makefile INSTALL_SCRIPT = ${INSTALL} -m 644 · line 94
Quoted 10 lines
tools/power/cpupower/Makefile +5
-5-CC ?= $(CROSS)gcc -LD ?= $(CROSS)gcc -AR ?= $(CROSS)ar -STRIP ?= $(CROSS)strip -RANLIB ?= $(CROSS)ranlib +CC = $(CROSS)gcc +LD = $(CROSS)gcc +AR = $(CROSS)ar +STRIP = $(CROSS)strip +RANLIB = $(CROSS)ranlibThe ? is just allow to override CC/LD/AR.., so in your env, CC is set, but should not be used for cpupower compling?
Quoted 1 line
Quoted 1 line
Adding debug to show the origin of the CC variable shows the
following:
Quoted 8 lines
Quoted 6 lines
CROSS=/local/users/fainelli/buildroot- upstream/output/arm/host/bin/arm-linux-
CC origin is (default) and value is (cc) LD origin is (default) and value is
(ld) CC=cc LD=ld AR=ar STRIP= RANLIB=Quoted 15 lines
How about
CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- ifneq ($(CROSS), )
CC = $(CROSS)gcc
LD = $(CROSS)gcc
AR = $(CROSS)ar
STRIP = $(CROSS)strip
RANLIB = $(CROSS)ranlib
else
CC ?= $(CROSS)gcc
LD ?= $(CROSS)gcc
AR ?= $(CROSS)ar
STRIP ?= $(CROSS)strip
RANLIB ?= $(CROSS)ranlib
Endif
Quoted 2 lines
Yes, this works just as well, do you want to submit this if that works in your environment as well?
I will prepare a patch.
Thanks,
Peng.
Quoted 2 lines
--
Florian
John B. Wyatt IV
maintainerHi Peng,
A few comments:
Quoted 5 lines
V2:
subject update, commit log update in patch 1, 2 Use strerror in patch 1
without patch 2, need updateMakefilewith 'CROSS = [cross toolchain path]/aarch64-poky-linux-'
Version information is applied per commit patch. Not in the cover letter.
Example:
https://lore.kernel.org/linux-pm/[email protected]/
Reference:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
You will need to submit a V3 version of this.
Quoted 2 lines
without patch 2, need update
Makefilewith 'CROSS = [cross toolchain path]/aarch64-poky-linux-'
I am not sure what this is saying exactly. Please clarify.
Quoted 1 line
Subject: Re: [PATCH v2 0/2] tools: power: cpupower: Allow overriding
Not sure you need 'tools: power: cpupower:' in the cover letter.
Quoted 1 line
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
I do not think you need bench either.
Signature · 4 lines
Sincerely, John Wyatt Software Engineer, Core Kernel Red Hat
Hi John,
Quoted 15 lines
Subject: Re: [PATCH v2 0/2] tools: power: cpupower: Allow overriding cross-compiling envs
Hi Peng,
A few comments:
Quoted 4 lines
V2:
subject update, commit log update in patch 1, 2 Use strerror in
patch 1 without patch 2, need updateMakefilewith 'CROSS = [cross toolchain path]/aarch64-poky-linux-'Version information is applied per commit patch. Not in the cover letter.
Quoted 8 lines
Example:
https://lore.kernel.org/linux-pm/[email protected]/
Reference:You will need to submit a V3 version of this.
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
Sure, I will follow in v3.
Quoted 6 lines
Quoted 1 line
without patch 2, need update
Makefilewith 'CROSS = [crosstoolchain
Quoted 1 line
path]/aarch64-poky-linux-'
I am not sure what this is saying exactly. Please clarify.
Shuah asked to put that in changelog,
https://lore.kernel.org/all/[email protected]/
I could put in patch 1/2 change log in V3.
Quoted 4 lines
Quoted 1 line
Subject: Re: [PATCH v2 0/2] tools: power: cpupower: Allow
overriding
Not sure you need 'tools: power: cpupower:' in the cover letter.
Will use "tools: power:" in v3.
Quoted 5 lines
Quoted 3 lines
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
I do not think you need bench either.
Will drop "bench" in v3.
Thanks,
Peng.
Quoted 6 lines
--
Sincerely,
John Wyatt
Software Engineer, Core Kernel
Red Hat
Quoted 9 lines
Subject: RE: [PATCH v2 0/2] tools: power: cpupower: Allow overriding cross-compiling envs
Hi John,
Quoted 1 line
Subject: Re: [PATCH v2 0/2] tools: power: cpupower: Allow
overriding
Quoted 2 lines
cross-compiling envs
Quoted 13 lines
Quoted 7 lines
Hi Peng,
A few comments:
Quoted 3 lines
V2:
subject update, commit log update in patch 1, 2 Use strerror in
patch 1 without patch 2, need updateMakefilewith 'CROSS =[cross
Quoted 5 lines
Quoted 1 line
toolchain path]/aarch64-poky-linux-'
Version information is applied per commit patch. Not in the cover letter.
Just get this from the page:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
When sending a next version, add a patch changelog to the cover Letter or to individual patches explaining difference against previous submission
So it is fine to put changelog in cover-letter?
Thanks,
Peng.
Quoted 48 lines
Sure, I will follow in v3.
Quoted 6 lines
Quoted 1 line
without patch 2, need update
Makefilewith 'CROSS = [crosstoolchain
Quoted 1 line
path]/aarch64-poky-linux-'
I am not sure what this is saying exactly. Please clarify.
Shuah asked to put that in changelog,
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2F
lore.kernel.org%2Fall%2F0f8df90f-007a-483e-83ce- df8ff0e99791%40linuxfoundation.org%2F&data=05%7C02%7Cpeng.fa n%40nxp.com%7C246bfa4c006340cb2f3108dcd95293ec%7C686ea1d 3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C638624195921233948% 7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2lu MzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Kj9 PVl7PaBNAMZQ0bHL7F2ZIAhcziUEkEE3vdIrYmtU%3D&reserved=0I could put in patch 1/2 change log in V3.
Quoted 4 lines
Quoted 1 line
Subject: Re: [PATCH v2 0/2] tools: power: cpupower: Allow
overriding
Not sure you need 'tools: power: cpupower:' in the cover letter.
Will use "tools: power:" in v3.
Quoted 5 lines
Quoted 3 lines
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
I do not think you need bench either.
Will drop "bench" in v3.
Thanks,
Peng.Quoted 6 lines
--
Sincerely,
John Wyatt
Software Engineer, Core Kernel
Red Hat
John B. Wyatt IV
maintainerQuoted 10 lines · Peng Fan
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
V2:
subject update, commit log update in patch 1, 2 Use strerror in
patch 1 without patch 2, need updateMakefilewith 'CROSS =[cross
Quoted 5 lines
Quoted 1 line
toolchain path]/aarch64-poky-linux-'
Version information is applied per commit patch. Not in the cover letter.
Quoted 7 lines
Just get this from the page:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
When sending a next version, add a patch changelog to the cover Letter or to individual patches explaining difference against previous submissionSo it is fine to put changelog in cover-letter?
Ah, my mistake. It is fine.
Signature · 4 lines
Sincerely, John Wyatt Software Engineer, Core Kernel Red Hat
John B. Wyatt IV
maintainerQuoted 10 lines · Peng Fan
Quoted 10 lines
Quoted 1 line
Not sure you need 'tools: power: cpupower:' in the cover letter.
Will use "tools: power:" in v3.
Quoted 5 lines
Quoted 3 lines
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
I do not think you need bench either.
Will drop "bench" in v3.
I do not think those alone are needed for a v3 since I was corrected on the changelog; at least as far I am concerned.
Signature · 4 lines
Sincerely, John Wyatt Software Engineer, Core Kernel Red Hat
Quoted 11 lines
Subject: Re: [PATCH v2 0/2] tools: power: cpupower: Allow overriding cross-compiling envs
Quoted 7 lines · Peng Fan
Quoted 7 lines
Quoted 1 line
Not sure you need 'tools: power: cpupower:' in the cover letter.
Will use "tools: power:" in v3.
Quoted 4 lines
Quoted 3 lines
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
I do not think you need bench either.
Will drop "bench" in v3.
I do not think those alone are needed for a v3 since I was corrected on the changelog; at least as far I am concerned.
I will do a v3 to convert perror to strerror per the reply in v1 from Shuah.
Thanks,
Peng.
Quoted 6 lines
--
Sincerely,
John Wyatt
Software Engineer, Core Kernel
Red Hat
Shuah Khan
maintainerQuoted 13 lines · Peng Fan
Quoted 13 lines
Subject: Re: [PATCH v2 0/2] tools: power: cpupower: Allow overriding cross-compiling envs
Quoted 9 lines · Peng Fan
Quoted 9 lines
Quoted 1 line
Not sure you need 'tools: power: cpupower:' in the cover letter.
Will use "tools: power:" in v3.
Quoted 5 lines
Quoted 3 lines
pm: cpupower: bench: print config file path when open cpufreq-bench.conf fails
I do not think you need bench either.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Will drop "bench" in v3.
I do not think those alone are needed for a v3 since I was corrected on the changelog; at least as far I am concerned.
I will do a v3 to convert perror to strerror per the reply in v1 from Shuah.
You can send perror to strerror in this file in a separate patch on top of my cpupower branch.
Thank you. Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git/log/?h=cpupower
It will be included in my next pull request to PM maintainer.
thanks,
-- Shuah