Its not that hard and you don't need to recompile a whole kernel if you don't want to (but you can if you want )
- You need the sources of your kernel
- You need compiling tools (build-essential)
- You need a linux-phc patch
- You need little time
- You may need a cup of coffee (because I love coffee)
For Debian/Ubuntu for example you just need to install linux-source and build-essential.
This downloads the source-package to /usr/src (for example /usr/src/linux-source-2.6.24-19.tar.gz)
You can also download a vanilla kernel from kernel.org. But then most times you need to compile the whole kernel.
Just copy the package to /usr/src.
At least now you need to be root:
~/ sudo -s
Switch to the /usr/src:
#/ cd /usr/src
Then unpack the kernel source:
#/ tar -xjf <filename>.tar.gz
Now it unpacked the sources to a new subdirectory. Most times it is like the filename of the package.
#/ cd <dirname>
Now you need to get the config file for your kernel.
For some people it may bet tricky here if their distribution does not provide the config file.
For those they need to create one by typing make menuconfig . If you don't want to compile the whole kernel you
do not need to change any of the things in the configuration program but one: make sure that in
Code: Select all
[*] Power Management Options--> [*] CPU Frequency Scaling --> <M> ACPI Processor P-States driver
Quit and save.
Many distributions ship the config file. Debian/Ubuntu for example store them to /boot.
For example you can find a file named config-2.6.24-19-generic in /boot. Just copy it and name it .config
Example: #/ cp /boot/config-2.6.24-19-generic /usr/src/<dirname>/.config
The dot ( . ) as the first character is important.
Now we need to prepare the kernel. We still are in our kernel source directory. Three things to do:
#/ make oldconfig
#/ make prepare
#/ make scripts
Next step is patching the source with linux-phc. You have the matching patch saved somewhere? Now copy it into the kernel source directory.
#/ cp /path/to/the/patchfile/<filename>.patch ./
Now patch it:
#/ patch -p1 < <filename>.patch
Everything went okay? Fine! Lets make the module:
For Kernel < 2.6.24 (for 64bit Kernels the path is different!):
#/ make M=arch/i386/kernel/cpu/cpufreq
For Kernel 2.6.24 or newer ( 32 and 64bit the same):
#/ make M=arch/x86/kernel/cpu/cpufreq
If everything went fine you can test the module now before 'installing' it forever.
First, unload the existing acpi-cpufreq module:
#/ modprobe -r acpi_cpufreq
Then insert the patched module:
#/ insmod <path like above>/acpi-cpufreq.ko
Check output of #/ dmesg.
Nothing to read about acpi-cpufreq? Then it's okay... no news are good news
You should have some files in /sys/devices/system/cpu/cpu0/cpufreq/ beginning with "phc_".
Lets take a look at the content of one of those files to see if it is working:
#/ cat /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
If you can read some values now: Congratulations! Everything is perfect now. Let's replace the old module with the patched one.
We still are in our kernel source directory.
#/ cp arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko /lib/modules/<name of the target kernel>/kernel/arch/x86/kernel/cpu/cpufreq/
If you made the module for your running kernel you can do
#/ cp arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.ko /lib/modules/$(uname -r)/kernel/arch/x86/kernel/cpu/cpufreq/
That's it. Now every time you restart your linux the patched module should be loaded.
Unfortunately you need to do the whole procedure for every kernel update your distribution brings you. But it wasn't that hard, was it?
I hope not
Errors and their solutions from answears I will extract and post here:
1: You read the following Warning while compiling:
"WARNING: Symbol version dump /usr/src/linux-source-2.6.27/Module.symvers
is missing; modules will have no dependencies and modversions."
Maybe this will help you:
Code: Select all
cd /usr/src/linux-source-`uname -r`/ cp ../linux-headers-`uname -r`/Module.symvers . make clean M=./arch/x86/kernel/cpu/cpufreq make M=./arch/x86/kernel/cpu/cpufreq