[Hero CDMA Android Development] Decad3nce:
How to compile!

This guide is written for debian based linux

Retrieved and modified from the CM Wiki which can be found here: http://wiki.cyanogenmod.com/index.php?title=Building_Kernel_from_source

Firs things first, you'll need to install the development support packages for 32bit/64bit via aptitude or other method:

git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

Then you'll have to retrieve the repo script, move it to /bin and make it executable:

mkdir -p ~/bin
curl http://android.git.kernel.org/repo > ~/bin/repo
chmod a+x ~/bin/repo

(You'll have to reboot after this step)

Next up, I'd recommend that you repo sync the CM android repository from http://www.github.com/CyanogenMod/android. This massive repository contains the tools necessary for rolling a kernel. (You can also repo sync the AOSP repo, if you want to build Vanilla Android).

mkdir -p ~/android/system
cd ~/android/system
repo init -u git://github.com/CyanogenMod/android.git -b froyo
repo sync

Then you'll want to export the cross compiling toolchain:

export CCOMPILER=${HOME}/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

This first process will take around ~1-2 hours for full completion, grab yourself a sandwich or go make fun of aosp or something.

Next up, you'll want to retrieve the htc-kernel-heroc source from git!

You'll need to create a directory so you can keep track of your active kernels, and then you'll begin to clone the repository:

mkdir android-kernel
cd android-kernel
git clone git://github.com/Decad3nce/htc-kernel-heroc.git

(this might take a few minutes)

You now have the kernel source on your computer! Now we'll quickly run through the basics.

I set up a script for easy compilation, but you'll have to modify it a bit after you clone the repo.

(while in android-kernel)

cd htc-kernel-heroc
nano make-kernel.sh

You'll want to change the path to the CCOMPILER, to wherever it is on your PC. If you followed this guide, you'd edit the first 2 lines:

From:

CCOMPILER=~/android-cm/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

To:

CCOMPILER=${HOME}/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

Save, close out and we'll begin compiling!

Simply, if you want to compile the kernel with the defconfig, you'll just run

./make-kernel.sh DC

(This will write the defconfig to .config)

then just:

./make-kernel.sh K

This might take a good 10 minutes(depending on your set up) but after it's all set and done, you'll have the zImage located in arch/arm/boot/. So we'll grab that, and either throw it in the AnyKernel update.zip OR you might want to couple it with a ramdisk and create a boot.img.

Regardless, if you want directions on splitting a boot.img, look HERE.

Details!

I'm still only maxed out 691!!!!

That means that SOMETHING(probably the ramdisk) is overwriting the scaling_max_freq.

You can manually change it via:

echo "768000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

MY GPS DOESN'T WORK!!! AHHHH!!!

First, try this: Here

Relax, chances are you've tweaked your CFS, either with the Battery Tweak or manually

Fix it:

mount -t debugfs none /sys/kernel/debug
echo "NORMALIZED_SLEEPER" > /sys/kernel/debug/sched_features
echo "NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features

How do I change my cpu governor

First, list all the available scaling governors:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

Then, echo the name of the governor to scaling_governor:

echo "nameofgovernor" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

How do I utilize the Diag Function?

-Thanks Hotaru.

What is msmsdcc_fmax ?

The msmsdcc_fmax is literally "The maximum frequency (in Hz) used by the SD controller"(http://www.androidonhtc.com/wiki/Boot_Options)

Killing the powersave also makes it stick to the fmax setting, without having to 'ramp up' over time.

Got a reboot?

Please grab the last_kmsg from the kernel and upload it so I can see what's causing it

adb remount
adb pull /proc/last_kmsg last_kmesg.txt

What is the 'Interactive' CPU Governor:

This governor is designed for latency sensitive workloads, UI interaction for

example.

Advantages:

+ significantly more responsive to ramp cpu up when required (UI interaction)

+ more consistent ramping, existing governors do their cpu load sampling in a

workqueue context, the 'interactive' governor does this in a timer context, which

gives more consistent cpu load sampling.

+ higher priority for cpu frequency increase, rt_workqueue is used for scaling

up, giving the remaining tasks the cpu performance benefit, unlike existing

governors which schedule rampup work to occur after your performance starved

tasks have completed.

Existing governors sample cpu load at a particular rate, typically

every X ms. Which can lead to under powering UI threads when the user has

interacted with an idle system until the next sample period happns.

The 'interactive' governor has a different approach. Instead of sampling the cpu

at a specified rate, the governor will scale the cpu frequency up when coming

out of idle. When the cpu comes out of idle, a timer is configured to fire

within 1-2 ticks. If the cpu is 100% busy from exiting idle to when the timer

fires then we assume the cpu is underpowered and ramp to MAX speed.

If the cpu was not 100% busy, then the governor evaluates the cpu load over the

last 'min_sample_rate' (default 50000 uS) to determine the cpu speed to ramp down

to.

There is only one tuneable for this governor:

/sys/devices/system/cpu/cpufreq/interactive/min_sample_rate:

The minimum ammount of time to spend at the current frequency before

ramping down. This is to ensure that the governor has seen enough

historic cpu load data to determine the appropriate workload.

Default is 5000 uS.

Signed-off-by: Mike Chan <mike@android.com>

Change-Id: I686d2f57b0ed9cbb73217403b7438be5719588d2​

I WANT 490+ on Quadrant Scores!!!!

I don't recommend doing this at all, but if you feel the need to show off:

1. Flash the BFS kernel up top

2. Run this in shell

adb remount
adb shell
echo "0" > /proc/sys/vm/overcommit_memory
echo "5000" > /proc/sys/kernel/rr_interval
echo "90" > /proc/sys/kernel/iso_cpu
echo "cfq" > /sys/block/mtdblock3/queue/scheduler
echo "10" > /proc/sys/vm/vfs_cache_pressure

3. Overclock yourself to max 768 with oc widget

4. Run Quadrant until you feel that your ego is stroked enough.

5. ????????

6. Profit.

Personal Modded collin_ph BatteryTweak V2

Changes

Added Temperature Management system.

Integrate a simple way to override frequencies on based on battery temperature. Works great, will need a bit of polish later down the line.

No need to echo frequencies twice during polling. So don't allow the regular frequency changes during override. Also add MinOverrideFreq as a customizable, which allows us to do a check between min and max to not have any problems. Also remove last trace of LEDfix

Fix MaxTempEnable. Previously, trying to set n caused no change. Probably due to Android being homo in shell. Everything works now.

Use interactive scheduler as default. Change min frequency to something that actually exists on the freq table.

EITHER USE THIS OR OC WIDGET. SetCPU still has way too much overhead IMHO for what it's uses are.

Download BatteryTweak-DecaMODv2.2

MD5: 9c677f0a618e14421053a6ab5b7d4bc3

Last Update: 10/24/2010 7:18 CST

Recommended Settings for Tweak:

For BFS Kernel:

CPU Governor: Ondemand

I/O Scheduler: deadline/cfq

For CFS Kernel:

CPU Governor: Interactive

I/O Scheduler: deadline/noop