Overclocking


 * 1) WORK IN PROGRESS, HELP IF YOU WANT

Overclocking is discussed in this thread. Benchmark results can be found here. If you're more interested in power saving read this.

=Warnings=

- Overclocking WILL VOID YOUR WARRANTY - The lifetime of your device will get reduced - You could lose the data in your device (file system corruption) - Every device is an individual, what is stable for others might not be for you - If you encounter ANY unusual problems, lower your clock frequency - You do it at your own responsibility. No whining afterwards. If you're unsure, don't do it. - Nokia's overclocking warning: 500MHz is the normal frequency. Everything above is not good for your device, even with the stock kernel. - Igor Stoppa's warning and comment

=Available kernels=

Overclocking requires installation of a custom kernel. There are two types of kernels:
 * 1) modified PR1.1 kernels by Lehto and others. The only difference to the stock Nokia kernel is that the change the available hardcoded frequencies.
 * 2) enhanced kernels by titan. They are compatible with PR1.2 (!), contain lots of additional features (IPv6, NAT etc) and bugfixes. In addition they include a large set of possible frequencies (125MHz-1.2GHz) which you manually set an try out without flashing a new kernel. The defaults are set to the standard 250-600MHz range. The kernel can be installed via HAM from the extras-devel catalouge.

Installation of Letho's PR1.1 kernels
Lehto's Kernels talk.maemo.org: Jakiman's Overclock Guide / Summary

Installation of titan's enhanced kernels
This kernel makes it possible dynamically change the maximum frequency up to 1.2GHz (supported frequencies are 250,500,550,600,700,750,810,850,900,950,1000,1100,1200MHz). WARNING: Overclocking may damage your device and is at your own risk! It may void your warranty and destroy your data. You have been warned. You can manually increase the limit until your device fries using, e.g. for 600MHz

talk.maemo.org: Discussion of the enhanded kernel

Note: all commands on this page must be run as root in X Terminal (install rootsh package and enter "sudo gainroot")

Installation of stable kernel (version maemo19) from extras-testing
the package This version maemo19 is good for temporarily testing higher frequencies but a phone call resets the limits. It still includes the invalid 800Mhz frequency. phone call reset workaround for the older maemo19 kernel

It requires firmware PR1.1 or newer.
 * 1) Install the package kernel-flasher-maemo (section system in HAM)
 * 2) shutdown and cold boot. There's no need for reflashing etc.

Installation of the kernel (maemo21) from extras-devel
Installation is the same as with the extras-testing kernel. This version fixes the phone call reset problem and includes 125MHz (setting 124999), but it does still include the invalid 800MHz. The files in the latest version of the community kernel fix the 800Mhz issue.

Installation of the latest experimental kernels
Create and go to an empty directory first. Make sure wget is installed. Run everything as root.

Download of the normal voltage kernel: wget http://maemory.com/N900/overclock/kernel-maemo_2.6.28-maemo21_armel.deb wget http://maemory.com/N900/overclock/kernel-modules-maemo_2.6.28-maemo21_armel.deb wget http://maemory.com/N900/overclock/kernel-flasher-maemo_2.6.28-maemo21_armel.deb

The lower voltage versions of the same kernel may conserve power and reduce the damage of overclocking but they may be less stable.

Download of the lower voltage (LV) kernel: wget http://maemory.com/N900/overclock/lv/kernel-maemo_2.6.28-maemo21_armel.deb wget http://maemory.com/N900/overclock/lv/kernel-modules-maemo_2.6.28-maemo21_armel.deb wget http://maemory.com/N900/overclock/lv/kernel-flasher-maemo_2.6.28-maemo21_armel.deb

Comparison of LV kernel voltages with stock kernel:
 * 1) <=500 is the same as stock
 * 2) 550 is 500 stock (normal voltage)
 * 3) 600/700/750/810/850/900/950 is 550 stock (overvoltage)
 * 4) >=1000 is 600 stock (overvoltage)

