xref: /linux/tools/power/cpupower/README (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1The cpupower package consists of the following elements:
2
3requirements
4------------
5
6On x86 pciutils is needed at runtime (-lpci).
7For compilation pciutils-devel (pci/pci.h) and a gcc version
8providing cpuid.h is needed.
9For both it's not explicitly checked for (yet).
10
11
12libcpupower
13----------
14
15"libcpupower" is a library which offers a unified access method for userspace
16tools and programs to the cpufreq core and drivers in the Linux kernel. This
17allows for code reduction in userspace tools, a clean implementation of
18the interaction to the cpufreq core, and support for both the sysfs and proc
19interfaces [depending on configuration, see below].
20
21
22compilation and installation
23----------------------------
24
25There are 2 output directories - one for the build output and another for
26the installation of the build results, that is the utility, library,
27man pages, etc...
28
29default directory
30-----------------
31
32In the case of default directory, build and install process requires no
33additional parameters:
34
35build
36-----
37
38$ make
39
40The output directory for the 'make' command is the current directory and
41its subdirs in the kernel tree:
42tools/power/cpupower
43
44install
45-------
46
47$ sudo make install
48
49'make install' command puts targets to default system dirs:
50
51-----------------------------------------------------------------------
52| Installing file        |               System dir                   |
53-----------------------------------------------------------------------
54| libcpupower            | /usr/lib                                   |
55-----------------------------------------------------------------------
56| cpupower               | /usr/bin                                   |
57-----------------------------------------------------------------------
58| cpufreq-bench_plot.sh  | /usr/bin                                   |
59-----------------------------------------------------------------------
60| man pages              | /usr/man                                   |
61-----------------------------------------------------------------------
62
63To put it in other words it makes build results available system-wide,
64enabling any user to simply start using it without any additional steps
65
66custom directory
67----------------
68
69There are 2 make's command-line variables 'O' and 'DESTDIR' that setup
70appropriate dirs:
71'O' - build directory
72'DESTDIR' - installation directory. This variable could also be setup in
73the 'CONFIGURATION' block of the "Makefile"
74
75build
76-----
77
78$ make O=<your_custom_build_catalog>
79
80Example:
81$ make O=/home/hedin/prj/cpupower/build
82
83install
84-------
85
86$ make O=<your_custom_build_catalog> DESTDIR=<your_custom_install_catalog>
87
88Example:
89$ make O=/home/hedin/prj/cpupower/build DESTDIR=/home/hedin/prj/cpupower \
90> install
91
92Notice that both variables 'O' and 'DESTDIR' have been provided. The reason
93is that the build results are saved in the custom output dir defined by 'O'
94variable. So, this dir is the source for the installation step. If only
95'DESTDIR' were provided then the 'install' target would assume that the
96build directory is the current one, build everything there and install
97from the current dir.
98
99The files will be installed to the following dirs:
100
101-----------------------------------------------------------------------
102| Installing file        |               System dir                   |
103-----------------------------------------------------------------------
104| libcpupower            | ${DESTDIR}/usr/lib                         |
105-----------------------------------------------------------------------
106| cpupower               | ${DESTDIR}/usr/bin                         |
107-----------------------------------------------------------------------
108| cpufreq-bench_plot.sh  | ${DESTDIR}/usr/bin                         |
109-----------------------------------------------------------------------
110| man pages              | ${DESTDIR}/usr/man                         |
111-----------------------------------------------------------------------
112
113If you look at the table for the default 'make' output dirs you will
114notice that the only difference with the non-default case is the
115${DESTDIR} prefix. So, the structure of the output dirs remains the same
116regardles of the root output directory.
117
118
119clean and uninstall
120-------------------
121
122'clean' target is intended for cleanup the build catalog from build results
123'uninstall' target is intended for removing installed files from the
124installation directory
125
126default directory
127-----------------
128
129This case is a straightforward one:
130$ make clean
131$ make uninstall
132
133custom directory
134----------------
135
136Use 'O' command line variable to remove previously built files from the
137build dir:
138$ make O=<your_custom_build_catalog> clean
139
140Example:
141$ make O=/home/hedin/prj/cpupower/build clean
142
143Use 'DESTDIR' command line variable to uninstall previously installed files
144from the given dir:
145$ make DESTDIR=<your_custom_install_catalog>
146
147Example:
148make DESTDIR=/home/hedin/prj/cpupower uninstall
149
150
151running the tool
152----------------
153
154default directory
155-----------------
156
157$ sudo cpupower
158
159custom directory
160----------------
161
162When it comes to run the utility from the custom build catalog things
163become a little bit complicated as 'just run' approach doesn't work.
164Assuming that the current dir is '<your_custom_install_catalog>/usr',
165issuing the following command:
166
167$ sudo ./bin/cpupower
168will produce the following error output:
169./bin/cpupower: error while loading shared libraries: libcpupower.so.1:
170cannot open shared object file: No such file or directory
171
172The issue is that binary cannot find the 'libcpupower' library. So, we
173shall point to the lib dir:
174sudo LD_LIBRARY_PATH=lib64/ ./bin/cpupower
175
176
177THANKS
178------
179Many thanks to Mattia Dongili who wrote the autotoolization and
180libtoolization, the manpages and the italian language file for cpupower;
181to Dave Jones for his feedback and his dump_psb tool; to Bruno Ducrot for his
182powernow-k8-decode and intel_gsic tools as well as the french language file;
183and to various others commenting on the previous (pre-)releases of
184cpupower.
185
186
187        Dominik Brodowski
188