How to install CPU Freq Driver


Forum: Laptops
Topic: How to install CPU Freq Driver
started by: Juanito

Posted by Juanito on July 29 2006,19:25
In the continuing quest for better laptop power management with DSL I've been trying to get cpufreqd working. After apt-get install (using stable debs) I found that, in order to work, cpufreqd requires a CPU Freq driver which does not come with the 2.4 kernel.

A patch exists at < ftp://ftp.linux.org.uk/pub/linux/cpufreq/ > (eg cpufreq-LINUX_2_4-20040813.tar.gz) but there are no instructions as to how to compile/install it on the site or in the .tar file

I found Clacker's very useful instructions for compiling drivers and modules for DSL but, apart from unpacking the .tar file, none of his suggested commands (./ compile, make, sudo make install) had any effect.

Does anyone know if this patch can be applied to DSL?

Posted by newby on July 29 2006,21:27
Quote (Juanito @ July 29 2006,15:25)
... cpufreqd requires a CPU Freq driver which does not come with the 2.4 kernel.
...
Does anyone know if this patch can be applied to DSL?

Possibly, but my understanding is that a patch is source code to be compiled along with the kernel source code to produce a new kernel.  You can't compile a patch separately.

As I understand it, at least.

Posted by Juanito on July 30 2006,04:12
Well it could be that compiling a patch (or a module) won't work, but I understand that if you load gcc1.dsl, kernelsource.dsl and (possibly) gnu-utils.dsl then you should be in good shape.

The issue is that the standard "make" commands don't work (and don't produce any useful error messages) and the .tar file does not have any compile or patch instruction files packed inside.

Maybe since the .tar file is on ftp.linux.org.uk, it is assumed you should use some kind of standard instructions...

Posted by roberts on July 30 2006,17:09
Many times the compiler specified in Makefile is cc.
Does establishing a link between gcc and cc help?

Posted by Juanito on July 30 2006,18:14
In fact most of the problem was me not knowing what I'm doing. After some research, here's what I did:

dsl@box:~$ sudo mkdir /usr/src
dsl@box:~$ sudo chown dsl /usr/src
dsl@box:~$ chgrp /staff /usr/src
chgrp: unknown group name: /staff
dsl@box:~$ cd /usr/src
[download linux kernel source from www.kernel.org]
dsl@box:/usr/src$ sudo gunzip linux-2.4.26.tar.gz
dsl@box:/usr/src$ sudo tar -xf linux-2.4.26.tar
[myDSL kernelsource.dsl]
[myDSL gcc1.dsl]
dsl@box:/usr/src$ sudo patch -p1 -d linux-2.4.26 < knoppix-kernel.patch
patching file arch/i386/kernel/setup.c
Hunk #1 succeeded at 216 with fuzz 2 (offset 21 lines).
patching file drivers/ide/ide.c
Hunk #1 succeeded at 2466 (offset 234 lines).
patching file arch/i386/kernel/smpboot.c
Hunk #1 succeeded at 1147 (offset -17 lines).
patching file Makefile
patching file init/main.
[download cpufreq patch from www.linux.org.uk]
dsl@box:/usr/src$ sudo gunzip cpufreq-LINUX_2_4-20040813.tar.gz
dsl@box:/usr/src$ sudo tar -xf cpufreq-LINUX_2_4-20040813.tar
dsl@box:/usr/src/cpufreq$ sudo ./patchin.sh /usr/src/linux-2.4.26
patching file Documentation/00-INDEX
patching file Documentation/Configure.help
patching file Makefile
patching file arch/i386/boot/setup.S
patching file arch/i386/config.in
patching file arch/i386/kernel/Makefile
patching file arch/i386/kernel/i386_ksyms.c
patching file arch/i386/kernel/setup.c
patching file arch/i386/kernel/time.c
patching file drivers/Makefile
patching file include/asm-i386/ist.h
patching file include/asm-i386/msr.h
patching file include/asm-i386/smp.h
patching file include/linux/smp.h
dsl@box:/usr/src/cpufreq$

The issue is, what to do next in the DSL environment for a USB installation?

Basically all I want to do is add the appropriate cpufreq driver (speedstep-centrino.c in my case, I believe) so I can "modprobe" it without having to go through the whole "make mrproper" and "make config" gazillion questions (some of which are relevent to cpufreq) scenario.

I sense the answer is related to "make oldconfig" but any suggestions welcome.

Also "make dep" didn't want to work with gcc-1.dsl installed - is there a way to update this?

Posted by ^thehatsrule^ on Aug. 02 2006,03:37
1. You should use the kernel source in myDSL.
2. It sounds as if you'll have to replace the whole kernel too, not just load the module.

Posted by Juanito on Aug. 02 2006,04:57
My apologies for pasting in long sections from dsl box, but I did use the kernel source from the repository (line 9 in previous post, [myDSL kernelsource.dsl]
).

After the cpufreq patch worked, I tried several means of carrying on from there (not really knowing what I was doing, I admit):

[load myDSL gcc-1.dsl]

dsl@box:/usr/src$ cd /usr/src/linux
dsl@box:/usr/src/linux$ sudo make mrproper

[blah, blah, blah - appears to work]

dsl@box:/usr/src/linux$ sudo make oldconfig
rm -f include/asm
( cd include ; ln -sf asm-i386 asm)
/bin/sh scripts/Configure -d arch/i386/config.in
#
# Using defaults found in arch/i386/defconfig
#

[various questions relevent to the cpufreq patch, appears to work]

dsl@box:/usr/src/linux$ sudo make dep
gcc-2.95 -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o scripts/mkdep scripts/mkdep.c
make: gcc-2.95: Command not found
make: *** [scripts/mkdep] Error 127
dsl@box:/usr/src/linux$ sudo make modules
gcc-2.95 -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o scripts/split-include scripts/split-include.c
make: gcc-2.95: Command not found
make: *** [scripts/split-include] Error 127
dsl@box:/usr/src/linux$ gcc -v
Reading specs from /ramdisk/usr/bin/../lib/gcc-lib/i486-linux/3.3.4/specs
...gcc version 3.3.4 (Debian 1:3.3.4-7)
dsl@box:/usr/src/linux$

I agree it seems that I might have to recompile rather than just make the new modules, but if "make dep" and "make modules" don't work I'm kind of stuck.

Any idea why gcc doesn't want to "make dep"/"make modules"?

Posted by ^thehatsrule^ on Aug. 02 2006,19:06
It's trying to use gcc v 2.95, the version used to compile DSL's kernel.  From experience, new kmodules to be loaded should use the same version of the compiler as the kernel.

