1db262ea4SRamkumar RamachandraThe cpupower package consists of the following elements: 27fe2f639SDominik Brodowski 37fe2f639SDominik Brodowskirequirements 47fe2f639SDominik Brodowski------------ 57fe2f639SDominik Brodowski 67fe2f639SDominik BrodowskiOn x86 pciutils is needed at runtime (-lpci). 77fe2f639SDominik BrodowskiFor compilation pciutils-devel (pci/pci.h) and a gcc version 87fe2f639SDominik Brodowskiproviding cpuid.h is needed. 97fe2f639SDominik BrodowskiFor both it's not explicitly checked for (yet). 107fe2f639SDominik Brodowski 117fe2f639SDominik Brodowski 12a504c028SRamkumar Ramachandralibcpupower 137fe2f639SDominik Brodowski---------- 147fe2f639SDominik Brodowski 15a504c028SRamkumar Ramachandra"libcpupower" is a library which offers a unified access method for userspace 167fe2f639SDominik Brodowskitools and programs to the cpufreq core and drivers in the Linux kernel. This 177fe2f639SDominik Brodowskiallows for code reduction in userspace tools, a clean implementation of 187fe2f639SDominik Brodowskithe interaction to the cpufreq core, and support for both the sysfs and proc 197fe2f639SDominik Brodowskiinterfaces [depending on configuration, see below]. 207fe2f639SDominik Brodowski 217fe2f639SDominik Brodowski 227fe2f639SDominik Brodowskicompilation and installation 237fe2f639SDominik Brodowski---------------------------- 247fe2f639SDominik Brodowski 253dbc9214SRoman StorozhenkoThere are 2 output directories - one for the build output and another for 263dbc9214SRoman Storozhenkothe installation of the build results, that is the utility, library, 273dbc9214SRoman Storozhenkoman pages, etc... 287fe2f639SDominik Brodowski 293dbc9214SRoman Storozhenkodefault directory 303dbc9214SRoman Storozhenko----------------- 313dbc9214SRoman Storozhenko 323dbc9214SRoman StorozhenkoIn the case of default directory, build and install process requires no 333dbc9214SRoman Storozhenkoadditional parameters: 343dbc9214SRoman Storozhenko 353dbc9214SRoman Storozhenkobuild 363dbc9214SRoman Storozhenko----- 373dbc9214SRoman Storozhenko 383dbc9214SRoman Storozhenko$ make 393dbc9214SRoman Storozhenko 403dbc9214SRoman StorozhenkoThe output directory for the 'make' command is the current directory and 413dbc9214SRoman Storozhenkoits subdirs in the kernel tree: 423dbc9214SRoman Storozhenkotools/power/cpupower 433dbc9214SRoman Storozhenko 443dbc9214SRoman Storozhenkoinstall 453dbc9214SRoman Storozhenko------- 463dbc9214SRoman Storozhenko 473dbc9214SRoman Storozhenko$ sudo make install 483dbc9214SRoman Storozhenko 493dbc9214SRoman Storozhenko'make install' command puts targets to default system dirs: 503dbc9214SRoman Storozhenko 513dbc9214SRoman Storozhenko----------------------------------------------------------------------- 523dbc9214SRoman Storozhenko| Installing file | System dir | 533dbc9214SRoman Storozhenko----------------------------------------------------------------------- 543dbc9214SRoman Storozhenko| libcpupower | /usr/lib | 553dbc9214SRoman Storozhenko----------------------------------------------------------------------- 563dbc9214SRoman Storozhenko| cpupower | /usr/bin | 573dbc9214SRoman Storozhenko----------------------------------------------------------------------- 583dbc9214SRoman Storozhenko| cpufreq-bench_plot.sh | /usr/bin | 593dbc9214SRoman Storozhenko----------------------------------------------------------------------- 603dbc9214SRoman Storozhenko| man pages | /usr/man | 613dbc9214SRoman Storozhenko----------------------------------------------------------------------- 624edef850SFrancesco Poli (wintermute)| systemd service | /usr/lib/systemd/system | 639c70b779SFrancesco Poli (wintermute)----------------------------------------------------------------------- 649c70b779SFrancesco Poli (wintermute)| systemd support script | /usr/libexec | 659c70b779SFrancesco Poli (wintermute)----------------------------------------------------------------------- 663dbc9214SRoman Storozhenko 673dbc9214SRoman StorozhenkoTo put it in other words it makes build results available system-wide, 683dbc9214SRoman Storozhenkoenabling any user to simply start using it without any additional steps 693dbc9214SRoman Storozhenko 703dbc9214SRoman Storozhenkocustom directory 713dbc9214SRoman Storozhenko---------------- 723dbc9214SRoman Storozhenko 733dbc9214SRoman StorozhenkoThere are 2 make's command-line variables 'O' and 'DESTDIR' that setup 743dbc9214SRoman Storozhenkoappropriate dirs: 753dbc9214SRoman Storozhenko'O' - build directory 763dbc9214SRoman Storozhenko'DESTDIR' - installation directory. This variable could also be setup in 773dbc9214SRoman Storozhenkothe 'CONFIGURATION' block of the "Makefile" 783dbc9214SRoman Storozhenko 793dbc9214SRoman Storozhenkobuild 803dbc9214SRoman Storozhenko----- 813dbc9214SRoman Storozhenko 823dbc9214SRoman Storozhenko$ make O=<your_custom_build_catalog> 833dbc9214SRoman Storozhenko 843dbc9214SRoman StorozhenkoExample: 853dbc9214SRoman Storozhenko$ make O=/home/hedin/prj/cpupower/build 863dbc9214SRoman Storozhenko 873dbc9214SRoman Storozhenkoinstall 883dbc9214SRoman Storozhenko------- 893dbc9214SRoman Storozhenko 903dbc9214SRoman Storozhenko$ make O=<your_custom_build_catalog> DESTDIR=<your_custom_install_catalog> 913dbc9214SRoman Storozhenko 923dbc9214SRoman StorozhenkoExample: 933dbc9214SRoman Storozhenko$ make O=/home/hedin/prj/cpupower/build DESTDIR=/home/hedin/prj/cpupower \ 943dbc9214SRoman Storozhenko> install 953dbc9214SRoman Storozhenko 963dbc9214SRoman StorozhenkoNotice that both variables 'O' and 'DESTDIR' have been provided. The reason 973dbc9214SRoman Storozhenkois that the build results are saved in the custom output dir defined by 'O' 983dbc9214SRoman Storozhenkovariable. So, this dir is the source for the installation step. If only 993dbc9214SRoman Storozhenko'DESTDIR' were provided then the 'install' target would assume that the 1003dbc9214SRoman Storozhenkobuild directory is the current one, build everything there and install 1013dbc9214SRoman Storozhenkofrom the current dir. 1023dbc9214SRoman Storozhenko 1033dbc9214SRoman StorozhenkoThe files will be installed to the following dirs: 1043dbc9214SRoman Storozhenko 1053dbc9214SRoman Storozhenko----------------------------------------------------------------------- 1063dbc9214SRoman Storozhenko| Installing file | System dir | 1073dbc9214SRoman Storozhenko----------------------------------------------------------------------- 1083dbc9214SRoman Storozhenko| libcpupower | ${DESTDIR}/usr/lib | 1093dbc9214SRoman Storozhenko----------------------------------------------------------------------- 1103dbc9214SRoman Storozhenko| cpupower | ${DESTDIR}/usr/bin | 1113dbc9214SRoman Storozhenko----------------------------------------------------------------------- 1123dbc9214SRoman Storozhenko| cpufreq-bench_plot.sh | ${DESTDIR}/usr/bin | 1133dbc9214SRoman Storozhenko----------------------------------------------------------------------- 1143dbc9214SRoman Storozhenko| man pages | ${DESTDIR}/usr/man | 1153dbc9214SRoman Storozhenko----------------------------------------------------------------------- 1164edef850SFrancesco Poli (wintermute)| systemd service | ${DESTDIR}/usr/lib/systemd/system | 1179c70b779SFrancesco Poli (wintermute)----------------------------------------------------------------------- 1189c70b779SFrancesco Poli (wintermute)| systemd support script | ${DESTDIR}/usr/libexec | 1199c70b779SFrancesco Poli (wintermute)----------------------------------------------------------------------- 1203dbc9214SRoman Storozhenko 1213dbc9214SRoman StorozhenkoIf you look at the table for the default 'make' output dirs you will 1223dbc9214SRoman Storozhenkonotice that the only difference with the non-default case is the 1233dbc9214SRoman Storozhenko${DESTDIR} prefix. So, the structure of the output dirs remains the same 1243dbc9214SRoman Storozhenkoregardles of the root output directory. 1253dbc9214SRoman Storozhenko 1263dbc9214SRoman Storozhenko 1273dbc9214SRoman Storozhenkoclean and uninstall 1283dbc9214SRoman Storozhenko------------------- 1293dbc9214SRoman Storozhenko 1303dbc9214SRoman Storozhenko'clean' target is intended for cleanup the build catalog from build results 1313dbc9214SRoman Storozhenko'uninstall' target is intended for removing installed files from the 1323dbc9214SRoman Storozhenkoinstallation directory 1333dbc9214SRoman Storozhenko 1343dbc9214SRoman Storozhenkodefault directory 1353dbc9214SRoman Storozhenko----------------- 1363dbc9214SRoman Storozhenko 1373dbc9214SRoman StorozhenkoThis case is a straightforward one: 1383dbc9214SRoman Storozhenko$ make clean 1393dbc9214SRoman Storozhenko$ make uninstall 1403dbc9214SRoman Storozhenko 1413dbc9214SRoman Storozhenkocustom directory 1423dbc9214SRoman Storozhenko---------------- 1433dbc9214SRoman Storozhenko 1443dbc9214SRoman StorozhenkoUse 'O' command line variable to remove previously built files from the 1453dbc9214SRoman Storozhenkobuild dir: 1463dbc9214SRoman Storozhenko$ make O=<your_custom_build_catalog> clean 1473dbc9214SRoman Storozhenko 1483dbc9214SRoman StorozhenkoExample: 1493dbc9214SRoman Storozhenko$ make O=/home/hedin/prj/cpupower/build clean 1503dbc9214SRoman Storozhenko 1513dbc9214SRoman StorozhenkoUse 'DESTDIR' command line variable to uninstall previously installed files 1523dbc9214SRoman Storozhenkofrom the given dir: 1533dbc9214SRoman Storozhenko$ make DESTDIR=<your_custom_install_catalog> 1543dbc9214SRoman Storozhenko 1553dbc9214SRoman StorozhenkoExample: 1563dbc9214SRoman Storozhenkomake DESTDIR=/home/hedin/prj/cpupower uninstall 1573dbc9214SRoman Storozhenko 1583dbc9214SRoman Storozhenko 1593dbc9214SRoman Storozhenkorunning the tool 1603dbc9214SRoman Storozhenko---------------- 1613dbc9214SRoman Storozhenko 1623dbc9214SRoman Storozhenkodefault directory 1633dbc9214SRoman Storozhenko----------------- 1643dbc9214SRoman Storozhenko 1653dbc9214SRoman Storozhenko$ sudo cpupower 1663dbc9214SRoman Storozhenko 1673dbc9214SRoman Storozhenkocustom directory 1683dbc9214SRoman Storozhenko---------------- 1693dbc9214SRoman Storozhenko 1703dbc9214SRoman StorozhenkoWhen it comes to run the utility from the custom build catalog things 1713dbc9214SRoman Storozhenkobecome a little bit complicated as 'just run' approach doesn't work. 1723dbc9214SRoman StorozhenkoAssuming that the current dir is '<your_custom_install_catalog>/usr', 1733dbc9214SRoman Storozhenkoissuing the following command: 1743dbc9214SRoman Storozhenko 1753dbc9214SRoman Storozhenko$ sudo ./bin/cpupower 1763dbc9214SRoman Storozhenkowill produce the following error output: 1773dbc9214SRoman Storozhenko./bin/cpupower: error while loading shared libraries: libcpupower.so.1: 1783dbc9214SRoman Storozhenkocannot open shared object file: No such file or directory 1793dbc9214SRoman Storozhenko 1803dbc9214SRoman StorozhenkoThe issue is that binary cannot find the 'libcpupower' library. So, we 1813dbc9214SRoman Storozhenkoshall point to the lib dir: 1823dbc9214SRoman Storozhenkosudo LD_LIBRARY_PATH=lib64/ ./bin/cpupower 1837fe2f639SDominik Brodowski 1849c70b779SFrancesco Poli (wintermute)systemd service 1859c70b779SFrancesco Poli (wintermute)--------------- 1869c70b779SFrancesco Poli (wintermute) 1879c70b779SFrancesco Poli (wintermute)A systemd service is also provided to run the cpupower utility at boot with 1884edef850SFrancesco Poli (wintermute)settings read from a configuration file. 1894edef850SFrancesco Poli (wintermute) 1904edef850SFrancesco Poli (wintermute)If you want systemd to find the new service after the installation, the service 1914edef850SFrancesco Poli (wintermute)unit must have been installed in one of the system unit search path directories 1924edef850SFrancesco Poli (wintermute)(such as '/usr/lib/systemd/system/', which is the default location) and (unless 1934edef850SFrancesco Poli (wintermute)you are willing to wait for the next reboot) you need to issue the following 1949c70b779SFrancesco Poli (wintermute)command: 1959c70b779SFrancesco Poli (wintermute) 1964edef850SFrancesco Poli (wintermute)$ sudo systemctl daemon-reload 1974edef850SFrancesco Poli (wintermute) 198*e5174365SFrancesco Poli (wintermute)If you want to enable this systemd service, edit '/etc/cpupower-service.conf' 199*e5174365SFrancesco Poli (wintermute)(uncommenting at least one of the options, depending on your preferences) 200*e5174365SFrancesco Poli (wintermute)and then issue the following command: 2014edef850SFrancesco Poli (wintermute) 2029c70b779SFrancesco Poli (wintermute)$ sudo systemctl enable --now cpupower.service 2039c70b779SFrancesco Poli (wintermute) 2047fe2f639SDominik Brodowski 2057fe2f639SDominik BrodowskiTHANKS 2067fe2f639SDominik Brodowski------ 2077fe2f639SDominik BrodowskiMany thanks to Mattia Dongili who wrote the autotoolization and 208a504c028SRamkumar Ramachandralibtoolization, the manpages and the italian language file for cpupower; 2097fe2f639SDominik Brodowskito Dave Jones for his feedback and his dump_psb tool; to Bruno Ducrot for his 2107fe2f639SDominik Brodowskipowernow-k8-decode and intel_gsic tools as well as the french language file; 2117fe2f639SDominik Brodowskiand to various others commenting on the previous (pre-)releases of 212a504c028SRamkumar Ramachandracpupower. 2137fe2f639SDominik Brodowski 2147fe2f639SDominik Brodowski 2157fe2f639SDominik Brodowski Dominik Brodowski 216