Laptops :: How to install CPU Freq Driver



Actually, by version, I meant the cpufreq version... i.e. if the one you just compiled is an older revision than the one included with DSL-N.
Althought I'm using the most recent cpufreq patch I could find for DSL/2.4.26, for sure this is older than the version of cpufreq included in the kernel in DSL-N/2.6.12 - but this got me to thinking...

I discovered the interface to cpufreq is different in 2.4.x to that in 2.6.x When I look at /proc/cpufreq in DSL (it doesn't exist in DSL-N) before and after loading a cpufreq module, I see the following:

# cat /proc/cpufreq
         minimum CPU frequency  -  maximum CPU frequency  -  policy
# insmod p4-clockmod
Using /lib/modules/2.4.26/kernel/arch/i386/kernel/p4-clockmod.o
# cat /proc/cpufreq
         minimum CPU frequency  -  maximum CPU frequency  -  policy
CPU  0       199357 kHz ( 12 %)  -    1594858 kHz (100 %)  -  performance

Trawling Google on /proc/cpufreq turned up all kinds of info - I smell the home straight in sight, watch this space...

Well http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufreq.html seems to indicate that they are only backports.  And the last one (which I think you used), was made just over 2 years ago.  So perhaps your cpu setup is newer and/or that revision doesn't support it.  I guess this is one reason why new laptop users like 2.6 kernels...
Finally, I got there - thanks to all who helped - unfortunately, it seems that in 2.4.26 I will have to be content with the p4-clockmod module for cpufreq rather than the speedstep-centrino module. Anyway, here's how to do this for anybody that might be interested.

Materials required:

Download gcc-2.95.dsl, gcc1-with-libs.dsl & gnu-utils.dsl from the DSL repository
Download linux-2.4.26.tar.gz from "www.kernel.org" or mirror sites
Obtain knoppix 3.4 kernel patch and .config
Download cpufreq-LINUX_2_4-20040813.tar.gz from http://ftp.linux.org.uk/pub/linux/cpufreq/
Make a copy of the instructions for fixing the broken 2.4.26 drmP.h file at http://lkml.org/lkml/2004/4/19/202

load required dsl packages:

# mydsl-load /path-to-file/gcc-2.95.dsl
# mydsl-load /path-to-file/gcc1-with-libs.dsl
# mydsl-load /path-to-file/gnu-utils.dsl

Create a directory for the kernel sources owned by user dsl:

# mkdir /ramdisk/kernelsource
# chown dsl /ramdisk/kernelsource

Copy the kernel sources to the new directory and un-pack them:

# cp /path-to-file/linux-2.4.26.tar.gz /ramdisk/kernelsource
# cd /ramdisk/kernelsource
# tar -xzvf linux-2.4.26.tar.gz -C /ramdisk/kernelsource
# rm linux-2.4.26.tar.gz

Apply the knoppix patch to the kernel sources:

# cd /ramdisk/kernelsource
# patch -p1 -d linux-2.4.26 < knoppix-kernel.patch

Copy the cpufreq patch to the new directory, unpack it and patch:

# cp /path-to-file/cpufreq-LINUX_2_4-20040813.tar.gz /ramdisk/kernelsource
# tar -xzvf cpufreq-LINUX_2_4-20040813.tar.gz -C /ramdisk/kernelsource
# rm cpufreq-LINUX_2_4-20040813.tar.gz
# cd /ramdisk/kernelsource/cpufreq
# ./patchin.sh /usr/src/linux-2.4.26

Modify the drmP.h file as per instructions and overwrite broken file in kernel sources:

# cp -f /path-to-file/drmP.h /ramdisk/kernelsource/linux-2.4.26/drivers/char/drm

Prepare sources for re-compilation:

# cd /ramdisk/kernelsource/linux-2.4.26
# make mrproper

Overwrite the default configuration with the knoppix kernel configuration and select the required cpufreq options for your cpu:

# cp -f /path-to-file/.config /ramdisk/kernelsource/linux-2.4.26/arch/i386/defconfig
# make oldconfig

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_PROC_INTF=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_24_API=y
# CONFIG_X86_POWERNOW_K6 is not set
# CONFIG_X86_POWERNOW_K7 is not set
# CONFIG_X86_POWERNOW_K8 is not set
# CONFIG_X86_LONGHAUL is not set
# CONFIG_X86_SPEEDSTEP_PIIX4 is not set
# CONFIG_X86_SPEEDSTEP_SMI is not set
# CONFIG_X86_SPEEDSTEP_ICH is not set
# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
CONFIG_X86_P4_CLOCKMOD=m
# CONFIG_X86_LONGRUN is not set
# CONFIG_X86_GX_SUSPMOD is not set

Build dependencies and cleanup:

# make dep
# make clean

Build kernel boot image, copy to the root directory of your USB stick & make rw:

# make bzImage
# make install
# cp /boot/vmlinuz-2.4.26 /path-to-boot-usb-root-dir/vmlinuz
# rdev -R /path-to-boot-usb-root-dir/vmlinuz 0

Build new cpufreq module and save it:

# make modules
# make modules_install
# cp /lib/modules/2.4.26/kernel/arch/i386/kernel/p4-clockmod.o /path-to-safe-place

Reboot chosing vmlinuz at boot prompt, install new module and get setup:

# cp /path-to-safe-place/p4-clockmod.o /lib/modules/2.4.26/kernel/arch/i386/kernel
# insmod p4-clockmod
# apt-get install acpid [Debian stable]
# apt-get install cpufreqd

Modify /etc/cpufreqd.conf to your taste then check things work:

# cat /proc/cpufreq
         minimum CPU frequency  -  maximum CPU frequency  -  policy
CPU  0       199354 kHz ( 12 %)  -    1594837 kHz (100 %)  -  performance

# cpufreqd -V5 -D
parse_config(): Rule "conservative" has Profile "lo_boost"
parse_config(): Rule "lo_cpu_boost" has Profile "medium_boost"
parse_config(): Rule "hi_cpu_boost" has Profile "medium_boost"
parse_config(): Rule "AC_on" has Profile "hi_boost"
Starting operations.
libsys_init(): ACPICA version 20040326
set_policy(): 66%100%performance - profile name: hi_boost.
main_loop(): profile set "hi_boost" for rule "AC_on".

[remove power cord]

set_policy(): 0%33%performance - profile name: lo_boost.
main_loop(): profile set "lo_boost" for rule "conservative".

<ctrl-c>

Caught INT signal (Interrupt).

# cat /proc/cpufreq
         minimum CPU frequency  -  maximum CPU frequency  -  policy
CPU  0       199354 kHz ( 12 %)  -     526296 kHz ( 32 %)  -  performance

And that's it. I can't help thinking (in hindsight) that it would have been better to have written a simple acpi script to set the speedstep setting manually - i.e. "echo x > /proc/acpi/processor/CPU0/performance" but that would have been too easy.

Great guide!

Way to go to summarize all these pages :)

Just some other idea if you want to check em out...
speedstep-detect from http://www.poupinou.org/cpufreq/ .. maybe you have to pass something to the module.

Also just a general comment...
Quote
Copy the kernel sources to the new directory and un-pack them:

# cp /path-to-file/linux-2.4.26.tar.gz /ramdisk/kernelsource
# cd /ramdisk/kernelsource
# tar -xzvf linux-2.4.26.tar.gz -C /ramdisk/kernelsource
# rm linux-2.4.26.tar.gz
You can just "cd /ramdisk/kernelsource && tar zxvf /path-to-file/linux-2.4.26.tar.gz" or use that -C option, no need to copy it (may save some people some space/time since the kernel sources can take up a bit)

Next Page...
original here.