`apt-get install gcc-2.95` should do the trick.

Note that you could always try and bypass this, though it isn't recommended.

Posted by Juanito on Aug. 03 2006,05:44
You're right, doing an apt-get install gcc-2.95 solved the problem - though I still had to load gcc1.dsl afterwards to get the "make" command. Following this I did:

make mrproper
make oldconfig
make dep
make modules
make modules_install

All of which appeared to go OK - a couple of questions:

1. How do I incease the buffer size in an Xterm so that I can scroll back and see all of the screen output following a command?
2. Is it enough to backup/restore the modules/files created in "make module_install" to /lib/modules/2-4.26/.. to be able to "modprobe" the new module after boot, or is there more to it than this?
3. If the answer to 2. above is no, then what next - do I have to do a "make bzImage" equivalent for DSL?

Thanks for the help so far.

Posted by Juanito on Aug. 29 2006,12:21
Any help would be gratefully received.

There must be more people out there who would like to get laptop power management working in this fashion with DSL. If (with help) I crack it, I will post the explanation here.

Posted by ^thehatsrule^ on Aug. 30 2006,03:14
Sorry, I must've missed your last post.

1. Xterm?  I really only use aterm, but I think the switch is the same... you can use like -sl 1000 for a 1000 line buffer.
2/3. This depends on what the software requires/modifies.  If the kernel itself needs to be changed, then you do need to do replace that.  If some extra modules need to be used or replaced, then you need to do that too - but you probably don't need to replace every one.
3. make bzImage is for the kernel packaging

Posted by Juanito on Aug. 30 2006,05:47
Thanks for the xterm buffer switch, I'll try that.

Ref 2/3 - In overview, in order for the cpufreqd daemon to work and automatically manage Intel Speedstep settings to conserve battery life, it needs ACPI to be running, the various ACPI modules to be installed (fan, processor, etc) and a driver specific to the type of processor in your laptop.

In order to get the cpufreq driver, the 2.4.26 kernel needs to be patched - from the previous posts in this topics, you can maybe see that I have managed to patch the kernel source (I think).

I believe that if I replace the original DSL files with the ones created in the patch process, this whole thing will work. What I don't know is:

1. How to find out which new files are created by the patch/recompile.
2. Where to copy the new files to
3. How to create the new knoppix image file for DSL to boot from.

Posted by ^thehatsrule^ on Aug. 31 2006,01:17
Doesn't DSL already come with acpi?...

If it adds more modules, you could just see which ones are missing.  If it modifies some.. well then I guess you could replace them - the paths probably are the same.  The kernel on the livecd is packaged differently.. if I remember, but you could also try any of the packages by modifying your bootloader.

You should see the topic of DSL/Knoppix image remastering.

Posted by Juanito on Aug. 31 2006,07:09
You're right, DSL comes with ACPI and the ACPI modules - these all load on my laptop without problems and work. What DSL doesn't come with is the cpufreqd daemon and the cpufreq driver(s) that cpufreqd needs in order to work.

I read the DSL image remastering posts but I am missing the step that comes after patching the kernel source for the cpufreq driver relevant to my processor and before remastering - i.e. I apply the patch, make mrproper, make oldconfig, make dep, make modules, make modules_install but then what?

Posted by ^thehatsrule^ on Sep. 01 2006,14:56
So you're saying you need to replace the kernel, add in the cpufreqd application, and add the drivers (which I assume are kernel modules)?

What happens if you try to load the modules now and run the cpufreqd application? (before packaging everything)

Posted by Juanito on Sep. 01 2006,15:34
After following the steps above, I end up with a directory usr/src/linux-2.4.26/drivers/cpufreq/ that contains the files:

.depend
kconfig
makefile
cpufreq.d
description-pak
freq_table.c
procintf.c
userspace.c

What I don't see anywhere is a file cpufreq.o and so I cannot "modprobe" anything and I cannot install the cpufreqd daemon with loading a cpufreq driver.

The problem is that the cpufreq patch for 2.4.26 does not contain any instructions  :D

Posted by WDef on Sep. 01 2006,19:42
Check the  .config file in your kernel sources.  Did by any chance the module get compiled *into* the kernel?
If so that means it's already in there - you don't have to load it.

Posted by Juanito on Sep. 02 2006,05:19
There are some cpufreq entries in the .config file in /usr/src/linux-2.4.26:

# CPU Frequency scaling
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_PROC_INTF=y
# CPUFreq governors
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_24_API=y
# CPUFreq processor drivers
CONFIG_X86_SPEEDSTEP_CENTRINO=y

I guess this means that the modules/drivers have been compiled into the kernel? The cpufreqd daemon won't run at the moment (no cpufreq driver), so I guess this means the next steps are:

1. I have to do something with the recompiled kernel
2. Remaster DSL (I use DSL from USB)
3. Boot the remastered DSL

Can anybody help me with the next step from this point - i.e. step 1 above?

Posted by ^thehatsrule^ on Sep. 06 2006,21:19
After make modules...modules install, the correct files should be copied be copied into your system.

Modprobe can't find it yet because you need to update the system/lists (see depmod), or find the file(s) manually and use insmod.

Posted by Juanito on Sep. 08 2006,11:07
Thanks for the hint - after checking what I'd done previously, I discovered I had missed out "make bzImage"

After applying the patch, I did:

root@box:/usr/src/linux# make mrproper
root@box:/usr/src/linux# make oldconfig
root@box:/usr/src/linux# make dep
root@box:/usr/src/linux# make bzImage

which created built-in.o, cpufreq.o, userspace.o, freq_table.o & proc_intf.o in /usr/src/cpufreq/linux/drivers/cpufreq

root@box:/usr/src/linux# make modules

which reported "Nothing to be done for `modules'" in /usr/src/cpufreq/linux/drivers/cpufreq

root@box:/usr/src/linux# make modules_install

which reported "Nothing to be done for `modules_install'" in /usr/src/cpufreq/linux/drivers/cpufreq and "depmod: Can't open /lib/modules/2.4.26/modules.dep for writing"

Then I did:

root@box:~# insmod --force /usr/src/cpufreq/linux/drivers/cpufreq/cpufreq.o

which gave the error "/usr/src/cpufreq/linux/drivers/cpufreq/cpufreq.o: couldn't find the kernel version the module was compiled for"

Does anybody have any idea what the problem is?

If I can somehow enable modules.dep for writing prior to "make modules_install" this might solve the problem but what file permissions would be required?

I could also perhaps edit modules.dep manually but no doubt built-in.o, cpufreq.o, userspace.o, freq_table.o & proc_intf.o are inter-dependent on each other...

Posted by ^thehatsrule^ on Sep. 08 2006,13:27
Ah sorry, I didn't read carefully about WDef's post and your 2nd last post...

The .config implies is that CPU_FREQ capability compiled into the kernel, so you shouldn't require to externally load the modules at all.  Try a
Code Sample
lsmod|grep cpufreq
and see if its actually already there perhaps...

Posted by Juanito on Sep. 08 2006,14:12
I tried your suggestion "lsmod|grep cpufreq", but it doesn't give anything...

lsmod does not show a cpufreq module loaded - in addition, "apt-get install cpufreqd" gives an error stating that a suitable cpufreq driver is not loaded.

Maybe the issue is that, since I am running DSL from a USB stick, I have not rebooted after running the cpufreq patch and recompiling the kernel since the modifications would be lost.

How would I go about "re-packing" the modified kernel into a modified KNOPPIX file? I can't see how to do this from the 60-page re-mastering post...

Posted by WDef on Sep. 08 2006,14:52
1. lsmod shows loadable modules that are loaded.

cpufreq has not been compiled as a module, you have compiled it *into* the kernel ( the "=y" in the config file).  Therefore lsmod will not show it. It's not a loadable module, it's part of the kernel.

If I look in the same cpufreq dir you have been looking at in FC4, I won't find a module there either, for the same reason. But I'm running powernowd, which uses cpufreq.

2. Great work by the way getting this far :=)

BTW, check that 'make mrproper' - it will delete your config file, meaning you may have not compiled a dsl-configured kernel (which doesn't mean it might not run anyway, but it might not take the long line boot params and it might do other things differently).   I don't think you need do make mrproper if compiling from fresh sources.

Also, I think patches are supposed to be applied *after* you run make oldconfig, else 'make oldconfig' could erase any changes the patches might have made to the .config file (if they do).

3. Instead of remastering it might be easier to find a small free partition and do a traditional hard drive install of dsl. You might fry less cds.

Hope these ideas are helpful.

Posted by ^thehatsrule^ on Sep. 08 2006,15:19
1. Yea, my suggestion was a check that nothing should be there - guess I wasn't clear about that.
2. Deleting the config file sounds bad :P
3. I agree you don't need to remaster at this point. Though he could and just use a cdrw or manual frugals (to save cds),  it will probably take more time.  I suppose you could do a traditional hd install, but I think when I did something like this, I just changed my bootloader to use external kernel before loading the dsl frugal image.

4? Perhaps the one in the current kernel source is _older_ than the cpufreqd you are trying to use, and therefore incompatible. (Maybe use an older cpufreqd, or update the kernel's embedded one, or change the config to load them as modules - swap kernels - and then you could have an easier time testing the different modules & program versions)

Posted by Juanito on Sep. 08 2006,17:12
Thanks for the tips.

Ref 1 - I'm sure you're right about the loadable modules being part of the kernel bit I'm still kind of suprised that built-in.o, cpufreq.o, userspace.o, freq_table.o & proc_intf.o are all created if this is the case.

Ref 2 - I'll try again without using "make mrproper" - I don't think the patch should be applied after "make oldconfig" since this asks questions relevent to the patch.

Ref 3 - Using a HD install isn't an option but at least I'm not frying CDs as this is a USB install. What I haven't figured out is what files/directories to copy across to the "un-packed" KNOPPIX directory tree in order to "re-pack" it and boot with the recompiled kernel.

Posted by Juanito on Sep. 09 2006,11:04
I tried again without using "make mrproper" after applying the cpufreq patch and before "make oldconfig" - nothing much changed. The .config file is copied into /usr/src by loading kernelsources.dsl - all the cpufreq patch appears to do is add some cpufreq specific options to this version of .config so I am assuming that this is OK as far as DSL is concerned.

After "make dep", "make bzImage" produces the cpufreq modules but I note that it does not create a boot image file in /usr/src/linux/arch/i386/boot/

I guess I am missing a basic understanding of how to modify the USB memory stick version of DSL following applying a patch to the 2.4.26 kernel sources and recompiling - either:

1. I have not recompiled in the appropriate fashion
or
2. I've done what is required but don't understand what to do next in order to end up with a suitably modified KNOPPIX file

Either way, I'm about ready to give up on this :D

Posted by Juanito on Nov. 18 2006,13:15
After a break using DSL-N which contains the cpufreq drivers built-in, I thought I'd re-start trying to make this work in DSL - I've made some progress but seem to be missing a vital step.

Any help would be very welcome...

I've found I can create the cpufreq modules but there seems to be some modules that are compiled into the kernel - /lib/modules/2.4.26/kernel/drivers/cpufreq/* and some modules that are compiled as loadable modules - /lib/modules/2.4.26/kernel/arch/i386/kernel/* and I don't have a choice as to how some of the modules are compiled.

If I copy the two sets of modules into DSL after re-booting, I cannot load the modules.

My problem is that I cannot figure out if this is:

1. Because I need to use a recompiled DSL?
2. Because I did not copy a file(s) that tells DSL how the modules should be used?
3. Because I made a mistake with the kernel sources set-up - the .config file maybe?

Details below

root@box:~# mkdir /usr/src
root@box:~# chown dsl /usr/src
root@box:~# cp /mnt/hda5/Download/Linux/linux-2.4.26.tar.gz /usr/src/
root@box:~# cd /usr/src
root@box:/usr/src# tar -xzvf linux-2.4.26.tar.gz -C /usr/src
root@box:/usr/src# rm linux-2.4.26.tar.gz

[load gcc1.dsl, gcc-2.95.dsl, gnu-utils.dsl, kernel-source.dsl, linux-kernel-headers.dsl]

root@box:/usr/src# cp /mnt/hda5/Download/Linux/patch_2.5.4-11_i386.deb /usr/src/
root@box:/usr/src# dpkg -i patch_2.5.4-11_i386.deb
root@box:/usr/src# patch -p1 -d linux-2.4.26 < knoppix-kernel.patch
root@box:/usr/src# cp /mnt/hda5/Download/Linux/cpufreq-LINUX_2_4-20040813.tar.gz /usr/src/
root@box:/usr/src# tar -xzvf cpufreq-LINUX_2_4-20040813.tar.gz -C /usr/src/
root@box:/usr/src# cd /usr/src/cpufreq
root@box:/usr/src/cpufreq# ./patchin.sh /usr/src/linux-2.4.26
root@box:/usr/src/cpufreq#  cd /usr/src/linux-2.4.26
root@box:/usr/src/linux-2.4.26# make mrproper
root@box:/usr/src/linux-2.4.26# make oldconfig
*
* CPU Frequency scaling
*
CPU Frequency scaling (CONFIG_CPU_FREQ) [N/y/?] (NEW) y
CPU frequency table helpers (CONFIG_CPU_FREQ_TABLE) [N/y/?] (NEW) y
*
* CPUFreq governors
*
Support for governing from userspace (CONFIG_CPU_FREQ_GOV_USERSPACE) [N/y/?] (NEW) y
*
* CPUFreq processor drivers
*
AMD Mobile K6-2/K6-3 PowerNow! (CONFIG_X86_POWERNOW_K6) [N/y/m/?] (NEW) m
AMD Mobile Athlon/Duron K7 PowerNow! (CONFIG_X86_POWERNOW_K7) [N/y/m/?] (NEW) m
AMD Opteron/Athlon64 PowerNow! (CONFIG_X86_POWERNOW_K8) [N/y/m/?] (NEW) m
VIA Cyrix III Longhaul (CONFIG_X86_LONGHAUL) [N/y/m/?] (NEW) m
Intel Speedstep (PIIX4) (CONFIG_X86_SPEEDSTEP_PIIX4) [N/y/m/?] (NEW) m
Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface) (CONFIG_X86_SPEEDSTEP_SMI) [N/y/m/?] (NEW) m
Intel Speedstep (ICH) (CONFIG_X86_SPEEDSTEP_ICH) [N/y/m/?] (NEW) m
Intel Pentium-M Enhanced SpeedStep (CONFIG_X86_SPEEDSTEP_CENTRINO) [N/y/m/?] (NEW) m
Intel Pentium 4 clock modulation (CONFIG_X86_P4_CLOCKMOD) [N/y/m/?] (NEW) m
Transmeta LongRun (CONFIG_X86_LONGRUN) [N/y/m/?] (NEW) m
Cyrix MediaGX/NatSemi Geode Suspend Modulation (CONFIG_X86_GX_SUSPMOD) [N/y/m/?] (NEW) m
...
root@box:/usr/src/linux-2.4.26# make dep
root@box:/usr/src/linux-2.4.26# make modules
root@box:/usr/src/linux-2.4.26# make modules_install

[reboot, copy cpufreq modules created above into DSL]

root@box:/usr/src/linux-2.4.26# modprobe speedstep-centrino
modprobe: Can't locate module speedstep-centrino
root@box:/usr/src/linux-2.4.26# insmod speedstep-centrino
Using /lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o
/lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o: unresolved symbol cpufreq_notify_transition_Rsmp_974516e6
/lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o: unresolved symbol cpufreq_unregister_driver_Rsmp_295f405a
/lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o: unresolved symbol cpufreq_register_driver_Rsmp_89a26a58
/lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o: unresolved symbol cpufreq_frequency_table_target_Rsmp_da89206f
/lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o: unresolved symbol cpufreq_frequency_table_verify_Rsmp_5870cb98
/lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o: unresolved symbol cpufreq_frequency_table_cpuinfo_Rsmp_e8145e59
root@box:/usr/src/linux-2.4.26#[CODE]

Posted by ^thehatsrule^ on Nov. 19 2006,07:20
Since you changed the kernel config, I'd suggest for you to also be using the modified version of the new compiled kernel.
Posted by Juanito on Nov. 19 2006,15:24
Thanks for the suggestion

Since I'm out of my depth here, do you mean:

1. Use a subset of the (large) linux-2.4.26 kernel sources I worked on and make a new DSL CD? What subset do I use?

or

2. Copy the files that have changed during recompiling the kernel and restore them after re-booting the original DSL?

Posted by ^thehatsrule^ on Nov. 19 2006,23:37
It shouldn't matter which one you use.  Using the kernel.org's 2.4.26 sources then applying the knoppix patch will have the same result as loading the mydsl extension.

You should be able to copy the new modules over and boot from the newly recompiled kernel.

Posted by Juanito on Nov. 20 2006,09:35
Sorry, but this is still not clear for me - maybe this is because I am using DSL from a USB stick, not a HD install where the kernel recompilation would be "permanent".

I can copy/restore the newly created modules without problems. I presume from your comments, I need to "re-pack" the recompiled kernel into the /KNOPPIX/KNOPPIX file and re-boot from that.

Could you give me some pointers as to what I need to re-pack from the recompiled kernel - i.e. which folders/files I would need to replace in the original unpacked KNOPPIX file?

Posted by ^thehatsrule^ on Nov. 20 2006,14:38
It's not in the KNOPPIX image.

The easiest way is to check your bootloader i.e. grub.

for example..
Code Sample
title       I9NV-2, nousb noscsi dma frugal
root        (hd0,5)
kernel      /boot/isolinux/linux24 root=/dev/hda6 vga=791 nousb noscsi dma frugal fromhd=/dev/hda6
initrd      /boot/isolinux/minirt24.gz
boot


I don't think you'll need to replace the initrd though.

Posted by Juanito on Nov. 20 2006,16:15
Since this is a USB install, my bootloader is syslinux.cfg which calls linux24 and then minirt24.gz:

DEFAULT linux24 APPEND ramdisk_size=100000 init=/etc/init lang=us vga=normal apm=off acpi=force initrd=minirt24.gz nomce noapic quiet frugal restore=sda1 toram mydsl=sda1

Does "make bzImage" produce a new linux24/minirt24.gz? So much stuff comes up in the terminal window after entering the command, I couldn't see the wood for the trees...

Posted by ^thehatsrule^ on Nov. 20 2006,17:50
make bzImage I think compresses and packages them in a different format, but I'm don't remember exactly.  It shouldn't matter though, you still should be able to boot off it.

If you want to log everthing, you can append " &> my_log_file.log" to any terminal command.  At least in bash, this will log both stdout and stderr to the named text file.  You'll also notice you won't see the large amount of text, because this is all being redirected to the text file.  I usually use tail -f my_log_file.log in another terminal to view its progress.

Posted by Juanito on Nov. 21 2006,09:00
Thanks - I'll check that.

In the meantime, it occurrs to me that I might be using the wrong .config file. I was using the .config file that came with linux-2.4.26.tar.gz which appeared to be the same file as that in kernelsource.dsl - is this the right file or is there a .config file specific to DSL 3.0.1?

Posted by ^thehatsrule^ on Nov. 21 2006,14:17
If the .config is the same, then it is the same and shouldn't matter either :)
Posted by Juanito on Nov. 22 2006,10:15
Now that I had time to look carefully, I can see that the two .config files are the same.

I am kind of surprised that the two files are the same - I would have expected the file with kernelsource.dsl to be specific to DSL and the one from the linux 2.4.26 sources from kernel.org to be generic. I looked in the DSL download area, but the only .config file I could find seemed to be specific to DSL 2.1 which I believe was Linux 2.4.31 - of course I could have missed the point entirely and the .config file could be specific to a certain Linux version...

The bzimage file I get is +/-3MB whereas minirt24.gz is +/-785KB and linux24 is +/-970KB hence my thinking that I had the wrong .config file.

Posted by ^thehatsrule^ on Nov. 22 2006,14:06
To easily check next time, you can use `diff myfile1 myfile2`

Generic configs are still good :)

Hm, that is larger and you didnt compile a lot of stuff into the kernel - it's probably a better packaging method I suppose.  Well, as long as you can boot off it, there should be no problem

Posted by Juanito on Nov. 22 2006,14:16
I discovered I had missed out a step in the recompilation - "make clean", i.e. what I should have typed was:

make mrproper
make oldconfig
make dep
make clean
make bzImage (or make && make install)
make modules && make modules_install

The bzImage file I get is now +/- 1MB - I renamed this minirt24.gz and tried to boot with it but got a kernel panic message.

Maybe the thing I'm missing is to do something with the new /boot/system.map, vmlinuz and .config files created? I've seen something about using "mkinitrd /boot/initrd" but I get an error that bash doesn't know about this command (gcc1, gcc-2.95 & gnu-utils.dsl are loaded) and I've seen something about editing grub/lilo to point to the new /boot files but in a USB boot I don't have grub/lilo...

Posted by ^thehatsrule^ on Nov. 22 2006,18:19
I think the bzImage is a compressed kernel package, not the initrd (which as I originally stated, you might not need to replace this)

I think you could also boot off the vmlinuz as the kernel.  The new .config should be what you just changed from the oldconfig.  I think the System.map file should be in the same dir as the vmlinuz if you're using that.

Posted by Juanito on Nov. 23 2006,03:39
Thanks - what I'm struggling with is how to boot off the bzImage or vmlinuz files from a USB boot. The system.map file is in the same directory as vmlinuz (/boot), would a USB boot need this file - if so where should I put it?
Posted by ^thehatsrule^ on Nov. 23 2006,04:54
You can probably put it in the root dir / of your usb, depending on how your usb is set up - the dir where the current linux24 resides would be a good idea.

Then you'll have to edit your syslinux.cfg to add a new entry to point to that.

Posted by Juanito on Nov. 23 2006,11:51
Hmm - I'm still struggling with this, but thanks for all the help so far.

I had a look in the minirt24.gz file and as you said, there doesn't seem to be anything in there that would be affected by the recompiled kernel.

I borrowed from meo's monster remastering post and did the following:

# mkdir /ramdisk/source
# mkdir /ramdisk/newcd
# mkdir /ramdisk/newcd/KNOPPIX
# cp -Rp /KNOPPIX/* /ramdisk/source
# cp -Rp /KNOPPIX/.bash_profile /ramdisk/source

[copy cpufreq modules, cpufreq modules compiled into the kernel (built-in.o cpufreq.o freq_table.o proc_intf.o userspace.o) & new system.map]

# cp /path/speedstep-centrino.o /ramdisk/source/lib/modules/2.4.26/kernel/arch/i386/kernel
# mkdir /ramdisk/source/lib/modules/2.4.26/kernel/drivers/cpufreq
# cp /path/cpufreq/* /ramdisk/source/lib/modules/2.4.26/kernel/drivers/cpufreq
# cp /path/System.map-2.4.26 /ramdisk/source/boot

# mkisofs -R /ramdisk/source | create_compressed_fs - 65536 > ramdisk/newcd/KNOPPIX/KNOPPIX

After replacing the original KNOPPIX file on my USB stick with the KNOPPIX file created above, I rebooted - I didn't get any error messages during boot but...

"insmod speedstep-centrino" complained about missing symbols
"insmod cpufreq" complained about not knowing which kernel version it was compiled for

...so I guess that's not the answer.

My syslinux.cfg file currently reads as follows:

DEFAULT linux24 APPEND ramdisk_size=100000 init=/etc/init lang=us vga=773 apm=off acpi=force initrd=minirt24.gz nomce noapic quiet frugal restore=sda1 toram syslog mydsl=sda1  BOOT_IMAGE=knoppix

How exactly should I modify it to point to the recompiled vmlinuz file?

Would it make sense to "un-pack" the vmlinuz file (how?) and replace/add to the contents of the KNOPPIX file with its contents?

Apart from creating the loadable modules and the "compiled-in" modules from the patched kernel source, the recompile process must create/modify some files which reference the new modules - would it make sense to replace/add to the contents of the KNOPPIX file with these files?

Where should I look for these files amongst the gazillion files that were added/modified during the recompile process? In a HD installation I presume these files are created from the patched kernel source and copied into the current installation which would not be the case in a USB stick installation

Posted by ^thehatsrule^ on Nov. 23 2006,13:56
Usually it's easier to test out everything to make sure it works before one remasters, but looks like you the hang of the procedure anyways.

You're still not booting off the new kernel, so the modules aren't recognized properly.

In your syslinux.cfg, change try changing the original kernel "linux24" to whichever kernel package you're trying to use - could try either bzimage or vmlinuz I think (not sure of the limitations of syslinux because I mostly use grub).  Of course you can only do this if you've already copied the kernel you are going to use into the same dir as the original linux24.

Posted by Juanito on Nov. 23 2006,14:57
I renamed the vmlinuz file to linux24 and copied over the original file in the root of my USB stick.

Things started off promisingly - "Uncompressing linux... OK, booting the kernel" but then I got "Kernel panic: VFS: Unable to mount root FS on 01:00"

I still think that my problems stem from the fact that the recompilation process assumes a HD install - I guess the recompilation in /ramdisk assumes an ext2 file system whilst the USB stick needs a vfat FS (or it tries to boot from my NTFS HD) for example.

Still, someone managed to produce a compiled kernel for the default DSL USB boot... I wonder if using kernel sources from the 3.4 Knoppix CD would help?

Posted by ^thehatsrule^ on Nov. 23 2006,15:34
No, the recompilation does not assume anything - the fs doesn't matter since the initrd was left alone - but I guess its a kernel problem right now.

The sources in mydsl are the knoppix 3.4 i386 sources!

Try taking out "quiet" option in syslinux.cfg to see paste out the output so that's it may be easier to see what went wrong.

Posted by Juanito on Nov. 23 2006,18:41
If I take out the "quiet" option plenty of messages scroll off the screen quickly but I guess the relevant ones are the last few:

kmod: failed to exec /sbin/modprobe -s -k block-major, errno = 2
VFS: Cannot open root device "" or 01:00
Please append a correct "root=" boot option
Kernel panic: VFS: Unable to mount root FS on 01:00

I'm pretty sure the first line is due to not having a floppy drive, but I'm not sure what "root=" boot option is required:

/dev/sda1 or mnt/sda1?
/cdrom (the USB stick is mounted as this)?
the location of the /KNOPPIX/KNOPPIX file?
the location of the minirt.gz file?
a location /boot "unpacked" from the linux24 file?
or?

I presume this should go in the syslinux.cfg file:

DEFAULT linux24 root=? APPEND ramdisk_size=100000 init=/etc/init...

Posted by ^thehatsrule^ on Nov. 23 2006,20:48
You can scroll back using shift+pageup/down - pause by hitting scroll lock.  Esp. check those to do with ram/ramdisk.

Well, if your usb worked for the original kernel, it should not require any extra changing that config... (though I suppose root would be /ramdisk).  Did you change anything else in the .config?

Posted by Juanito on Nov. 24 2006,12:00
I scrolled back through the boot messages as suggested - I did not see any other errors other than one about a broken Dell BIOS and a modprobe error for a scsi-host adapter (I haven't got one)

The only changes to the .config file were made by the cpufreq patch.

I modified my syslinux.cfg file to read as follows:

DEFAULT vmlinuz APPEND root=xxx ramdisk_size=100000 init=/etc/init...

and tried root=/dev/root, cdrom, /dev/cdrom, /dev/sda1, /root, /sys, dev/ram, /ramdisk - in each case, I got an error of the form:

VFS: Cannot open root device "sda1" or 08:01
Please append a correct "root=" boot option
Kernel panic: VFS: Unable to mount root FS on 08:01

It appears that the error I get is right before the kernel loads the KNOPPIX file, if I use linux24 to boot successfully, the last messages prior to this are:

RAMDISK: compressed image found at block 0
VFS: Mount root (ext2 filesystem)

aaaaagh

Posted by ^thehatsrule^ on Nov. 24 2006,13:59
In the .config can you list CONFIG_BLK_DEV_RAM*

A quick search on google had someone suggest that increased size in the kernel need to increase the memory as well.. so you could try CONFIG_BLK_DEV_RAM_SIZE=8192

EDIT: I just looked at the kernelsource.dsl and it looks like it is not the kernel source package at all - but is just the kernel headers (hence why you needed to download the original kernel package).  So it may be easier using knoppix 3.4 to do this since it will be all set up there already - which is less margin for error.

EDIT 2: Decided to try something out... some interesting things:
Using gcc1*, gcc-2.95, and kernel.org 2.4.26 source with the knoppix patch booted fine (using the .config from kernelsource.dsl)
Mixing in the other stuff from mydsl caused problems somehow.

EDIT 3: nevermind if you read that.. I hard rebooted and it worked - odd - but it shows you don't need to use the mydsl kernel stuff - which mixing with could cause problems :P

Posted by Juanito on Nov. 25 2006,07:05
The comment about CONFIG_BLK_DEV_RAM caught my attention so I went back and checked the .config file before and after "make mrproper"/"make oldconfig" and discovered that (somehow) it was getting completely mangled - since "make oldconfig" was only showing the cpufreq options, I had presumed everything else was left as-is.

I had also noticed that kernelsource.dsl does not contain any kernel sources (sic) and I could not find them on Knoppix 3.4 so I prepared the sources as follows:

unpack 2.4.26 kernel sources (kernel.org) into /usr/src/linux-2.4.26
delete /usr/src/linux-2.4.26/include and replace with /include from Knoppix 3.4
copy knoppix kernel patch & .config from Knoppix 3.4
apply knoppix patch
apply cpufreq patch

Then, after pulling up a copy of the Knoppix 3.4 .config, I did "make mrproper"/"make config" using the exact same responses as in the Knoppix 3.4 .config (except for the cpufreq options) - an extremely tedious process, I will have to look at "make menuconfig"/"make xconfig".

Next I did "make dep", "make clean", "make bzImage", "make modules", "make modules_install", "make" & "make install" (not sure if the last two are neccessary) which gave a bzImage kernel file (as opposed to a vmlinuz file last time).

When I boot from the bzImage file, I get further than last time, but the last few messages are:

RAMDISK: Compressed image found at block 0
Freeing initrd memory 784k freed
VFS: Mounted root (ext2 filesystem) readonly
Freeing uneeded kernel memory 140k freed
Scanning for USB devices...Done
Accessing DSL image as /dev/sda1.../linuxrc cannot create /etc/ld.so.cache: read-only filesystem

and then things drop back into the extremely limited kernel

Since a successful boot with linux24 gives the message "VFS: Mounted root (ext2 filesystem)" without the "readonly", I presume the problem is this.

Edit: I made a test by recompiling the kernel without making any changes and using .config from Knoppix 3.4 - I get the same result, i.e. the root filesystem is mounted read-only and then /linuxrc cannot create...

Posted by ^thehatsrule^ on Nov. 26 2006,04:54
No idea why it's only getting mounted ro...
but what I'd suggest (which was based on what i did in my previous post) is to
1. unpack kernel.org's 2.4.26 to some place
2. From kernelsource.dsl - extract only the knoppix kernel patch and .config
3. apply the knoppix kernel patch to #1
4. Copy the .config over to #1
5. Do your cpufreq stuff
6. make mrproper
7. Configure your kernel by make menuconfig - but first load the .config you copied in #4
8. do the rest of the 'make' stuff, etc.  To just recompile the kernel you could do make dep; make clean; make bzImage

These steps are just made up so that you don't have to bother with the rest of the kernelsource.dsl or the stuff in knoppix 3.4 cd to minimize problems.  Loading gcc1-with-libs, then gcc-2.95 should be good enough to do this and maybe gnu-utils for a safe measure.

Note: make install (after make bzImage) should install the kernel stuff to /boot so you don't need to worry about which file you're getting.  Also, I think the bzImage IS vmlinuz - but not too sure about that. (make sure you don't use the vmlinux file though)

Hope this helps...

Posted by Juanito on Nov. 26 2006,14:05
Thanks - I did exactly as you suggested (gnu-utils did not seem to be required) without bothering with the cpufreq patch, but no joy. The last few messages from booting with bzImage (from linux-2.4.26/arch/i386/boot) or vmlinuz-2.4.26 (from /boot) are:

RAMDISK: Compressed image found at block 0
Freeing initrd memory: 784k freed
VFS: Mounted root (ext2 filesystem) readonly
Freeing uneeded kernel memory: 140k freed
Welcome to DSL boot splash
Scanning for USB devices...Done
Accessing DSL image at /dev/sda1.../linuxrc cannot create /etc/ld.so.cache: read-only filesystem
DSL boot splash repeats
mount: device or resource busy
mount: device or resource busy
Cannot find KNOPPIX filesystem, sorry
Dropping you to a (very limited) shell

Whereas in a successful boot using the original linux24, the last few massages are:

RAMDISK: Compressed image found at block 0
Freeing initrd memory: 784k freed
EXT2-fs warning checktime reached, running e2fsck recommended
VFS: Mounted root (ext2 filesystem)
Welcome to DSL boot splash
Scanning for USB devices...Done
Accessing DSL image at /dev/sda1...

Posted by ^thehatsrule^ on Nov. 26 2006,19:21
Hm, having that as ro really is a show-stopper.
I'm not sure what you did differently as I wrote out those steps based on what I did.

The one thing I think may be the problem is loading the .config from kernelsource.dsl (using make oldconfig at this point should not prompt you for anything i think, but if you use make menuconfig you have to load it via the menu).  Also note that I did not install the kernelsource.dsl ...

Posted by Juanito on Nov. 27 2006,07:30
I've tried with .config from both kernelsource.dsl (without loading it) and from Knoppix 3.4 - I loaded .config via "make menuconfig", didn't change anything and then saved it.

Using "script", I saved the screen output from the various make commands - searching on "error" did not turn up anything, the only two things that caught my eye were:

1. Excerpt from output following "make bzImage", this kind of warning came up a few times:

quote
gcc -E -D -I/ramdisk/temp/linux-2.4.26/include -D -traditional -DSVGA_MODE=NORMAL_VGA  bootsect.S -o bbootsect.s
as -o bbootsect.o bbootsect.s
bbootsect.s: Assembler messages:
bbootsect.s:258: Warning: indirect lcall without `*'
Unquote

2. Excerpt from output following "make install", I've noticed that this kind of BusyBox message appears after a command (or maybe command option) is passed that BusyBox doesn't know about - for example, if the "find" command is called, this type of message appears if gnu-utils is not loaded:

quote
tools/build -b bbootsect bsetup compressed/bvmlinux.out CURRENT > bzImage
Root device is (1, 0)
Boot sector 512 bytes.
Setup is 4868 bytes.
System is 966 kB
warning: kernel is too big for standalone boot from floppy
sh -x ./install.sh 2.4.26 bzImage /ramdisk/temp/linux-2.4.26/System.map ""
+ '[' -x /home/dsl/bin/installkernel ']'
+ '[' -x /sbin/installkernel ']'
+ exec /sbin/installkernel 2.4.26 bzImage /ramdisk/temp/linux-2.4.26/System.map ''
BusyBox v1.00 (2006.01.04-23:00+0000) multi-call binary
Usage: readlink
Displays the value of a symbolic link.
unquote

All this apart, the only other thing I can think of that was done differently was a USB stick install as opposed to a HD install.

Posted by Juanito on Nov. 28 2006,03:24
Got it - it seems the kernel image needed to be designated read-write:

# rdev -R /mnt/sda1/vmlinuz 0 [0=rw, 1=ro]

Once done, I get the same start-up messages as linuz24 and the system boots as usual. Now onto the cpufreq part...

Posted by ^thehatsrule^ on Nov. 28 2006,03:27
So maybe it's better to load gnu-utils after all.  Although it shouldn't matter since "make install" only installs the needed stuff into /boot.

I was using a frugal/livecd session using grub as my boot loader.

The other difference I recall from another thread, was that the minirt.gz from dsl-embedded was different than the ones from the .iso - don't know what is different though (or not).

Warnings should be bad when compiling kernels, but I didn't have a log of my build to compare.

EDIT: just read your last message - something that should've been quite obvious!  I suppose I just used cp -a after a make install, hence why I didn't have problems.  But good job at getting the basics to work!

Posted by Juanito on Nov. 28 2006,15:03
Now that I'm back to adding cpufreq functionality, a couple of questions:

1. By "...only installs the needed stuff into /boot" do you mean vmlinux-2.4.26 alone or are .config-2.4.26 (I doubt it) and System.map-2.4.26 (what does this do?) required by the boot process as well?

2. I guess I can either "pack" additional loadable cpufreq modules into a modified KNOPPIX image or restore them after boot - what happens with cpufreq modules compiled into the kernel - do I need to add these to KNOPPIX or will the kernel boot image (vmlinuz) unpack them into the appropriate place?

Posted by ^thehatsrule^ on Nov. 28 2006,16:14
1. well it installs all 3 of those files.  The .config is just a copy of your kernel config that was used during kernel recompilation - a backup.  System.map is a table of symbol values for the kernel... (can look it up for more info).

2.  I wouldn't recommend you to compile it into the kernel.  They aren't 'modules' anymore, but the kernel itself has all the code needed in it.  This usually results in a much larger kernel (depending on the size of the cpufreq stuff).  The obvious advantage is that you won't have to deal with the unpacking/packing/loading of modules since everything will be built-in (in the vmlinuz file).

Posted by Juanito on Nov. 29 2006,17:46
The cpufreq patch for 2.4.x doesn't give a choice about compiling some of the stuff into the kernel - anyway, I got back to the main task of making it work and hit a problem. It looks like things compile into the boot kernel image OK but the compile quits part way through making the loadable modules:

# make modules
...
make -C drm modules
make[3]: Entering directory `/ramdisk/usr/src/linux-2.4.26/drivers/char/drm'
gcc-2.95 -D -I/ramdisk/usr/src/linux-2.4.26/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i386 -DMODULE  -nostdinc -iwithprefix include -DKBUILD_BASENAME=gamma_drv  -c -o gamma_drv.o gamma_drv.c
In file included from gamma_drv.c:34:
drmP.h:180: redefinition of `cmpxchg' previously defined here
make[3]: *** [gamma_drv.o] Error 1
make[3]: Leaving directory `/ramdisk/usr/src/linux-2.4.26/drivers/char/drm'
make[2]: *** [_modsubdir_drm] Error 2
make[2]: Leaving directory `/ramdisk/usr/src/linux-2.4.26/drivers/char'
make[1]: *** [_modsubdir_char] Error 2
make[1]: Leaving directory `/ramdisk/usr/src/linux-2.4.26/drivers'
make: *** [_mod_drivers] Error 2

it looks like the command goes through the folders in /drivers in alphabetical order, works OK in /char/agp but then quits in /char/drm

As a test, I used the default knoppix .config but enabled bluetooth (in the knoppix CD but not in DSL) - bluetooth is enabled in the kernel but make modules has the same problem - i.e. the hci_usb module is made but not the rfcomm module (since /drivers/bluetooth is before /drivers/drm but /drivers/net/rfcomm comes after).  After reboot with the new kernel things work fine once I copy the rfcomm module from the knoppix CD, so it looks like the problem is with "make modules" and not with the cpufreq patch.

Does anybody have an idea what the problem might be?

Posted by ^thehatsrule^ on Nov. 29 2006,18:12
Looks like a problem with the .config in 2.4.26 - see < http://lkml.org/lkml/2004/4/19/202 >

Although I'm guessing you may not need to recompile that module - it's good to have a fully successful build anyways.

Posted by Zucca on Nov. 29 2006,21:44
Hmmm. This is a bit OT but is it anyway possible to load different kernel (from usbstick or hd) when using live cd?
Posted by Juanito on Nov. 30 2006,09:18
^thehatsrule^ - thanks for the link (I didn't think Google would turn up anything so obscure).

This confirms I'm not going crazy and there is an issue that stops things when compiling /drivers/char/drm in 2.4.26 - the link offers two solutions:

1. Build for more than CONFIG_M386=y - menuconfig won't allow me to do this and if I manually set more than one processor then menuconfig will not open the .config file...

2. Apply the patch listed in the link - I tried this but there must be an error introduced by the author cutting & pasting a long line(s) of text into a narrow web page and the patch gives an error message about unexpected end of line (but does not give a line number). I guessed a couple of corrections but it's all gobbledegook to me...

I got the compile to run fully by disabling DRM in .config - just unchecking the DRM modules does not help - and cpufreq looked to compile properly. 'Trouble is I need DRM in the kernel image in order to use my monitor with XFree...

Posted by ^thehatsrule^ on Nov. 30 2006,17:39
1.  What did you try to do for "build for more than ..."?

2.  To manually do it, edit that .h file: the '+' in the first column means to add that line, '-' means to delete that line.

Zucca: probably, depends on what you changed, etc.

Posted by Juanito on Dec. 01 2006,10:56
1.  What did you try to do for "build for more than ..."? - CONFIG_M386=y & CONFIG_MPENTIUMIII=y

2.  To manually do it, edit that .h file: the '+' in the first column means to add that line, '-' means to delete that line. - Aaah, so that's how it works. Thanks for the tip, I did this in the drmP.h and it almost worked. For some reason the compile didn't like the reference to system.h added in the diff, after I removed this, the compile worked fine.

As a test, since I don't know if cpufreq works yet, I compiled bluetooth in and it works (after apt-get install bluez-utils) - therefore I assume the compile "bug" is fixed.

# insmod bluez
Using /lib/modules/2.4.26/kernel/net/bluetooth/bluez.o
# insmod hci_usb
Using /lib/modules/2.4.26/kernel/net/bluetooth/rfcomm/rfcomm.o
# insmod l2cap
Using /lib/modules/2.4.26/kernel/net/bluetooth/l2cap.o
# insmod rfcomm
Using /lib/modules/2.4.26/kernel/net/bluetooth/rfcomm/rfcomm.o
# hciconfig hci0 up
# hcitool scan
Scanning ...
       00:0A:D9:E8:4A:65       .P900 [my mobile phone]

Posted by ^thehatsrule^ on Dec. 02 2006,20:46
1.  Well you probably already noticed that the selections in menuconfig are just the descriptions, not the actual tags - did you check all the selections? (But since you got #2 to work.. this shouldn't matter now)
Hope 2. works...

Posted by Juanito on Dec. 04 2006,13:02
I've made two tries at compiling cpufreq into a new kernel:

1. Compiling speedstep-centrino as a module - after rebooting the new kernel image, I cannot load the module and get the following error (this module loads fine on the same system with DSL-N):

# insmod speedstep-centrino
Using /lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o
/lib/modules/2.4.26/kernel/arch/i386/kernel/speedstep-centrino.o: init_module: No such device
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters.
     You may find more information in syslog or the output from dmesg
# dmesg
...
speedstep-centrino: found unsupported CPU with Enhanced SpeedStep

2. Compiling speedstep-centrino into the kernel - after rebooting I can apt-get install the cpufreqd daemon (which checks if a cpufreq driver is present) but cpufrequtils complains that a suitable cpu is not present.

I noticed that the 2.6.12 DSL-N config has CONFIG_MPENTIUM4=y whereas the 2.4.26 DSL config has CONFIG_M386=y. When I try to compile DSL/2.4.26 with CONFIG_MPENTIUM4=y the new kernel image will not boot fully and drops me to a very limited shell - does anyone know why this should be?

Posted by Juanito on Dec. 04 2006,13:03
edited out double-entry
Posted by ^thehatsrule^ on Dec. 04 2006,17:37
First off, congrats on getting this far.  You have successfully compiled a new kernel and added new modules for a fully remastered image of DSL! (though not how you might exactly like it to work :p)

Quote
speedstep-centrino: found unsupported CPU with Enhanced SpeedStep
I believe that would not be a kernel config problem, but the cpufreq module's (older versions?).  And specifying CONFIG_MPENTIUM4=y are just optimizations for that arch.  (Some possible reasons why you couldnt boot this: knoppix patch was meant for 386, all other modules might have to be changed, etc. - but not too sure about these)

Quote
(this module loads fine on the same system with DSL-N):
I assume you mean the one included in DSL-N ?  If so, what version is it?

Posted by Juanito on Dec. 04 2006,17:57
That's an interesting point about the knoppix patch - the one that comes with 4.0.2 (i.e. DSL-N) gives errors when applied to the 2.6.12 kernel sources. I don't like the sound of maybe having to change all of the modules in 2.4.26...

You're correct, I meant the version of the speedstep-centrino module that comes with DSL-N - cpufreq is included in the 2.6.12 kernel.

Posted by ^thehatsrule^ on Dec. 06 2006,15:17
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.
Posted by Juanito on Dec. 07 2006,15:39
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...

Posted by ^thehatsrule^ on Dec. 07 2006,16:32
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...
Posted by Juanito on Dec. 08 2006,14:33
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.

Posted by ^thehatsrule^ on Dec. 08 2006,15:30
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)

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.