public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pm: cpupower: Makefile: Fix cross compilation
@ 2024-11-29  1:20 Peng Fan (OSS)
  2024-12-02 17:12 ` Florian Fainelli
  0 siblings, 1 reply; 8+ messages in thread
From: Peng Fan (OSS) @ 2024-11-29  1:20 UTC (permalink / raw)
  To: Thomas Renninger, Shuah Khan, John B. Wyatt IV, John Kacur,
	Peng Fan, open list:CPU POWER MONITORING SUBSYSTEM, open list
  Cc: Florian Fainelli

From: Peng Fan <peng.fan@nxp.com>

After commit f79473ed9220 ("pm: cpupower: Makefile: Allow overriding
cross-compiling env params") we would fail to cross compile cpupower in
buildroot which uses the recipe at [1] where only the CROSS variable is
being set.

The issue here is the use of the lazy evaluation for all variables: CC,
LD, AR, STRIP, RANLIB, rather than just CROSS.

[1]:
https://git.buildroot.net/buildroot/tree/package/linux-tools/linux-tool-cpupower.mk.in

Fixes: f79473ed9220 ("pm: cpupower: Makefile: Allow overriding cross-compiling env params")
Reported-by: Florian Fainelli <florian.fainelli@broadcom.com>
Closes: https://lore.kernel.org/all/2bbabd2c-24ef-493c-a199-594e5dada3da@broadcom.com/
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 tools/power/cpupower/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 175004ce44b2..51a95239fe06 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -87,11 +87,19 @@ 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-
+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
 HOSTCC = gcc
 MKDIR = mkdir
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] pm: cpupower: Makefile: Fix cross compilation
@ 2024-11-21  4:43 Florian Fainelli
  2024-11-22 15:25 ` Shuah Khan
  0 siblings, 1 reply; 8+ messages in thread
From: Florian Fainelli @ 2024-11-21  4:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Florian Fainelli, Thomas Renninger, Shuah Khan, John B. Wyatt IV,
	John Kacur, Peng Fan, open list:CPU POWER MONITORING SUBSYSTEM

After f79473ed9220 ("pm: cpupower: Makefile: Allow overriding
cross-compiling env params") we would fail to cross compile cpupower in
buildroot which uses the recipe at [1] where only the CROSS variable is
being set.

The issue here is the use of the lazy evaluation for all variables: CC,
LD, AR, STRIP, RANLIB, rather than just CROSS.

[1]:
https://git.buildroot.net/buildroot/tree/package/linux-tools/linux-tool-cpupower.mk.in

Fixes: f79473ed9220 ("pm: cpupower: Makefile: Allow overriding cross-compiling env params")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Change-Id: Id98f2c648c82c08044b7281714bc6a8e921629ad
---
 tools/power/cpupower/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 175004ce44b2..96bb1e5f3970 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -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
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-01-07 20:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29  1:20 [PATCH] pm: cpupower: Makefile: Fix cross compilation Peng Fan (OSS)
2024-12-02 17:12 ` Florian Fainelli
2024-12-10  0:58   ` Shuah Khan
2025-01-07 18:56     ` Florian Fainelli
2025-01-07 20:38       ` Shuah Khan
  -- strict thread matches above, loose matches on Subject: below --
2024-11-21  4:43 Florian Fainelli
2024-11-22 15:25 ` Shuah Khan
2024-11-22 16:11   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox