[kernel][For CM7 only][LAZY,TUN,CIFS,ondemand tweaks]Adam's kernel[02/10/2012] - Kindle Fire Android Development

Hi guys.
I'm a newbie about compiling kernel,and this is my personal compiled kernel based on Hashcode's git source( stock branch),also with some tweaks which I think can improve the responsiveness without bringing extra power consumption( or as little as possible).
This kernel will also be my testing platform to do some MOD porting from Ezekeel's GLaDOS kernel.
Thanks to all great developers in XDA , especially:
-Hashcode & intersectRaven : for their git repo alone with a working .config. alone
-Ezekeel : for his so many great MODs on Nexus S(my phone) and Galaxy Nexus(will be my next phone)
-whistlestop : For his improvement on CM7 (I'm completely unfamiliar with the user land things about android, without him I'll be still using the stock ROM)
Features:
-LAZY cpufreq governor ported from GLaDOS(http://forum.xda-developers.com/showthread.php?t=1276092) with some tweaks.
-TUN compiled into kernel (especially important for people living in regions with strict network censorship like CHINA! F*ck the GreatFireWall)
-CIFS compiled into kernel along with NLS-utf8 for non-ASCII characters.( Now who cares the size of the internal flash?)
-Minor tweaks on ondemand governor to improve responsiveness.
ToDo:
-BLX porting from GLaDOS(http://forum.xda-developers.com/showthread.php?t=1257497)
-TouchWake porting from GLaDOS(http://forum.xda-developers.com/showthread.php?t=1239240)
Because I'm a newbie on kernel development and the MODs above both have some code in hardware drivers, so it will be a long time before accomplish.
The kernel source code seems to work on both CM9 and stock ROM.
So later I'll upload the flashable kernel zip for CM9 and stock ROM after some test.
Download:
CM7:http://www.mediafire.com/?2nsm9lb7ylm3gnl
In next post,I'll post the procedure for compiling the kernel and the wifi driver.

In this post I'll post the detailed procedure of compile the kernel.
1.Get the kernel source and wifi driver:
If you want to compile the kernel based on my tweak,
you can use my repo (fork from hashcode's source):https://github.com/adam900710/kernel_omap(branch stock)
Or you can just start from scratch without my tweak:https://github.com/KFire-Android/kernel_omap(only branch stock is tested)
If you are unfamiliar with git,you can learn it on the GitHub's help page:
http://help.github.com/
Tiwlan drivers from neither omapzoom nor CM7 works due the lack of given functions.
ONLY the wifi driver from Amazon seems work. So you need to download the whole zip from Amazon:
http://www.amazon.com/gp/help/customer/display.html?nodeId=200203720
The wifi driver locates in mydroid/hardware/ti/wlan/wl1283
2.Get the cross compile toolchain:
Yes,you can build from scratch according to CLFS(http://trac.cross-lfs.org/),but a newbie like me is glad to use the pre-compiled toolchain like sourcery G++. Omappedia recommanded 2010q1-202(https://sourcery.mentor.com/sgpp/lite/arm/portal/release1293), so I use it as the toolchain and it works well.
The self-extrated installation program will install the toolchian without any problem.
Also other toolchain is available like linaro , but according to the post by Ezekeel (http://rootzwiki.com/topic/10855-researchmythbuster-optimized-compiler-toolchains/) , there seems no obvious difference. So the out-of-box sourcery G++ is a good choice.
3.Compile the kernel.
Code:
cd kernel_omap #cd into your kernel
make mrproper #clean the source tree( normally you can skip)
make otter_android_defconfig #get the default .config (also you can copy it manually)
make ARCH=arm menuconfig #if you want,you can tweak the config of the kernel.This needs headers of ncurse
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi -j4 #you should make sure that the toolchain is in you PATH
After some CPU time, the kernel is built, in arch/arm/boot/zImage. Also the modules is built in other places.
Since I built all TUN/CIFS and so on into kernel,so there is no need to install the modules.
4.Compile the wifi driver:
Code:
cd mydroid/hardware/ti/wlan/wl1283/platforms/os/linux/ #cd into the building folder
make ARCH=arm KERNEL_DIR=/home/adam/kernel_omap CROSS_COMPILE=arm-none-linux-gnueabi- TNETW=1273 -j4 #you need to change the path of KERNEL_DIR
CAUTION: DO NOT add DEBUG=n OR DELETE TNETW=1273....
I don't know why,but if you do so,the wifi driver won't work properly.
5. Package the kernel into boot.img with ramdisk.
Thanks to DooMLord , in his git repo , you can download the tools needed.
https://github.com/DooMLoRD/Kindle-Fire-Kernel/tree/master/final_files
Only minor changes are needed for the path ,every thing elso works fine.
You can use the ramdisk extracted from any CM7 boot.img using the perl script.
Then just ./make_bootimg will do everythin for you.

Great i will test it
Sent from my GT-P1000 using xda premium

Best kernel.
I'm running on CM7 with this kernel and get super-perfomance and perfect power consump (Using Lazy governor).

It's not support OC??
Sent from my GT-P1000 using xda premium

acax456 said:
It's not support OC??
Sent from my GT-P1000 using xda premium
Click to expand...
Click to collapse
Sorry, not support yet.
Maybe I'll add OC in next release.But I don't recommend OC because the power consumption...

can you able otg usb support ???
is this possible

Please add .zip for CM9!

Can I flash this from the recovery? or do I have to use adb??

please.update your kernel.since its been two months from last.update
Sent from my GT-P1000 using xda premium

Related

TF300T kernel source repository

https://github.com/untermensch/asus_kernels
getting started with building kernels:
http://source.android.com/source/building-kernels.html
I started with the source from the ASUS website and the Linux 3.1.10 source from
kernel.org and made a some patches for the various directories, created a new git
repository and made a commit after each patch is applied to the Linux 3.1.10
kernel source tree. So now you can browse the changes made to the Linux 3.1.10
source to make it into a kernel for the TF300T.
update 11-21-2012:
add cifs, md4 modules
update 10-27-2012:
add data2sd support
uncap sd card DTR
add DUB-E100 revision C dev id
update 10-11-2012:
add zram support
add zram swap
add init.d
add OC kernel for the TF300TL, TF300TG
update 10-05-2012:
fix exFat mounting
revert MosChip MCS7830 driver
update 10-04-2012:
NTFS R/W via ntfs-3g
noauto_da_alloc added to fstab.cardhu
updated MosChip MCS7830 driver
added GPU overclock to 520Mhz from Motly-git
added user voltage control from Motly-git
possible I/O latency tweek
update 10-02-2012:
NTFS mount fail fixed (read only)
all I/O scheduler's included
support for MosChip MCS7830 based Ethernet adapters added
attached is the current snapshot of the repository.
changes:
debug stuff removed
OC to 1.6GHz
simple I/O scheduler as default
pegasuq governor added
zcache and cleancache enabled
CWM flash-able
Great move... lets see if someone dedicates some time to this wonderful gadget
Sent from Chanook 300 using Tapatalk 2
I'm running the source built kernel now and it appears that all the devices work
you may want to start a dev.. go ahead
untermensch said:
I'm running the source built kernel now and it appears that all the devices work
Click to expand...
Click to collapse
Hi !
..also I compiled the 10.4.2.9 kernel source code , and seems to be stable and no issue !
:good:
I have somme issue with dock keyboard ...as soon as it is connected = frequent reboot in any JB rom ( stock or custom !)
I hope this latest update 10.4.2.13 to resolve this ! :good:
untermensch said:
https://github.com/untermensch/tf300t_kernel
I started with the source from the ASUS website and the Linux 3.1.10 source from
kernel.org and made a some patches for the various directories, created a new git
repository and made a commit after each patch is applied to the Linux 3.1.10
kernel source tree. So now you can browse the changes made to the Linux 3.1.10
source to make it into a kernel for the TF300T.
Click to expand...
Click to collapse
Thanks for your work.
Could you tell me why would be beneficial to port Linux 3.1.10 to the TF300?
Valantur said:
Thanks for your work.
Could you tell me why would be beneficial to port Linux 3.1.10 to the TF300?
Click to expand...
Click to collapse
the official ASUS kernel source is based on 3.1.10 so I am not porting anything, I am using
github to display the differences between the source released by ASUS and the base Linux
3.1.10 source it was built from. I do believe that the repository would be helpful to port to
a newer kernel, after the patches have been applied it is basically the ASUS source, but I
did fix a few things so it would build.
applied patch for the 10.4.2.13 kernel source
untermensch said:
applied patch for the 10.4.2.13 kernel source
Click to expand...
Click to collapse
Good .. that should fix the reboot issue which afaik occurs if you have a SD inserted in the dock
Sent using The Beast via Tapatalk 2
CPU over clocking to 1.6Ghz pushed to the repository
add
Code:
CONFIG_TEGRA_OC=y
to your .config
and remove
Code:
CONFIG_TEGRA_EDP_EXACT_FREQ=y
from your .config
or make xconfig and tick the TF300T Over Clocking check box
well that is nice. Can you post your OC Kernel for us?
mikaole said:
well that is nice. Can you post your OC Kernel for us?
Click to expand...
Click to collapse
here is the kernel plus the modules that go into /system/lib/modules
see this post for install instructions
http://forum.xda-developers.com/showpost.php?p=31944448&postcount=34
Thx, but Kernel is not flashable
untermensch said:
here is the kernel plus the modules that go into /system/lib/modules
Click to expand...
Click to collapse
This files, are compatible on Fw asus JB 10.4.2.13 with root, insecure kernel + busybox?
and how to instals the two files?
Thank's for reply and thank's for greats works
stevtec86 said:
This files, are compatible on Fw asus JB 10.4.2.13 with root, insecure kernel + busybox?
and how to instals the two files?
Thank's for reply and thank's for greats works
Click to expand...
Click to collapse
normally you just flash the kernel in Recovery and you can copy the modules with root explorer. But flashing the Kernel fails in TWRP.
nothing I do will ever be "flashable" because people are stupid and will flash anything on to
any device.
install the kernel vi fastboot
Code:
fastboot flash boot kernel.blob
modules are optional install via adb while in recovery
Code:
adb shell sh -c "rm -fr /system/lib/modules/*"
then cd into the directory with the modules
Code:
adb push ./ /system/lib/modules
stevtec86 said:
This files, are compatible on Fw asus JB 10.4.2.13 with root, insecure kernel + busybox?
and how to instals the two files?
Thank's for reply and thank's for greats works
Click to expand...
Click to collapse
this is a 10.4.2.13 kernel, the ram disk is stock. I'm sure if you request it
the dev for your kernel will merge the overclocking changes so you can
have OC to.
thx, just saw the blob myself. Its already done
Works fine here. Big THX
untermensch said:
this is a 10.4.2.13 kernel, the ram disk is stock. I'm sure if you request it
the dev for your kernel will merge the overclocking changes so you can
have OC to.
Click to expand...
Click to collapse
Two other questions:
1 - I have the TERP recovery, is that a problem?
2 - OC frequencies can be selected?
1. no problem at all, have TWRP, too
2- Yes can be selected in the OC app like set CPU or Antutu Master

[Q]Couple of questions about kernel developement

I was wondering if its possible to build WFS kernel with the linaro toolchain or is it only for kernel v 3.
Also is there a way to eddit the .config file w/o decompiling the kernel. I think i saw some tool like that or something.
I tried compiling fresh kernel from source didnt work out so well so i tought lol maybe there is a workaround for some smaller changes.
Basically i want to take an alrady compiled kernel open its config file and add manualy EXT support or change the dafault scheduler governor or freq.

[Q] [PORT][Kernal] How Do I Get Started

I was Wondering How Do I Get Started Porting This Kernel I Know How To Make Roms because I Can From Android forums, Never Did Kernels Or Kernels Ports So How Do I Get Started.... The sources Are Here
Sources :-
Sources at*http://github.com/gokhanmoral/siyahkernel-sgs3
Ramfs at*http://github.com/gokhanmoral/ramfs-sgs3
Toolchain at*http://github.com/gokhanmoral/android_prebuiltSimply clone all to a directory and run build_kernel.sh in the kernel directory
Porting a Kernel primarily modifies the Ram Disk. You will need to get correct drivers from Samsung's source or from CM device tree. In addition, you have to make sure the Governors and Schedulers in Siyah are actually supported on this chipset.
Here's few Guides. Link 1 Link 2 and CM Build Guide
Most important of all, ask the Original Dev for permission!!!

[PATCH] Kexec-hardboot patch

In this post, I would like to explain what kexec-hardboot patch is.
@kernel developers: I would like to ask you to merge this patch to your kernels, because it is essential part of MultiROM - it allows me to boot any kernel without changing the boot partition. I realize that it is no small request, but the patch is not big, touches relatively stable parts of kernel and should not cause any problems. Thank you.
What is kexec?
It is syscall of Linux kernel, which allows you to boot another Linux kernel without restarting the device - "Linux boots itself". The functionality is equivalent to fastboot -c *cmdline* boot zImage initrd.img, but without PC and fastboot. It is fairly known thing, so more info at wikipedia and man kexec.
Standard kexec call unfortunatelly does not work on Nexus 4. It freezes somewhere, and it is very difficult to find out where - probably some of the drivers are not shut down/re-initialized properly, it is a commong thing among Android devices, which is why kexec-hardboot was made.
What is the difference between normal and hardboot exec?
Kexec-hardboot patch adds a real device restart to that process, so that all the drivers can be properly reinitialized. It stores new kernel to RAM, reboots the device as usual, and kernel from boot partition immediately jumps to the one which was stored to RAM before reboot.
Unlike grouper's kexec-hardboot patch, this one only requires the host kernel to be patched. This is one of the improvements I made, and I think it is pretty significant.
To sumarize the process:
kexec --load-hardboot.... is called and kernel it loaded into RAM.
kexec -e is called. Special info is written to memory (to area which is not overwritten on reboot) and the device is rebooted.
After reboot, very early in the boot process, kernel checks if that special info is present in RAM and if so, it loads new kernel from RAM and jumps to it.
Kexecd' kernel starts and boots.
For more info, read the original thread.
Patches:
Kernel patch: https://gist.github.com/Tasssadar/7833796, 4.4 AOSP kernel repo
This is the kernel patch. Only the host kernel needs to be patched.
Related CONFIG options:
CONFIG_KEXEC=y
CONFIG_KEXEC_HARDBOOT=y
CONFIG_PROC_DEVICETREE=y
CONFIG_ATAGS_PROC=n # This one is turned on automatically, but it is not needed, so you can disable it.
All these options must be enabled.​
Userspace kexec binary: https://github.com/Tasssadar/kexec-tools
I had to change some things in kexec userspace binary because of some kernel bugs, complete description is in that repository. You can get statically built binary at https://github.com/Tasssadar/multirom/blob/master/install_zip/prebuilt-installer/multirom/kexec​
Usage:
Once you have the kernel patches and kexec userspace binary in place, just run following command to boot into new kernel:
Code:
kexec --load-hardboot zImage --initrd=initrd.img --mem-min=0x20000000 --command-line="$(cat /proc/cmdline)" --dtb
kexec -e
Note the command line parameter - cmdline from bootloader is not added automatically, you have to put it there by yourself.
Authors:
This patch was made by Mike Kasick for Samsung Epic 4G. Since that, it was ported to several devices, one of them is Asus Transformer TF201 - I used patch from TF201 and modified it a bit (basically just changed few SoC specific constants). People at #ubuntu-arm helped me out with that, thanks.
For hammerhead, I've improved the patch a bit - only the host needs to be patched now and I've added support for DTB.
Merged, thanks again for the awesome work @Tasssadar!
Good deal.My day is getting better.
@show-p1984 would love to see this in bricked kernel too! ?
@neobuddy89 did you see this?
Sent from Nexus 5 on Slimkat
thanks for the hard work.. thats awesome.
AndroidSlave said:
@neobuddy89 did you see this?
Sent from Nexus 5 on Slimkat
Click to expand...
Click to collapse
Yeah, I saw this.
neobuddy89 said:
Yeah, I saw this.
Click to expand...
Click to collapse
I asked that 6 months ago
Sent from my Nexus 5 using Tapatalk
awesome work bro...
much needed..
AndroidSlave said:
I asked that 6 months ago
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Yeah, I know and I saw that days back..
Enough of OT. :fingers-crossed:
Help with applying the patch
Okay so I have my aosp kernel made. I have my working directory too. Can you just guide me on how do I apply this partch to it?
Is it possible to add that patch from a on the fly flashable zip ?
@Anoopnk since the patch is for the kernel(zImage) its not possible to patch it like that. Or you have to compile the kernel or you need to ask your kernel dev friendly or he can include it in his kernel.
Hello, first I'd like to apologize for dredging up an old thread. Second, I am attempting to build a CM13+kali+kexec compatible kernel, with extra wifi drivers as the base kernel doesnt support my wifi card. Based on that goal, I have a multi-part question for the OP, or anyone else with the know-how to assist me in my quest.
1)Is there a source available for your kernel_kexec_hammerhead_cm13-01-2c39db662.zip listed on the multirom page for nexus 5? I'm attempting to build a new kernel, for kali+CM13+multirom, and your android_kernel_google_msm git only has branches going up to CM12. It would be far easier for me to start with a 'clean' CM13+kexec source then trying to patch myself as per question #2
2) I've attempted to patch a plain old hammerhead_defconfig from CM13 git, however I believe I am doing so wrong. I have managed to compile kexec-tools and aquired the hammerhead 3.4.x patch. Now am I supposed to patch my produced zImage-dtb AFTER build, running the patch from the kexec-tools folder and against the zImage-dtb? Is it something like 'KEXEC.patch -p1 < zimage-dtb'
Any clarification on the use of the kexec-tools patch, or simply a link to github source of a 'clean' CM13 kernel with the kexec patch already applied, would be incredibly helpfull on my journey down the rabbit hole
~EDIT~
Ok so I've managed to figure out the patch and feel like a dumbass. For anyone else looking to get into kernel dev, and wanting to use the kexec patch, heres the basics:
1- run patch within your kernel source directory
2-ensure that the config settings in OP are set (I had to add them to my source by hand as they werent there)
3-when zipping up your kernel, add the sbin and lib/kexec-tools folders from the kexec-tools source build, and be sure your updater-script / updater-binary is set to move these folders into /sbin and /lib respectively.
4-Flash and enjoy Kexec! (check with multirom manager)

Making a CM11.0 kernel for E980?

Hello fellow OGPers...
So I've been jumping from ROM to ROM for a solid few months now. Really enjoyed my time as an Android user and soaked in a lot. I've been learning (well... teaching myself) about Linux and other related things. But I've been busy with classes, a social life, and other commitments. Anyway let me cut to the chase. I really enjoyed it in 4.3 ROMs when I could use all the settings on the AOSP custom kernel for our device and among other things liked the experience of a custom kernel. It's about time we got one for 4.4.x Kitkat... right?
I am currently running Windows 7 (if specs are important I will post them) with a Linux Mint distro (both are 64-bit). I have downloaded the CM11.0 from github and a few toolchains. I haven't untared them yet or anything, but I have some. One is specialized for Cortex A-15, which I read our device's CPU is much alike to. Anyway I just wanted some help getting started with making a kernel is what it comes down to. I have basic Linux knowledge and that's about it. I just want to get a custom kernel out and then maybe in the future get a nice battery-optimized kernel out. I forgot to grab a kernel patch and I'll download it tomorrow probably. But I really don't know where to start at all. Do I need knowledge of anything or some more experience knowledge? If anybody can point me in a good direction that would be great. Everything is appreciated.
Oh and feel free to PM me answers as well if it's easier or more convenient for you.
Thanks guys!
This would be great as we need a kernel Dev ... Good luck on your journey !
2SHAYNEZ
If you only want to compile kernel,clone this repository.
git clone https://github.com/CyanogenMod/lge-kernel-gproj/tree/cm-11.0
make any change you want to do with the source.
Download android toolchain and extract it.
Compile the kernel sources with
export ARCH=arm CROSS_COMPILE=/path.to.toolchain/bin/arm-eabi- && make cyanogenmod_e980_defconfig && make -j#
(# is the number of your computer cores +1)
you will get zimage in /arch/arm/boot folder
Using boot.img(the kernel) from official CM build zip to get the ramdisk is easier
abootimg -x boot.img
you will see:
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
put the extracted initrd.img and bootimg.cfg to /arch/arm/boot(where your compiled zimage are)
run:
abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
You will get the boot.img!
This is the complete kernel!
Use any previous kernel zip, and replace the boot.img inside the zip with yours.
Flash it and test it.
My TWRP 2.8.0.0 or TWRP from freegee or Philz Touch will auto lokify the kernel.
Wing
Attached is the kernel.zip that i use.
Replace the your finished boot.img with it~~
Wing
BTW i am not programmer, but i am a very long time gentoo linux and archlinux user, long before android exist~
mukwing said:
If you only want to compile kernel,clone this repository.
git clone https://github.com/CyanogenMod/lge-kernel-gproj/tree/cm-11.0
make any change you want to do with the source.
Download android toolchain and extract it.
Compile the kernel sources with
export ARCH=arm CROSS_COMPILE=/path.to.toolchain/bin/arm-eabi- && make cyanogenmod_e980_defconfig && make -j#
(# is the number of your computer cores +1)
you will get zimage in /arch/arm/boot folder
Using boot.img(the kernel) from official CM build zip to get the ramdisk is easier
abootimg -x boot.img
you will see:
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
put the extracted initrd.img and bootimg.cfg to /arch/arm/boot(where your compiled zimage are)
run:
abootimg --create boot.img -f bootimg.cfg -k zImage -r initrd.img
You will get the boot.img!
This is the complete kernel!
Use any previous kernel zip, and replace the boot.img inside the zip with yours.
Flash it and test it.
My TWRP 2.8.0.0 or TWRP from freegee or Philz Touch will auto lokify the kernel.
Wing
Click to expand...
Click to collapse
Wow thank you so much... definitely going to give this a shot today! So I didn't have to download the 12 GB source... good to know.
Oh and one more thing. Is there any difference from building a CM11 kernel vs an AOSP 4.4.x kernel? I figured since most of our device's ROMs are CM based this would work fine... Thank you very much for the information at hand! Appreciated.
CM kernel is different from AOSP kernel from what i know.
CM kernel is base on CAF(which is optimized for msm chip) and AOSP kernel base on google original code.
They are a bit different so imcompatible from what i know.
Wing
When I compile there are loads of errors and eventually it stops (at different times each attempt...) anyway, the first thing I notice is this:
warning: (ARCH_MSM7X27 && ARCH_MSM8960 && ARCH_MSM8930 && ARCH_MSM8974) selects DONT_MAP_HOLE_AFTER_MEMBANK0 which has unmet direct dependencies (SPARSEMEM)
warning: (ARCH_MSM7X27 && ARCH_MSM8960 && ARCH_MSM8930 && ARCH_MSM8974) selects DONT_MAP_HOLE_AFTER_MEMBANK0 which has unmet direct dependencies (SPARSEMEM)
Is that anything I have to worry about? I can't find anything online about it. Thanks in advance.
First, is it unmodified cm kernel sources?
Make sure to use unmodified sources to test building first.
Somes errors can safely ignored.The msm8960 error can safty ignore. It has nothing to do with our device.
If it failed to build, try using option like -Xlint.
Sometimes, using older build of toolchain is easier to build, e.g.gcc4.7 or 4.8
Gcc 4.9 always failed to build e980 cm kernel.
mukwing said:
First, is it unmodified cm kernel sources?
Make sure to use unmodified sources to test building first.
Somes errors can safely ignored.The msm8960 error can safty ignore. It has nothing to do with our device.
If it failed to build, try using option like -Xlint.
Sometimes, using older build of toolchain is easier to build, e.g.gcc4.7 or 4.8
Gcc 4.9 always failed to build e980 cm kernel.
Click to expand...
Click to collapse
Ohhh okay. Yeah it's all unmodified and I've downloaded tons of "needed" packages (including most likely unnessesary ones too). I'm using a 4.9 GCC. That might be it. Okay thanks. I'll give another shot tomorrow when I have access to my VM.
Kernel has been successfully compiled. Check here for download and further discussion...
http://forum.xda-developers.com/optimus-g-pro/orig-development/kernel-e980-kernel-t2872514

Categories

Resources