• XDA Forums have been migrated to XenForo. We are aware of several issues including missing threads, logins not working, and more. To discuss, use this thread.
  • If you are experiencing issues logging in, we moved to a new and more secure software and older account passwords were not able to be migrated. We recommend trying to reset your password, then contacting us if there are issues.

[KERNEL][exp: (3.1.10) #5] Firtecy Kernel - a modified Kowalski Kernel

How much Ramhack do you want to have?


  • Total voters
    0

Firtecy

New member
Feb 14, 2013
123
1,124
0
This is an EXPERIMENTAL Kernel that continues the work of @pengus77, but with some additions i make. That means a huge thank to pengus77! Please check his thread http://forum.xda-developers.com/showthread.php?t=2097788
This kernel is completely based on his latest release.

This kernel only supports newbl and will only work on roms with 3.1 support (these are atm only 4.4 (aka KitKat) Roms and tonyps TheRom that is compatible with the 3.1 kernel

Features:
Features from the kowalski kernel:
  • 3.1.10 Kernel Version
  • bcmdhd wifi driver
  • Dynamic FSync
  • Overclock to 1.5 GHz (Not all phones work well with 1.5 Ghz!)
  • Undervolting
  • MultiCore Sched PM
  • Auto Hotplug
  • Fast charge
  • Wifi PM
  • and many more ...
Features added by me:
  • PKSM as enhanced KSM module
  • Built in ZRAM Modul (that makes it possible to use the android default zram solution)
  • Possibility to use deferred_timer for (P)KSM
  • 0, 16 or 32 MB Ramhack
  • Support for extra free kbytes tunable (more a ROM dev feature)
  • Custom vibration force/strength through sysfs
  • 120MHz and 168 MHz frequencies for more battery savings during wakelock

Known bugs:
  • Camera Bug
  • Gyro does not work properly
If you want to report a new kernel bug, you must describe your problem in detail, post your kmsg and last_kmsg (if available) (you can found them under /proc/kmsg and /proc/last_kmsg) otherwise the rule is: no log = no issue

Downloads:
This is more a personal kernel build. I have built these kernels for weeks for myself and used them in private. Now i just want to share them with you guys!

You can download the kernels here: https://s.basketbuild.com/devs/firtecy/p990/kernel/3.1/ They are labeled like this: firtecy_kernel_X-N.zip where X is either exp for an experimental kernel release and stable for a stable kernel and where N is the build number (this number is always incremental!)

Sourcecode:
You can find the sourcecode at github: https://github.com/Firtecy/kowalski/ the branch is exp. The config file is: "kowalski_defconfig"

The intention of this thread is to continue the 3.1 kernel development pengus started. Development related questions or discussions are appreciated
Have fun!

And to quote pengus77:
On a side note... i'm not really responsible if you decide to test it and your phone melts... right?
Thanks to:
@hjunii for bringing up 3.1 Kernel
@pengus77 for the kowalski kernel

XDA:DevDB Information
Firtecy Kernel - a modified Kowalski Kernel, Kernel for the LG Optimus 2x

Contributors
Firtecy, pengus77, hjunii, djnoxd
Kernel Special Features:

Version Information
Status: Beta
Current Beta Version: 3.1#5
Beta Release Date: 2014-08-25

Created 2014-10-31
Last Updated 2014-10-31
 
Last edited:

Firtecy

New member
Feb 14, 2013
123
1,124
0
Changelog:

firtecy_kernel_exp-5 - 25.8.2014
  • Added intellactive governor (thanks to @faux123) and powersave
  • Some bug fixes
  • Added sync framework and exfat support (but not active for the moment)
  • Added a "kowalski touch driver" and dt2w files (since they are not stable enough for now, they are disabled)
The reason why I disabled those things is that I didn't had the time to test them. If you want to test them you have to build your own version. Especially for other developers that can be interesting.
firtecy_kernel_exp-4 - 25.6.2014
  • minor updates/fixes from other kernels
  • Added the min screen on freq back
  • Added a sysfs attribute to change the min screen on freq
  • when disabling pksm, it will be disabled completely

Screen on min freq
If your screen is on, this frequency is the lowest that will be used. If your screen goes off for whatever reason the cpu will go to the normal min frequency.
Note: It seems like 120MHz and 168MHz are stable even for screen on, but since there was the question if i can add it, here you go:

How to change the value:
Code:
echo [value] > /sys/module/cpu_tegra/parameters/cpu_screen_on_min_cap
You have to use a value that is in the frequency table, but you have to echo the frequency in KHz, so 120MHz -> 120000KHz:
Code:
echo 120000 > /sys/module/cpu_tegra/parameters/cpu_screen_on_min_cap
This option does not stick after a reboot

According to @BS86 this release should be more stable than exp3 and thanks for testing!
firtecy_kernel_exp-3 - 13.6.2014
  • tons of updates to zram/zcache (picked from faux123 tegra kernels)
  • crypto: added optimized AES and SHA1 routines
  • added permission checker for binder IPC
  • tegra video driver updates
  • Fixed the voltage table -> all values below 770 MHz are not supported by the regulator chip (thanks to all who helped researching! :) )
firtecy_kernel_exp-2 - 8.6.2014
  • Added the possibility to change the vibration force (or vibration strength)
  • Added 120MHz and 168MHz as cpu frequencies
  • Enabled 600 mV as lowest undervolting value (undervolting is very dangerous if you go too low! Better stay at defaults)
  • Fixed a nvidia or lg cpu derp.
  • For security reasons it is not possible that the cpu will go underneath 216MHz when screen is on!
  • Option to use: No ramhack, 16Mb Ramhack or 32 Mb Ramhack!

Vibration force:
to change the vibration force echo a number between 0 and 127 to /sys/module/tspdrv/parameters/vibration_force. Where 127 is the highest and the default. 20 seems to be the last noticeable value.
Code:
echo [force] > /sys/module/tspdrv/parameters/vibration_force
This option does not stick after a reboot. Rom support will be available (hopefully) soon. I'm preparing a patch for tonyps Rom, so that it is possible to change it in the Rom settings.

120 and 168Mhz:
These values are useful for the case where the phone helds a wake lock. This means because of the wake lock it won't enter deepsleep. The phone would run at 216MHz even if it isn't needed. Running at 168Mhz or even 120MHz should result in a better battery life.
If you experience any problems, try to raise the voltage at this frequencies to a higher value and test again. If it is still unstable report it (with a description of the problem) and change the minimum frequency to 216Mhz.
firtecy_kernel_exp-1 - 1.6.2014
  • Initial release
  • Base source: kowalski kernel
  • Added built in ZRam (no need to use zram.ko for longer)
  • Added PKSM as replacement for ksm (http://code.google.com/p/pksm/)
  • Enabled deferred timers for pksm and ksm
Notice: Since there is no ksm available, but pksm you will not find the options for ksm in any app. All configurations are no longer under: /sys/kernel/mm/ksm/ , but under: /sys/kernel/mm/pksm/
To deativate pksm run this command as root:
Code:
echo 0 > /sys/kernel/mm/pksm/run
This option does not stick after a reboot
 
Last edited:

Firtecy

New member
Feb 14, 2013
123
1,124
0
How to build your own kernel:

You need a Linux PC with either 32 or 64Bit. I'm using Linux Mint Debian Edition 64Bit. And you will need the following packages:
build-essential kernel-package libncurses5-dev bzip2
For example to install them run:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
Hint: If you run into troubles with installing packages, check this post

1. Create a new directory for your kernel building (for example: ~/kernel_p990)
Code:
mkdir ~/kernel_p990
2. cd to your kernel dir
Code:
cd ~/kernel_p990
3. Run this command to download the source code for compiling:
Code:
git clone https://github.com/Firtecy/kowalski
4. Now we need to download the toolchain for compiling: Download it from here: http://www.linaro.org/downloads/ under the Bare-Metal section. It is labeled GCC ARM Embedded. Version: 4.7-2013.q3 ; Release: 13.11

5. Now extract the toolchain to a new dir, for example: ~/kernel_p990/toolchain

6. Now we have to define some values for the build enviroment:
Set the CROSS_COMPILE var to your path where you have downloaded your toolchain. For example:
Code:
export CROSS_COMPILE=~/kernel_p990/toolchain/gcc-arm-none-eabi-4_7-2013q3/bin/arm-none-eabi-
Notice at the end you find this prefix: arm-none-eabi- this is not a dir, but the prefix for all files inside the bin directory(for example: arm-none-eabi-gcc)

7. Set the architecture (processor architecture) for which the kernel should be build. So in our case arm:
Code:
export ARCH=arm
and
Code:
export SUBARCH=arm
8. The next step defines the configurations for the kernel (in this case the configuration is named kowalski_defconig)
Code:
make kowalski_defconfig
Notice: this takes the configuration from the file located under arch/arm/configs and will write it to .config

9. Now we can finally build the kernel :victory: Run:
Code:
make
You will find the kernel under: arch/arm/boot/zImage. You just have to copy the zImage and replace the one found in the flashable zip (e.g. my downloads) under kernel/zImage with your own.

Troubleshooting:
Before you can build or run any from step 8 or 9 you have to make sure that all three vars are set correctly (so ARCH, CROSS_COMPILE and SUBARCH). You can check it by running:
Code:
echo $ARCH
for ARCH (for CROSS_COMPILE and SUBARCH it is the seem, but you have to change the name)
If they are not set correctly repeat step 6 and 7.
If you get a compile error first try to run:
Code:
make clean
and try to build the kernel again.

How to diff 2 files or directories in linux
If you are running linux and have two files on your computer and you want to find the differences you can run the diff command in the terminal.
Let's say you have a file "hjunii/traps.c" and "kowalski/traps.c", this is how you compare them:
Code:
diff -u hjunii/traps.c kowalski/traps.c
The command will compare both and will print an output to the terminal that will be similar to this:
Code:
@@ -27,6 +27,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/slab.h>
 
 #include <linux/atomic.h>
 #include <asm/cacheflush.h>
@@ -483,25 +484,38 @@
 static inline void
 do_cache_op(unsigned long start, unsigned long end, int flags)
 {
-	struct mm_struct *mm = current->active_mm;
-	struct vm_area_struct *vma;
-
 	if (end < start || flags)
 		return;
+	return flush_cache_user_range(start, end);
+}
+
+static inline int
+do_cache_op_iov(const struct iovec __user *uiov, unsigned long cnt, int flags)
+{
+	int i, ret = 0;
+	unsigned long len = cnt * sizeof(struct iovec);
+	struct iovec *iov = kmalloc(len, GFP_KERNEL);
 
-	down_read(&mm->mmap_sem);
-	vma = find_vma(mm, start);
-	if (vma && vma->vm_start < end) {
-		if (start < vma->vm_start)
-			start = vma->vm_start;
-		if (end > vma->vm_end)
-			end = vma->vm_end;
+	if (iov == NULL) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
-		up_read(&mm->mmap_sem);
-		flush_cache_user_range(start, end);
-		return;
+	if (copy_from_user(iov, uiov, len)) {
+		ret = -EFAULT;
+		goto out_free;
 	}
-	up_read(&mm->mmap_sem);
+
+	for (i = 0; i < cnt; ++i) {
+		unsigned long start = (unsigned long __force)iov[i].iov_base;
+		unsigned long end = start + iov[i].iov_len;
+		do_cache_op(start, end, flags);
+	}
+
+out_free:
+	kfree(iov);
+out:
+	return ret;
 }
 
 /*
@@ -550,6 +564,10 @@
 		do_cache_op(regs->ARM_r0, regs->ARM_r1, regs->ARM_r2);
 		return 0;
 
+	case NR(cacheflush_iov):
+		do_cache_op_iov((const struct iovec __user *)regs->ARM_r0,
+					regs->ARM_r1, regs->ARM_r2);
+
 	case NR(usr26):
 		if (!(elf_hwcap & HWCAP_26BIT))
 			break;
Each line starting with a "+" are lines that were added, for example:
Code:
+#include <linux/slab.h>
On the other side lines starting with a "-" are lines that were deleted, for example:
Code:
-	struct mm_struct *mm = current->active_mm;
A line like the following should just show you were you find the changes:
Code:
@@ -550,6 +564,10 @@
with the following syntax:
Code:
@@ -[line number in 1. file],[number of lines that were printed from 1.file] + [line number in 2. file], [number of lines that were printed from 2.file] @@
But the basic syntax is the following:
Code:
diff -u [base file] [file containing the changes you want to display]
You can also compare whole directories!

ProTip: Install the program "colordiff". It will color the console output, that means the output is more readable!
Syntax:
Code:
diff -u [base file] [file containing the changes you want to display] | colordiff
Example:
Code:
[COLOR="Plum"]@@ -1,8 +1,8 @@[/COLOR]
[COLOR="Red"]-VERSION = 2
-PATCHLEVEL = 6
-SUBLEVEL = 39
-EXTRAVERSION = .4
-NAME = Flesh-Eating Bats with Fangs[/COLOR]
[COLOR="RoyalBlue"]+VERSION = 3
+PATCHLEVEL = 1
+SUBLEVEL = 10
+EXTRAVERSION =
+NAME = "Divemaster Edition"[/COLOR]
 
Last edited:

ivaneris

New member
Apr 3, 2012
1,168
259
0
Todanan - Blora
Oh...i see...this why no ksm settings :D
Btw...i would suggest a higher ramhack like 32mb like m1 ramhack...but this kernel works great so far...just classic low ram problem exist (well...obviously) need to set an aggresive value (i'm using swap without zram)
Do i need to post a logcat?

Sent from my LG-P990
 

Firtecy

New member
Feb 14, 2013
123
1,124
0
The first change:
Okay since there was the wish that there should be a 32 MB ramhack version and the poll showed the same i built one. You can find it at my basketbuild https://s.basketbuild.com/devs/firtecy/p990/kernel/3.1/.
So the 32 MB Ramhack version is labeled: firtecy_kernel_exp-1_32MB-RH.zip and the previous one is labeled: firtecy_kernel_exp-1_16MB-RH.zip

I have flashed it and in the settings app, I had 372MB available (Settings > About)

The second change:
Since i have been asked to explain how to build my kernel from source code i wrote a small how to in the third post of the thread. Check it and maybe try to build it for your own.
If you wish i can also write how to change the kernel by your own. (So add new stuff or something similiar)
 

ivaneris

New member
Apr 3, 2012
1,168
259
0
Todanan - Blora
Great job firtecy...downloading asap
--------------------++-
Very fluid ui with 32rh and with performance control app i can set lmk on boot (dunno..the one come with rom 0527 always reset after reboot)
So far...no bugs for me (except known bugs)
Btw i'm using swap only..no zram but zram works too (i turned it off)

Sent from my LG-P990
 
Last edited:

ivaneris

New member
Apr 3, 2012
1,168
259
0
Todanan - Blora
Would like to know if random reboot and phone always waking is a kernel related or rom?

Sent from my LG-P990 using Tapatalk 2
I haven't got random reboots or always waking phone in fact on 3.1 kernel there's a bug for waking phone (need press power button twice or thrice)
Maybe your memory full ocupied and still lot queued job to do...that's sometimes happen to me...that's why i need to set lmk a bit aggresive...
Well as dev always said...log or it's not happen :)

Sent from my LG-P990
 

gumiteve

New member
Jan 2, 2012
66
16
0
Budapest
How to build your own kernel:

You need a Linux PC with either 32 or 64Bit. I'm using Linux Mint Debian Edition 64Bit. And you will need the following packages:
build-essential kernel-package libncurses5-dev bzip2
For example to install them run:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
I have even had to install libc6-dev-i386 in my 64bit vbox image, then the make seems to have started working :) :good:

If you wish i can also write how to change the kernel by your own. (So add new stuff or something similiar)
+1 (if you don't mind and have time for it :) )

Thanks!