[Galaxy S II Android Development] fenomeno83:
BUILD YOUR "PHENOMENAL"

First download ICS I9100 source code update 4 from samsung opensource (http://opensource.samsung.com/ , register, login, search "i9100" and download update 4)

After download my build package: http://www.axifile.com/en/E522E70E3E

It includes: linaro compiler(android-toolchain-eabi folder), releasetools folder (kernel/releasetools) to create tar and zip file, build.sh file(kernel/build.sh) to compile

Download also speedmod source

http://xdaforums.com/showpost.php?p=24263640&postcount=2

Extract samsung source and kernel inside and copy all "GT-I9100_Kernel" files into "kernel" folder included in my package (so, in "kernel" folder, will be "arch", "block", crypto", etc etc folders).

Extract speedmod source.

Rename initramfs...tar.zip in .gz (change from zip to gz) and extract.

Go in "initramfs" extracted folder and rename "out" to "initramfs".

Go in initramfs/initramfs/sbin/ and edit post-init.sh

Add

insmod /lib/modules/Si4709_driver.ko

After

# IPv6 privacy tweak

#if /sbin/busybox [ "`/sbin/busybox grep IPV6PRIVACY /system/etc/tweaks.conf`" ]; then

echo "2" > /proc/sys/net/ipv6/conf/all/use_tempaddr

#fi

So, you'll have

# IPv6 privacy tweak

#if /sbin/busybox [ "`/sbin/busybox grep IPV6PRIVACY /system/etc/tweaks.conf`" ]; then

echo "2" > /proc/sys/net/ipv6/conf/all/use_tempaddr

#fi

insmod /lib/modules/Si4709_driver.ko

Save.

This is necessary to working radio fm

Open speedmod....patch, go at the end of file

+ echo \#define LINUX_COMPILE_BY \"hardcore\"

+ echo \#define LINUX_COMPILE_HOST \"speedmod-s2-ics\"

Here yo can edit information about "coocker". For example

+ echo \#define LINUX_COMPILE_BY \"fenomeno83\"

+ echo \#define LINUX_COMPILE_HOST \"UBUNTU\"

Now copy initrafms into "kernel" folder (the renamed folder from out, so "initrafms" must have inside "data", "dev" etc, and not copy "initrafms/initrafms")

Copy speedmod...patch into kernel folder.

So, finally kernel folder will have: all samsung update 4 source folder and files (arch, block...), releasetools folder, initrafms folder(with inside data, dev,etc..), build.sh, speedmod...patch.

Outside kernel you have android-toolchain-eabi folder.

Now we must launch patch (patch will update some kernel files).

With terminal go into kernel folder using cd command.

after use:

patch -p1 < speedmod....patch

where as speedmod....patch you must use the correct name

Your files will be patched!

Now we must edit kernel/arch/arm/configs/u1_speedmod_defconfig (in this file are listed files to compile)

Go in

CONFIG_CROSS_COMPILE="/usr/local/arm/arm-eabi-4.4.3/bin/arm-eabi-"

CONFIG_LOCALVERSION=""

And edit in this manner:

CONFIG_CROSS_COMPILE=""

CONFIG_LOCALVERSION="-YourKernelName"

So in localversion you must write name of your kernel

Go in

CONFIG_INITRAMFS_SOURCE="/home/kernel/initramfs/out"

And edit in this manner

CONFIG_INITRAMFS_SOURCE=""

Now we can edit build.sh.

In

KERNEL_PATH="/home/fenomeno83/Scrivania/phenomenal5.5/kernel"

Use your absolute path path of kernel folder

In

TOOLCHAIN="/home/fenomeno83/Scrivania/phenomenal5.5/android-toolchain-eabi/bin/arm-eabi-"

Use your absolute path of android-toolchain-eabi/bin/arm-eabi-

In

ROOTFS_PATH="/home/fenomeno83/Scrivania/phenomenal5.5/kernel/initramfs"

Use your absolute path of initramfs folder (inside kernel folder)

In

export KBUILD_BUILD_VERSION="Phenomenal5.5Medium"

Use name of your kernel as "YourKernelName"

In

make u1_speedmod_defconfig

Leave u1_speedmod_defconfig(if you change name, you must change also this row in build.sh)

Now we can undervolt our source!

Go in kernel/arch/arm/march-exynos

Open busfreq.c (used for bus and cpu internal voltages...for cpu you can use steps of 25mv, for bus you shoud use 25mv, but I'm not sure, so if you have problems use steps of 50mv)

Edit

static struct busfreq_table exynos4_busfreq_table[] = {

{LV_0, 400000, 1100000, 0, 0},

{LV_1, 267000, 1000000, 0, 0},

{LV_2, 133000, 950000, 0, 0},

{0, 0, 0, 0, 0},

};

For example, in phenomenal extreme I used -100mv stock bus voltages, so result will be

static struct busfreq_table exynos4_busfreq_table[] = {

{LV_0, 400000, 1000000, 0, 0},

{LV_1, 267000, 900000, 0, 0},

{LV_2, 133000, 850000, 0, 0},

{0, 0, 0, 0, 0},

};

Edit

static unsigned int exynos4_asv_volt[ASV_GROUP][LV_END] = {

{1150000, 1050000, 1050000},

{1125000, 1025000, 1025000},

{1100000, 1000000, 1000000},

{1075000, 975000, 975000},

{1050000, 950000, 950000},

};

For example in phenomenal I used -50mv stock internal cpu voltages

static unsigned int exynos4_asv_volt[ASV_GROUP][LV_END] = {

{1100000, 1000000, 1000000},

{1075000, 975000, 975000},

{1050000, 950000, 950000},

{1025000, 925000, 925000},

{1000000, 900000, 900000},

};

Now open cpufreq-4210.c for cpu voltages (you can use steps of 25mv) and go in

static const unsigned int asv_voltage_A[CPUFREQ_LEVEL_END][8] = {

/*

*	SS, A1, A2, B1, B2, C1, C2, D

* @Dummy:

* @1200 :

* @1000 :

* @800	:	ASV_VOLTAGE_TABLE

* @500 :

* @200 :

*/

{ 0, 0, 0, 0, 0, 0, 0, 0 },

{ 1350000, 1350000, 1300000, 1275000, 1250000, 1225000, 1200000, 1175000 },

{ 1300000, 1250000, 1200000, 1175000, 1150000, 1125000, 1100000, 1075000 },

{ 1200000, 1150000, 1100000, 1075000, 1050000, 1025000, 1000000, 975000 },

{ 1100000, 1050000, 1000000, 975000, 975000, 950000, 925000, 925000 },

{ 1050000, 1000000, 975000, 950000, 950000, 925000, 925000, 925000 },

};

For galaxy S2 cpu, used value is 4° of each line (from 1200mhz to 200mhz), but I edited all (it is not necessary)

For example, for extreme

static const unsigned int asv_voltage_A[CPUFREQ_LEVEL_END][8] = {

/*

*	SS, A1, A2, B1, B2, C1, C2, D

* @Dummy:

* @1200 :

* @1000 :

* @800	:	ASV_VOLTAGE_TABLE

* @500 :

* @200 :

*/

{ 0, 0, 0, 0, 0, 0, 0, 0 },

{ 1225000, 1225000, 1175000, 1150000, 1125000, 1100000, 1075000, 1050000 },

{ 1175000, 1125000, 1075000, 1050000, 1025000, 1000000, 975000, 950000 },

{ 1075000, 1025000, 975000, 950000, 925000, 900000, 875000, 875000 },

{ 1050000, 1000000, 950000, 925000, 925000, 900000, 875000, 875000 },

{ 950000, 900000, 875000, 850000, 850000, 850000, 850000, 850000 },

};

Now go in match-u1 file.

Here we can set touchscreen sensitivity and (if you want) screen and memory voltages (for both you can use steps of 50mv...maybe steps of 25mv don't work).

Search all lines that includes "movhysti" keyword, as

10,	/* MOVHYSTI */

And edit in this manner

5,	/* MOVHYSTI */

You must do this for all lines that included "movhysti"

For screen voltages (used only in phenomenal extreme and not in normal and medium) go into

REGULATOR_INIT(ldo13, "VCC_3.0V_LCD", 3000000, 3000000, 1,

REGULATOR_CHANGE_STATUS, 1);

And edit. For example in phenomenal extreme is -300mv, so

REGULATOR_INIT(ldo13, "VCC_3.0V_LCD", 2700000, 2700000, 1,

REGULATOR_CHANGE_STATUS, 1);

And also:

REGULATOR_INIT(ldo18, "TOUCH_LED_3.3V", 3000000, 3300000, 0,

REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE, 1);

In extreme:

REGULATOR_INIT(ldo18, "TOUCH_LED_3.3V", 2700000, 3000000, 0,

REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE, 1);

For memory (used only in phenomenal extreme and not in normal and medium), go in

static struct regulator_init_data buck5_init_data = {

.constraints	= {

.name	= "VMEM_1.2V",

.min_uV	= 1200000,

.max_uV	= 1200000,

.apply_uV	= 1,

.always_on	= 1,

.state_mem	= {

.uV	= 1200000,

.mode	= REGULATOR_MODE_NORMAL,

.enabled = 1,

},

},

};

In extreme is used -100mv, so

static struct regulator_init_data buck5_init_data = {

.constraints	= {

.name	= "VMEM_1.2V",

.min_uV	= 1100000,

.max_uV	= 1100000,

.apply_uV	= 1,

.always_on	= 1,

.state_mem	= {

.uV	= 1100000,

.mode	= REGULATOR_MODE_NORMAL,

.enabled = 1,

},

},

};

In march-u1.c there are many and many others modules with voltages. You can experiment, but in my opinion there are no benefits

To change hotplug loadL and loadH (to activate and deactivate second core) use stand-hotplug.c

Go in all lines that have

#define TRANS_LOAD_H0 30

#define TRANS_LOAD_L1 20

And edit. For phenomanal I used

#define TRANS_LOAD_H0 85

#define TRANS_LOAD_L1 40

Now for gpu voltages, go in kernel/drivers/media/video/samsung/mali/platform/orion-m400 (you can use steps of 25mv)

Open mali_platform (maybe is not necessary)

Edit

#ifdef CONFIG_S5PV310_ASV

int mali_gpu_vol = 1100000; /* 1.10V for ASV */

#else

int mali_gpu_vol = 1100000; /* 1.10V */

#endif

For extreme I used -100mv, so

#ifdef CONFIG_S5PV310_ASV

int mali_gpu_vol = 1000000; /* 1.10V for ASV */

#else

int mali_gpu_vol = 1000000; /* 1.10V */

Open (this is the real necessary file to edit) mali_platform_dvfs.c

Edit lines on which voltages associated are 95000,100000.

mali_dvfs_table mali_dvfs[MALI_DVFS_STEPS]={

/*step 0*/{160 ,1000000 , 950000},

/*step 1*/{267 ,1000000 ,1000000} };

#ifdef EXYNOS4_ASV_ENABLED

#define ASV_8_LEVEL	8

#define ASV_5_LEVEL	5

#define ASV_LEVEL_SUPPORT 0

static unsigned int asv_3d_volt_5_table[ASV_5_LEVEL][MALI_DVFS_STEPS] = {

/* L3(160MHz), L2(266MHz) */

{1000000, 1100000},	/* S */

{1000000, 1100000},	/* A */

{ 950000, 1000000},	/* B */

{ 950000, 1000000},	/* C */

{ 950000, 950000},	/* D */

};

static unsigned int asv_3d_volt_8_table[ASV_8_LEVEL][MALI_DVFS_STEPS] = {

/* L3(160MHz), L2(266MHz)) */

{1000000, 1100000},	/* SS */

{1000000, 1100000},	/* A1 */

{1000000, 1100000},	/* A2 */

{ 950000, 1000000},	/* B1 */

{ 950000, 1000000},	/* B2 */

{ 950000, 1000000},	/* C1 */

{ 950000, 1000000},	/* C2 */

{ 950000, 950000},	/* D1 */

};

#endif

In extreme, I used -100mv (so, 85000, 90000) but I edited -100mv all (it is not necessary)

mali_dvfs_table mali_dvfs[MALI_DVFS_STEPS]={

/*step 0*/{160 ,900000 , 850000},

/*step 1*/{267 ,900000 ,900000} };

#ifdef EXYNOS4_ASV_ENABLED

#define ASV_8_LEVEL	8

#define ASV_5_LEVEL	5

#define ASV_LEVEL_SUPPORT 0

static unsigned int asv_3d_volt_5_table[ASV_5_LEVEL][MALI_DVFS_STEPS] = {

/* L3(160MHz), L2(266MHz) */

{900000, 1000000},	/* S */

{900000, 1000000},	/* A */

{ 850000, 900000},	/* B */

{ 850000, 900000},	/* C */

{ 850000, 850000},	/* D */

};

static unsigned int asv_3d_volt_8_table[ASV_8_LEVEL][MALI_DVFS_STEPS] = {

/* L3(160MHz), L2(266MHz)) */

{900000, 1000000},	/* SS */

{900000, 1000000},	/* A1 */

{900000, 1000000},	/* A2 */

{ 850000, 900000},	/* B1 */

{ 850000, 900000},	/* B2 */

{ 850000, 900000},	/* C1 */

{ 850000, 900000},	/* C2 */

{ 850000, 850000},	/* D1 */

};

#endif

Now, we have all!

With terminal go in "kernel" folder using cd command

And use:

./build.sh

After enter you will wait the end of process. At the end zip and tar will be found in releasetools folder.

NOW OFFER ME A BEER :D