Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpupower: add new package #22488

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

cpupower: add new package #22488

wants to merge 1 commit into from

Conversation

graysky2
Copy link
Contributor

Linux kernel userspace tool to examine and to tune power saving related features of the processor

@graysky2
Copy link
Contributor Author

graysky2 commented Oct 23, 2023

@BKPepe - Somehow when I pulled master/rebased for my force push, it pulled into hundreds of commits. I couldn't recover from that.

Is this the wrong way to update by branch against master?

git fetch upstream
git rebase upstream/master

Original PR: #21533

@graysky2
Copy link
Contributor Author

@BKPepe @1715173329 @jefferyto - does anyone have some insights into why this is failing?

% i=cpupower
% make package/$i/{clean,compile} package/index V=s 
...
rm -f /scratch/union/build_dir/target-x86_64_musl/linux-x86_64/cpupower-6.1.79/.built
touch /scratch/union/build_dir/target-x86_64_musl/linux-x86_64/cpupower-6.1.79/.built_check
(cd /scratch/union/build_dir/target-x86_64_musl/linux-x86_64/cpupower-6.1.79; 	make CC="x86_64-openwrt-linux-musl-gcc" CFLAGS="-march=znver3 -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/scratch/union/build_dir/target-x86_64_musl/linux-x86_64/cpupower-6.1.79=cpupower-6.1.79 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LDFLAGS="-L/scratch/union/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/usr/lib -L/scratch/union/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib -fuse-ld=bfd -znow -zrelro" DESTDIR=fake install-tools)
make[3]: Entering directory '/scratch/union/build_dir/target-x86_64_musl/linux-x86_64/cpupower-6.1.79'
grep: ../../../Makefile: No such file or directory
grep: ../../../Makefile: No such file or directory
grep: ../../../Makefile: No such file or directory
grep: ../../../Makefile: No such file or directory
Makefile:98: ../../scripts/Makefile.arch: No such file or directory
make[3]: *** No rule to make target '../../scripts/Makefile.arch'.  Stop.
make[3]: Leaving directory '/scratch/union/build_dir/target-x86_64_musl/linux-x86_64/cpupower-6.1.79'
make[2]: *** [Makefile:58: /scratch/union/build_dir/target-x86_64_musl/linux-x86_64/cpupower-6.1.79/.built] Error 2
make[2]: Leaving directory '/scratch/union/feeds/packages/utils/cpupower'
time: package/feeds/packages/cpupower/compile#0.19#0.12#0.30
    ERROR: package/feeds/packages/cpupower failed to build.
make[1]: *** [package/Makefile:128: package/feeds/packages/cpupower/compile] Error 1
make[1]: Leaving directory '/scratch/union'
make: *** [/scratch/union/include/toplevel.mk:233: package/cpupower/compile] Error 2

It seems to be running up to line 45 in the Makefile but something is then running grep to a non-existent file.

@1715173329
Copy link
Member

It seems to be running up to line 45 in the Makefile but something is then running grep to a non-existent file.

Yes, it's looking for kernel's integrated makefiles.
You need to fix up it to get rid of those stuffs or just create a new Makefile for it.

@graysky2 graysky2 force-pushed the cpupower branch 3 times, most recently from 43b3833 to 6946e82 Compare March 1, 2024 20:24
@graysky2
Copy link
Contributor Author

graysky2 commented Mar 1, 2024

This Makefile builds but when I go to test the compiled executable, I get:

# cpupower frequency-info                  
zsh: command not found: cpupower

@feckert
Copy link
Member

feckert commented Mar 13, 2024

@graysky2 I have now had a closer look at this.
It looks like the cross compiler is not used.
You have to patch the kernel make file in <linux-source>/tools/power/cpupower/Makefile. So it is using the CROSS compiler

--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -85,7 +85,7 @@ 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-
+# CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
 CC = $(CROSS)gcc
 LD = $(CROSS)gcc
 AR = $(CROSS)ar

And you also have to change the openwrt Makefile as follows, so it is handsover the CROSS compiler variable to the linux Makefile.

--- a/utils/cpupower/Makefile
+++ b/utils/cpupower/Makefile
@@ -25,7 +25,7 @@ endef
 
 MAKE_FLAGS = \
             ARCH="$(LINUX_KARCH)" \
-            CROSS_COMPILE="$(TARGET_CROSS)" \
+            CROSS="$(TARGET_CROSS)" \
             CC="$(TARGET_CC)" \
             CFLAGS="$(TARGET_CFLAGS/ -fhonour-copts/) $(TARGET_CPPFLAGS)" \
             LDFLAGS="$(TARGET_LDFLAGS)"

Now it compiles but I get a link error:
/home/feckert/workspace/openwrt/LDM-master-lgm/build/openwrt/staging_dir/toolchain-x86_64_gcc-12.3.0_musl/lib/gcc/x86_64-openwrt-linux-musl/12.3.0/../../../../x86_64-openwrt-linux-musl/bin/ld.bfd: ./utils/helpers/amd.o: relocation R_X86_64_32 against '.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE

But maybe my analysis will help you. You'll have to see the rest. I have to do something different now.

@graysky2
Copy link
Contributor Author

@feckert - thank you very much... I am afraid the linking error is beyond me. @neheb any ideas?

Linux kernel userspace tool to examine and to tune power saving
related features of the processor

Signed-off-by: John Audia <[email protected]>
@neheb
Copy link
Contributor

neheb commented Sep 2, 2024

 msgfmt: No such file or directory

That's gettext/host

You're better off patching Makefile.am and getting rid of po in SUBDIRS.

@graysky2
Copy link
Contributor Author

graysky2 commented Sep 3, 2024

@neheb - Sorry, which Makefile.am? I am finding it hard to get quilt to make a patch that applies.... should I be following link 1 or 2?

  1. https://openwrt.org/docs/guide-developer/toolchain/use-patches-with-buildsystem#adding_or_editing_kernel_patches
  2. https://openwrt.org/docs/guide-developer/toolchain/use-patches-with-buildsystem#adding_a_new_patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants