[Android Software Development] Eliminator79:
Reserved

5.Adding Features to the Kernel

A)Automatic Way (Using the toolchain menu)

cd android

cd kernel

ARCH=arm CROSS_COMPILE=~/arm-eabi-4.4.3/bin/arm-eabi- make Device Name

make ARCH=arm CROSS_COMPILE=~/arm-eabi-4.4.3/bin/arm-eabi- menuconfig

Replace

Device Name

with the configuration file found at:

Source/arch/arm/configs

It's written in this way something_DeviceCodename_user_defconfig

A menu like this will appear

Choose the features you want.

B)Manual Way

1)Adding Governors

The CPU is just 1 C file (Can be found at sources of any of kernel developers)

Get the Governor file

1.1 If you cant get it through github just view it and use other stock governor file like this

my kernel has already got performance governor, you are going to take it from Kernel Source/drivers/cpufreq/cpufreq_performance.c

Copy cpufreq_performance.c from kernel source to desktop then open it with text editor

delete all the lines in it then copy the lines from the viewed governor on github and rename the whole file name

1.2

Copy the governor C file to KernelSource/drivers/cpufreq and paste it

Open Kconfig

Then Add these lines with proper replacment

config CPU_FREQ_GOV_GOVNAMEHERE
tristate "'gov_name_lowercase' cpufreq governor"
depends on CPU_FREQ
help
governor' - a custom governor!

For BadAss (For Example)

config CPU_FREQ_DEFAULT_GOV_BADASS
bool "badass"
select CPU_FREQ_GOV_BADASS
help
Use the CPUFreq governor 'BADASS' as default

Find endchoice

Add these lines below it

config CPU_FREQ_GOV_BADASS
tristate "'badass' cpufreq governor"
depends on CPU_FREQ
help
'badass' - This driver adds a dynamic cpufreq policy governor.
The governor does a periodic polling and
changes frequency based on the CPU utilization.
The support for this governor depends on CPU capability to
do fast frequency switching (i.e, very low latency frequency
transitions).

If in doubt, say N.

1.3

Open Makefile

Add the line according to the Governor

obj-$(CONFIG_CPU_FREQ_GOV_BADASS) += cpufreq_badass.o

1.4

Open Kernel Source/include/linux.* now open cpufreq.h

Add these lines (With Proper Replacments)

#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_badass)
extern struct cpufreq_governor cpufreq_gov_badass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_badass)

2)Adding I/O Schedulers

Get the I/O .c file as the same way you got the Governor File

Paste it to Kernel Source/block

2.1

Now Open Kconfig.iosched

Let's Assume that we now see SIO

config IOSCHED_SIO
tristate "Simple I/O scheduler"
default y
---help---
The Simple I/O scheduler is an extremely simple scheduler,
based on noop and deadline, that relies on deadlines to
ensure fairness. The algorithm does not do any sorting but
basic merging, trying to keep a minimum overhead. It is aimed
mainly for aleatory access devices (eg: flash devices).
And we will add the I/O Scheduler VR Below it like:

We will put VR below it

config IOSCHED_VR
tristate "V(R) I/O scheduler"
default y
---help---
Requests are chosen according to SSTF with a penalty of rev_penalty
for switching head direction.
Let's assume that we saw SIO (But in different way)

config DEFAULT_SIO

bool "sio" if IOSCHED_SIO=y

We will put VR below it

config DEFAULT_VR
bool "V(R)" if IOSCHED_VR=y

Let's assume that we saw SIO (But in another different way)

default "sio" if DEFAULT_SIO

We will put VR below it

default "vr" if DEFAULT_VR

2.2

Open the Makefile at the same folder

Lets Assume that we saw SIO And we will put VR below it

obj-$(CONFIG_IOSCHED_SIO) += sio-iosched.o

Add VR Now

[obj-$(CONFIG_IOSCHED_VR) += vr-iosched.o

Done We have added the VR I/O Scheduler ! :D

3)Overclocking

Unfortunately, overclocking can't be told the way i said the Governors and I/O Schedulers way because every device has its specific CPU frequencies

But, here is a little help

Go to KernelSource/arch/arm/mach-msm/acpuclock-XxXX.c

You will find files like these

acpuclock-7x30.c

acpuclock-8x50.c

You will see each one of them has only .c file

except one which will have .c and .o file

the one with both .c and .o files will be edited

Explanation will be added as soon as possible