Download of the ultra low voltage (ULV) kernel (less stable?): wget http://maemory.com/N900/overclock/ulv/kernel-maemo_2.6.28-maemo21_armel.deb wget http://maemory.com/N900/overclock/ulv/kernel-modules-maemo_2.6.28-maemo21_armel.deb wget http://maemory.com/N900/overclock/ulv/kernel-flasher-maemo_2.6.28-maemo21_armel.deb

Comparison of ULV kernel voltages with stock kernel:
 * 1) <=250 is <0 stock (ultra low voltage)
 * 2) 500 is ca. 0 stock (lower voltage)
 * 3) 550/600 is 250 stock (low voltage)
 * 4) 700/750/800 is <500 stock (low voltage)
 * 5) 850 is 500 stock (normal voltage)
 * 6) 900/950 is 550 stock (overvoltage)
 * 7) >=1000 is 600 stock (overvoltage)

Install with (shut the device down automatically, close all apps and save the data first!): dpkg -i kernel-m* dpkg -i kernel-f* halt and boot again.

Deinstallation
sudo gainroot apt-get install --reinstall kernel kernel-flasher apt-get remove kernel-maemo kernel-modules-maemo

Temporarly change of the frequency limits
sudo gainroot echo 250000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq echo 599000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq The last line shows which values were actually set. To set 125MHz use 124999, for 600MHz 599999, for everthing else x000 with x=MHz. This setting takes effect immediately and is cleared with the next reboot.

Permanently change of the frequency limits
WARNING: Permanent overclocking is very dangerous! To permanently fix a limit you found to be stable edit the scaling_max_freq setting in /etc/pmconfig vi /etc/pmconfig or (with leafpad installed) leafpad /etc/pmconfig

The defaults are: enable_off_mode 1 sleep_while_idle 1 sr_vdd1_autocomp 0 sr_vdd2_autocomp 0 clocks_off_while_idle 1 voltage_off_while_idle 1 scaling_governor ondemand scaling_max_freq 600000 scaling_min_freq 125000 sleep_ind 1
 * 1) Power management configuration file

Battery
In kernels version >=maemo20 you can read out the current battery info: modprobe bq27x00_battery cat /sys/class/power_supply/bq27200-0/current_now

Holding a kernel version
It your manually installed kernel should be not upgraded to the one in extras* try this: echo kernel-flasher-maemo hold | dpkg --set-selections echo kernel-maemo hold | dpkg --set-selections echo kernel-modules-maemo hold | dpkg --set-selections to unlock the version: echo kernel-flasher-maemo install | dpkg --set-selections echo kernel-maemo install | dpkg --set-selections echo kernel-modules-maemo install | dpkg --set-selections

Remarks

 * 1) The screen calibration in settings crashes immediately. It is a known bug in the calibration app, not in the kernel. It's mentioned in the kernel package description and is due to additional evdev (joystick,mouse) support. Just calibrate once with the stock kernel before you install the fully featured kernel.
 * 2) the 125MHz issue
 * 3) Installing another version of the enhanced kernel will just overwrite the older version. The stock kernel modules are preserved so that you can simply reflash the stock kernel via USB.
 * 4) If you for some reason get errors like this during removal or installation  "rm: cannot remove '/lib/modules/2.6.28.10maemo-lv-omap1/modules.*': No such file or directory".try this workaround. There was a bug in one of the early LV kernels but it should be fixed in more recent versions.
 * 5) This kernel will not conflict with the future PR1.2 upgrade. The upgrade will, however, overwrite this kernel and you'll have to install it again.

=Additional information and hints=


 * 1) the frequencies available in the Nokia kernel are: 250, 500, 550 and 600MHz.
 * 2) Nokia locks the device to 600MHz during phone calls. This may be a bug. It also affects Letho's kernels.
 * 3) the telephone app is closed-source and broken. After a phone call it sets the maximum to 600Mhz and the minimum to 250MHz (or  125MHz if available) irrespective of what you have set before.
 * 4) when connected via USB the device locks the minimum frequency to 500Mhz.
 * 5) By default the device is configured to use 125MHz as the lowest frequency but it not enabled in the kernel pmconfig bug
 * 6) if enable 125MHz also set  "echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load" hint
 * 7) improving responsiveness
 * 8) safe pmconfig configuration
 * 9) the warning "WARNING: at arch/arm/mach-omap2/clock34xx.c:443 omap3_noncore_dpll_set_rate+0x28c/0x2dc" in the kernel logs (dmesg) only happens if the invalid 800MHz frequency was selected. ignore it.
 * 10) saving more battery power when idle
 * 11) someone has photoshopped a picture of a device being overclocked 1.7GHz. It's a FAKE!
 * 12) reading one of the temperature sensors "cat /sys/devices/platform/omap34xx_temp/temp1_input"

=Useful stuff=

Show current CPU frequency
awk '{print $1/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

Set maximum CPU frequency
From root terminal:

echo $((600*1000)) > /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq

Replace 600 with desired maximum frequency. The list of available frequencies on your device/kernel can be obtained with command:

awk '{print $1/1000" MHz,",$2/1000" MHz,",$3/1000" MHz,",$4/1000" MHz,",$5/1000" MHz"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

If the last value returned is 0 MHz, this means that you have only 4 available frequencies.

Analyzing time_in_state
This script generates readable output (percentage) of states used. It is designed for 5 available states. If you have 4 available frequencies (stock kernel) simply remove 7th line and lower "head -n 4" to "head -n 3" in 3rd line.

awk '{print "\nCurrent frequency: "$1/1000" MHz\n"}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq sum=`awk '{SUM += $2} END {print SUM}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state` sum2=`cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 4 | awk '{SUM += $2} END {print SUM}'` cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}' cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 2 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}' cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 3 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}' cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | head -n 4 | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f",($2 * 100)/"'"$sum"'"); printf ("'" %%, when not idle "'"); printf ("%.1f %\n",($2 * 100)/"'"$sum2"'")}' cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state | tail -n 1 | awk '{printf (($1/1000)" MHz: overall "); printf ("%.1f %\n\n",($2 * 100)/"'"$sum"'")}'
 * 1) !/bin/sh

Output example:

Current frequency: 125 MHz 800 MHz: overall 5.0 %, when not idle 70.0 % 550 MHz: overall 0.2 %, when not idle 2.0 % 500 MHz: overall 2.0 %, when not idle 25.0 % 250 MHz: overall 0.3 %, when not idle 3.0 % 125 MHz: overall 92.5 %

=Changing the Kernel=

Flashing using PC
1. Power off the N900 completely.

2. Hold "u" on the N900's keyboard, while holding, connect it to the PC via USB cable.

3. You will see usb icon on top right of white Nokia screen.

4. Now you can let go of "u" on the keyboard.

5. Now use flasher utility with the kernel file located in the same directory.

flasher-3.5 -k image_file_name -f -R

6. It should take about 1-2 seconds then it'll say Done.

7. Now your N900 will show white Nokia screen. (reboot)

8. At this time, you can pull out the USB cable.

9. N900 should finish booting up if all goes well.

10. Test out your phone as usual. (Apps, browser, camera, phone etc etc)

11. If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again. note: For Windows7 64bit users, you may need to use WindowsXP mode. (Youtube Tutorial)

Flashing from N900 xterminal

 * do a backup, have a pc nearby and know you are able to flash the n900 with flasher-3.5 - just in case

0. Launch xterminal app then type sudo gainroot (need rootsh installed)

1. type softupd -vv -s --local (thats double v)

2. open new terminal

3. type flasher --local -f -k 

4. you see the flashing (takes some time)

5. type "sync" to save changes

6. type "reboot" and enter to restart

7. Test out your phone as usual. (Apps, browser, camera, phone etc etc)

8. If any abnormal events occur frequently (crash, hang, screen corruption etc), turn it off, flash it to a slower kernel and test again.

'''You are fully responsible for any damage caused by overclocking. Not anyone else.'''

Reverting to the Original Kernel
If you want to revert to the original kernel, execute:

apt-get install --reinstall kernel kernel-flasher