[Kernelpatch][25.03.2011] Bluetooth battery drain fix - HD2 Android NAND Development

Hi all,
i think i have fixed the ugly bluetooth battery drain bug.
It works for me since yesterday evening. Battery drain is between 2ma and 5ma with GSM and BT enabled. Also the headset in my car works very well.
Base for my work was tytungs kernel git - i think it was v8, but not sure...
In this post you will find a patch file, the compiled kernel and the source files i have modified. I'm a absolutly beginner with compiling linux, so i am not sure that the patch file will work, diff has a realy big manual
http://gitorious.org/~tytung/linux-on-wince-htc/tytungs-hastarins-linux_on_wince_htc
Also i am not sure how this kernel will work with Sense roms, because Sense use btld which has the power saving features in the binary and not in the kernel.
Last but not least i will thank Charansingh for the work he has done on the BT problem and tytung for his kernel base.
If you like to test the kernel, please take also my modules, because i get with the precompiled files from tytung a version magic error.
Your feedback is highly appreciated.
Best regards
trilu
In this Post you will find the zip file for updating magldr
http://forum.xda-developers.com/showpost.php?p=12374073&postcount=7
Here you find the zip file for updating clk
http://forum.xda-developers.com/showpost.php?p=12378215&postcount=34
Just found another point to save 3 to 5ma more
I installed Typhoons CM7 Image and was wondering why me drain in standby was 7 to 10ma with BT enabled.
Yesterday with Charansingh's nightly it was arround 3 to 5ma.
The solution is to set the low power flag on brcm_patchram_plus in init.rc
service hciattach /system/bin/brcm_patchram_plus --enable_lpm --enable_hci \
--baudrate 3000000 --patchram /etc/firmware/bcm4329.hcd /dev/ttyHS0
Also seen that in a lot of images hciattach service is set in init.rc and init.htcleo.rc
In my experience the hciattach service should start only in init.rc, before bluetoothd service.

Wow!
Thank God for this.
Finally and hopefully this matter is solved.
Which Rom have you tested this kernel with?
Can I use the latest Tween's Rom?

ohohohohohoooooho!!!1
super man!! many many thanks
will try it now!

silverbluem said:
ohohohohohoooooho!!!1
super man!! many many thanks
will try it now!
Click to expand...
Click to collapse
pls report

I've tested with Charansingh CM7 nightly - but it should work with every rom which uses tytungs kernel v8 and is Gingerbread.
As mentioned, feedback for Froyo and Sense is welcome...

can anybody build a boot.img to flash via cwm?

mponte said:
can anybody build a boot.img to flash via cwm?
Click to expand...
Click to collapse
here you are magldr version; for cLK use fastboot flash:raw command. (you'll need your own initrd.gz or the one delivered with build).

seadersn said:
here you are magldr version; for cLK use fastboot flash:raw command. (you'll need your own initrd.gz or the one delivered with build).
Click to expand...
Click to collapse
i got cLK in Typhoon 2.8.0.
kernel is on a boot.img file to flash. can i only flash this file with cwm as is?
as i see the updater-script only updates the zImage file and modules
P.S.
what's about this?
Code:
package_extract_dir("boot", "/boot");
there is no boot folder, only zImage file

cLK version doesn't exist for now. i will make one, but this will take roundabout 4-6 hours, as i have to sleep a little bit now (only two hours the last 24h).

Works like a charm!! On hyperdroid cm7
thanks!!

how can i build a boot.img file for clk?

so great news...thanks a lot
i'll try it just now

Anyone try this on a sense rom yet? I'm running boy ppc rom has 60ma bt drain in stand by! !
Sent from my HTC HD2 using XDA Premium App

trilu said:
Hi all,
i think i have fixed the ugly bluetooth battery drain bug.
It works for me since yesterday evening. Battery drain is between 2ma and 5ma with GSM and BT enabled. Also the headset in my car works very well.
Base for my work was tytungs kernel git - i think it was v8, but not sure...
In this post you will find a patch file, the compiled kernel and the source files i have modified. I'm a absolutly beginner with compiling linux, so i am not sure that the patch file will work, diff has a realy big manual
http://gitorious.org/~tytung/linux-on-wince-htc/tytungs-hastarins-linux_on_wince_htc
Also i am not sure how this kernel will work with Sense roms, because Sense use btld which has the power saving features in the binary and not in the kernel.
Last but not least i will thank Charansingh for the work he has done on the BT problem and tytung for his kernel base.
If you like to test the kernel, please take also my modules, because i get with the precompiled files from tytung a version magic error.
Your feedback is highly appreciated.
Best regards
trilu
Click to expand...
Click to collapse
Hi trilu,
Great job.
Thank you.
Regarding diff command:
Code:
cd tytungs-hastarins-linux_on_wince_htc
git diff > ../bt.diff
{or}
git format-patch -o ../patches origin

trilu said:
how can i build a boot.img file for clk?
Click to expand...
Click to collapse
Create a folder including unyaffs, mkyaffs2image, unpack.sh, pack.sh, and boot.img (Get boot.img from cLK thread).
1. unpack.sh
Code:
if [ -f boot.img ]; then
rm -rf boot
mkdir boot
cd boot
../unyaffs ../boot.img
cd ..
rm -rf initrd
mkdir initrd
cd initrd
gzip -dc ../boot/initrd.gz | cpio -i
else
echo cannot find boot.img
fi
2. replace boot/zImage
3. pack.sh
Code:
cd initrd
find . | cpio -o -H newc | gzip -9 > ../boot/initrd.gz
cd ..
mkyaffs2image boot/ boot.img
Then you will get a modified boot.img.

5-7mA with WLAN, BT and GPS on MIUI 1.3.18 (Froyo 2.2.1)
Thank a lot

tytung said:
Create a folder including unyaffs, mkyaffs2image, unpack.sh, pack.sh, and boot.img (Get boot.img from cLK thread).
1. unpack.sh
Code:
if [ -f boot.img ]; then
rm -rf boot
mkdir boot
cd boot
../unyaffs ../boot.img
cd ..
rm -rf initrd
mkdir initrd
cd initrd
gzip -dc ../boot/initrd.gz | cpio -i
else
echo cannot find boot.img
fi
2. replace boot/zImage
3. pack.sh
Code:
cd initrd
find . | cpio -o -H newc | gzip -9 > ../boot/initrd.gz
cd ..
mkyaffs2image boot/ boot.img
Then you will get a modified boot.img.
Click to expand...
Click to collapse
trilu, can you make now a boot.img to test typhoon build?

If ur on clk and fastboot commands work i think u should be able to fastboot flash zimage zimage to update the kernel

is the hd2 now officially supported? cant see any news.. all devices have working RC2. what about official cyanogenmod for hd2 leo? cant see anything on their website

Evil_enc said:
is the hd2 now officially supported? cant see any news.. all devices have working RC2. what about official cyanogenmod for hd2 leo? cant see anything on their website
Click to expand...
Click to collapse
We'll never get official CM7 for the HD2 as the HD2 is not a native Android device, and there is licensing issues because of that.

Related

[DEV] Kernel 2.6.27-community (Version 1.4 - 03/11/09)

Disclaimer: For devs only. Updating to it will wipe your device. I am not responsible of any damage of any sort or data loss or anything. Alway do a nandroid backup before updating
Kernel android-msm-2.6.27-hero-community
The purpose of that community project is to have an optimized hero kernel based on HTC kernel sources.
Current release: 1.4 [download]
Features:
- compcache with ramzswap enabled
- /system/etc/init.d init scripts support
- some init script (firstboot, userinit)
- CIFS support
- Ext4 full support
- Removed DEBUG options
- All bluetooth options (don't know if needed ??)
- Droidwall support
- Pptp support (need testing)
- IP Gre tunnel module
- SquashFS 3.4
Links:
Git
Wiki
Issues tracker
Note: devs, as a community project, you patches or configuration corrections are welcomed. Feel free to submit.
Note: if anyone needs it, in the downloads section of the git there is the patch to apply to android-msm-2.6.27 sources so they compile for Hero.
Note: this kernel does not support modaco roms, the reason is that modaco rom is dependant of scripts called from kernel ramdisk, witch is not good. If you use Modaco rom, use teknologist kernel (http://ow.ly/yCxu) witch have similar tweaks
Changelog
Version 1.4 - Nov 3rd 2009
- added ext4 full support
- some init.d scripts (firstboot, userinit)
- squashfs 3.4
Version 1.3 - Nov 3rd 2009 (test build)
Version 1.2 - Nov 3rd 2009
- added ext4dev support (ext4 support in git, update.zip coming soon)
- added pptp support
- removed kernel debuging options
- added ramzswap init.d script
Version 1.1 - Oct 29th 2009
- added support for /data/init.sh script
- added support for /system/etc/init.d/* scripts
Version 1.0.1 - Oct 29th 2009
- fixed wlan.ko
Version 1.0 - Oct 28th 2009
- compcache 0.5.4 patch
- optimized config by Teknologist
Thanks for the hard work and more importantly sharing!..... this will be very useful once Ive got my oven sorted
Lox could you also post the version number of compcache that is integrated ? (and version numbers for future addons) cant wait to test the next release
Edit: Do i need to wipe the data before i update to this kernel? because i cant turn on wifi
whats the diff between AOSF CUPCAKE thread and this? these two projects do diff jobs? which will give us a basic android rom withot sense thing?
dying4004 said:
whats the diff between AOSF CUPCAKE thread and this? these two projects do diff jobs? which will give us a basic android rom withot sense thing?
Click to expand...
Click to collapse
This is the an optimized kernel to run any rom.
Lox_Dev said:
This is the an optimized kernel to run any rom.
Click to expand...
Click to collapse
WHOA!!!
LOX u have got really close in getting those nice roms and fancy stuffs in hero. so this is the base of all roms and fancy things.
CONGRATS BRO
New version 1.1.
Now you can have init scripts in /system/etc/init.d. /data/init.sh supported too.
To run Compache and have a really faster kernel, follow this how to. Busybox is needed (here is an update.zip to install it)
Lox_Dev said:
New version 1.1.
Now you can have init scripts in /system/etc/init.d. /data/init.sh supported too.
To run Compache and have a really faster kernel, follow this how to. Busybox is needed (here is an update.zip to install it)
Click to expand...
Click to collapse
could you also add little adb how-to for adding @ moving 05ramzswap file to init.d ?
i read all the references printed in first post, but there is nowhere a description of what has been optimized.. can someone please inform ;-)
felikz said:
i read all the references printed in first post, but there is nowhere a description of what has been optimized.. can someone please inform ;-)
Click to expand...
Click to collapse
second post maybe?
jaapschaap said:
second post maybe?
Click to expand...
Click to collapse
thats just the CHANGE LOG?
@ Lox_Dev
Thanks
This 05ramzswap script is correct?
#!/system/bin/sh
insmod /system/lib/modules/lzo_decompress.ko
insmod /system/lib/modules/lzo_compress.ko
insmod /system/lib/modules/compcache/xvmalloc.ko
/system/xbin/insmod /system/lib/modules/compcache/ramzswap.ko memlimit_kb=64200 backing_swap=/dev/block/mmcblk0p3
swapon /dev/block/ramzswap0
fi;
For building the rom, is correct added this line in update-script?
show_progress 0.5 0
show_progress 0.2 0
write_raw_image PACKAGE:boot.img BOOT:
show_progress 0.2 10
Thank you and sorry my english.
MACH_SAPPHIRE=y
Click to expand...
Click to collapse
Does this option is really necessary ?
thx lox, thread sticky
I managed to use nandroid's restoring method and put new boot.img back without any data wipe. Here is how I did it: Make a nandroid backup first, and copy the latest backup files to your computer, replace original boot.img to the new one(community version). Then edit the value of boot.img in nandroid.md5 to the proper content and match your new boot.img. Finally just restore it in recovery mode.
If the wireless function isn't working after boot, you may also need to push it via adb:
adb push wlan.ko /system/lib/modules/wlan.ko
adb shell sync
(reboot again)
foxfair said:
I managed to use nandroid's restoring method and put new boot.img back without any data wipe. Here is how I did it: Make a nandroid backup first, and copy the latest backup files to your computer, replace original boot.img to the new one(community version). Then edit the value of boot.img in nandroid.md5 to the proper content and match your new boot.img. Finally just restore it in recovery mode.
Click to expand...
Click to collapse
# adb push ./boot.img /sdcard
# adb shell flash_image boot /sdcard/boot.img
I little bit more fast... (but you should make a backup before)
Poischack said:
# adb push ./boot.img /sdcard
# adb shell flash_image boot /sdcard/boot.img
I little bit more fast... (but you should make a backup before)
Click to expand...
Click to collapse
i'm on RUU 2.73.x version, for some reason fastboot and adb push won't work... anyway I just provide an alternative way.
Lox did you try to upgrade to 2.6.29?
foxfair said:
Lox did you try to upgrade to 2.6.29?
Click to expand...
Click to collapse
Clone this git if you want to play:
git://android.git.kernel.org/kernel/msm.git branch android-msm-2.6.29
You WILL need to port over some of the drivers from the Hero kernel HTC released a while back (which was 2.6.27 btw).

[24.APR.2011][KERNEL] AA 0.6 OC [ext2/3/4,cifs,reiserfs,btrfs,nilfs,utf8][MAGLDR/cLK]

Use at your own risk, overclock at your own risk - I'm not responsible for damage to your device​
The kernel used in this ROM is based on MDJ S9.2, and have ported it, and have patched to the latest upstream with the relevant fixes
The git is available here, check logs and diffs for the changes made. There is a neat build script to get it compiled for yourself if you want as well in Linux or cygwin. I am using the test branch at the moment.
Howto cLK (kernel_aa_X.X.zip)
Click to expand...
Click to collapse
Download kernel
Unzip archive
run script.sh (linux) or script.bat (windows) to copy over the kernel modules to your phone (make sure adb is in your path)
grab the initrd.gz from your current rom
then, either
reboot phone into fastboot by holding the back key
run "fastboot -c "" -b 0x11800000 flash:raw boot zImage initrd.gz"
or
make boot.img by using "mkbootimg --kernel zImage --ramdisk initrd.gz --cmdline "console=null" --base 0x11800000 -o boot.img"
adb push boot.img /sdcard/
adb shell flash_image boot /sdcard/boot.img
reboot your phone
Howto MAGLDR CWM (kernel_aa_X.X.zip) & Howto cLK (kernel_aa_X.X_clk_ppp.zip)
Click to expand...
Click to collapse
Download kernel
copy archive onto the FAT partition of your SD card
reboot phone into CWM
Select Install zip from sdcard
Select choose zip from sdcard
Select the kernel from the SD
Select Yes to install the zip
reboot your phone
Differences between kernel_aa_X.X.zip and kernel_aa_X.X_clk_ppp.zip
Click to expand...
Click to collapse
my initrd (so has boot.img which will only work with cLK)
Added ppp specific stuff
Added 02recov, which allows to get ROM Manager working (works for me)
NOTE: The initrd may or may not work for everyone please report your problems with dmesg and logcat files
Thanks/credits
Click to expand...
Click to collapse
m-deejay
Cotulla (MAGLDR)
RaiderX303 (ClockworkMod)
cedesmith (cLK)
#htc-linux and #htc-linux-chat
All ROM users
Changelog
v0.6 (24/04/2011)
Add reiserfs support
Add NILFS support
Add btrfs support
v0.5 (21/03/2011)
Removed SMARTASS
Merged with master git
v0.4 (18/03/2011)
kernel patch to save reboot reason so is available on bootloader (credits to cedesmith)
v0.3 (01/03/2011)
Add back PPP support (to work with cLK)
Add cLK patches (credits to cedesmith)
more MDJ stuff config
v0.2 (14/02/2011)
re-cloned MDJ S9.2
Created branch test
Removed squashfs
Removed unnecessary PPP
Merged with master git
v0.1 (12/02/2011)
cloned MDJ S9.2
merged with master git
Previous Changelog from MDJ
Code:
S9.2:
- fixed wifi mac addresses ( http://www.gitorious.com/linux-on-wince-htc/linux_on_wince_htc/commit/4c31f2fb265ae68b82ed5e8ea4bec91208837011 )
S9.1:
- Initial Release
reserved another
Trying now
Sent from my HTC HD2 using XDA Premium App
Nice, thanks.....if i'm not wrong Mdj's kernel wasnt UV, right?
is it UV? afaik no
af974 said:
Nice, thanks.....if i'm not wrong Mdj's kernel wasnt UV, right?
Click to expand...
Click to collapse
afaik, it is not UV, I cannot see it in his changelogs
updated kernel see OP, changelog and git logs for details
Thanks so much. It's said that MDJ's kernel is extraordinary power-saving and low battery drainage. We have not seen Mr MDJ on the forum for quite a long time. We just hope you great guys to carry on the goodness of MDJ's kernel.
about time someone made a proper kernel for cLk ..thanks arif-ali
arif-ali said:
Use at your own risk, overclock at your own risk - I'm not responsible for damage to your device​
The kernel used in this ROM is based on MDJ S9.2, and have ported it, and have patched to the latest upstream with the relevant fixes
The git is available here, check logs and diffs for the changes made. There is a neat build script to get it compiled for yourself if you want as well in Linux or cygwin. I am using the test branch at the moment.
Download kernel
Unzip archive
run script.sh (linux) or script.bat (windows) to copy over the kernel modules to your phone (make sure adb is in your path)
grab the initrd.gz from your current rom
then, either
reboot phone into fastboot by holding the back key
run "fastboot -c "" -b 0x11800000 flash:raw boot zImage initrd.gz"
or
make boot.img by using "mkbootimg --kernel zImage --ramdisk initrd.gz --cmdline "console=null" --base 0x11800000 -o boot.img"
adb push boot.img /sdcard/
adb shell flash_image boot /sdcard/boot.img
reboot your phone
Download kernel
copy archive onto the FAT partition of your SD card
reboot phone into CWM
Select Install zip from sdcard
Select choose zip from sdcard
Select the kernel from the SD
Select Yes to install the zip
reboot your phone
my initrd (so has boot.img which will only work with cLK)
Added ppp specific stuff
Added 02recov, which allows to get ROM Manager working (works for me)
NOTE: The initrd may or may not work for everyone please report your problems with dmesg and logcat files
m-deejay
Cotulla (MAGLDR)
RaiderX303 (ClockworkMod)
cedesmith (cLK)
#htc-linux and #htc-linux-chat
All ROM users
Click to expand...
Click to collapse
Can you please make a cLK CWM Kernel of your to use with Typhoons build...
I have tried it this way and is not working and I think that the file structure for Typhoon builds is different that common build.
I would like to try this kernel. Is it possible plz?
zach.antre said:
Can you please make a cLK CWM Kernel of your to use with Typhoons build...
I have tried it this way and is not working and I think that the file structure for Typhoon builds is different that common build.
I would like to try this kernel. Is it possible plz?
Click to expand...
Click to collapse
what problems are you getting, any logcats or dmesg output
arif-ali said:
what problems are you getting, any logcats or dmesg output
Click to expand...
Click to collapse
it was stuck in bootscreen, i will try to send later.
Till then you can check the GL_Core kernel thread that had same issue
he made a Kernel for Typhoon builds and a kernel for all others.
you can see the differencies
arif-ali said:
what problems are you getting, any logcats or dmesg output
Click to expand...
Click to collapse
here is the logcat
@zach.antre
I have added the 0.5 kernel with wpa in OP, This is the only difference I see between my kernel and the GL kernel.
I haven't tested it, so not sure if it will work.
If you do test it, let me know how it goes.
thanks
arif-ali said:
@zach.antre
I have added the 0.5 kernel with wpa in OP, This is the only difference I see between my kernel and the GL kernel.
I haven't tested it, so not sure if it will work.
If you do test it, let me know how it goes.
thanks
Click to expand...
Click to collapse
I'll test it know, give 5 minutes and i'll report back
------------------EDIT---------------------------
After testing your kernel again i get the same issues.
System will not start, it is stuck in bootscreen.
You will find attached the logcat
I should mention that TyphooNs build is nonSense, it is CM7
Not many use this, but hey, might as well release it
updated kernel to
* Add reiserfs support
* Add NILFS support
* Add btrfs support
arif-ali said:
Not many use this, but hey, might as well release it
updated kernel to
* Add reiserfs support
* Add NILFS support
* Add btrfs support
Click to expand...
Click to collapse
Hey Arif, what exactly is reiserfs, nilfs, btrfs?
mattfmartin said:
Hey Arif, what exactly is reiserfs, nilfs, btrfs?
Click to expand...
Click to collapse
they are all file systems, similar to ext2/3/4, but some people prefer these instead
plus this is the basis for the recovery kernel as well that is available on RM, so more I can support, the better
arif-ali said:
Not many use this, but hey, might as well release it
updated kernel to
* Add reiserfs support
* Add NILFS support
* Add btrfs support
Click to expand...
Click to collapse
Hi Arif, thanks for all the good work!
1) Does this kernel work for GB, or only Froyo?
2) Does cLK version incorporate any of the new ppp wrapper stuff discussed in cedesmith's thread?
Thanks!
lukedunk said:
Hi Arif, thanks for all the good work!
1) Does this kernel work for GB, or only Froyo?
2) Does cLK version incorporate any of the new ppp wrapper stuff discussed in cedesmith's thread?
Thanks!
Click to expand...
Click to collapse
1a) personally, haven't tested this in GB, so not sure. zach.antre tested it with one of the GB roms, and didn't quite work. I still need to do some testing, to see exactly what is different to make it work. (but you can still test if you want the challenge)
1b) This kernel is used as a basis for CWR that is on RM, so the fact it works there, and the basis there is GB, I would have thought that it would work with GB, but I could be wrong
2) No, as the wrapper is still beta at the moment (and several people are still having problems). Once we know that is working effectively with no problems, I will have no problems in adding it in.

[GUIDE] How to build kernel from source

Overview
Here are the steps to build your own kernel from source. This example does nothing special. It just shows you how to build the stock kernel. It is a good starting point to making your own stuff. Experts, please correct me where I am wrong. This stuff is still new to me also.
These instructions work for both T989 (T-Mobile) and I727 (AT&T) variants of the Samsung Galaxy S2 phones.
Special Thanks
Special thanks to "interloper" and "dtm_stretch" for helping me learn all of this. Couldn't have done it without them.
Requirements
I am using Ubuntu 10.10 32-bit to do all my builds
Instructions
1) Get Samsung Source Code
First you need to get a copy of the kernel source code from Samsung. You can download it from the link below.
For T-Mobile users download the one that says T989:
https://opensource.samsung.com/reception/receptionSub.do?method=search&searchValue=SGH-T989
For AT&T users download the one that says SGH-I727:
https://opensource.samsung.com/reception/receptionSub.do?method=search&searchValue=SGH-I727
2) Unzip Samsung Source Code
Unzip the source code you just download with this command:
For T989:
Code:
unzip SGH-T989_GB_Opensource.zip
For I727:
Code:
unzip SGH-I727_ATT_Opensource.zip
There will be 4 files extracted. The one we are interested in for this exercise is SGH-T989_Kernel.tar.gz for T989 devicees or SGH-I727_ATT_Kernel.tar.gz for I727 devices.
3) Extract Kernel
Next we need to extract the kernel into a directory.
For T989:
Code:
mkdir kernel
tar xzf SGH-T989_Kernel.tar.gz -C kernel
or
For I727:
Code:
mkdir kernel
tar xzf SGH-I727_ATT_Kernel.tar.gz -C kernel
4) Get a Copy of initramfs
Next you need to get a copy of the initramfs for your phone. For T989 users you can get the stock initramfs from bubby323's github here: https://github.com/bubby323/anomaly_kernel_platform_SGH-T989
For I727 users you must use the alternate method below to get the initramfs. T989 users can choose to use the link above or go with the alternate method below.
Alternate method:
You can extract it yourself from an existing boot.img file. I got mine off of my phone using clockworkmod backup (boot.img file) and using the extractboot tool to extract the initramfs. The tool can be downloaded here: http://www.mediafire.com/?lc12eceeh617b97
Extract extractboot.tar.gz
Code:
tar xzf extractboot.tar.gz
Call this to extract your boot.img to get the initramfs folder
Code:
extractboot boot.img
If you get any errors with calling extractboot, make sure "extractboot" and "split_bootimg.pl" are executable first. If not, use "chmod a+x extractboot" (do the same for split_bootimg.pl).
Once extracted, the "out/ramdisk" folder is your extracted initramfs folder.
reference: http://www.freeyourandroid.com/guide/extract-edit-repack-boot-img-windows
5) Download Arm Toolchain
This toolchain will allow you to cross compile for your phone. There are several versions to choose. I currently use the 2010q1 version here: https://sourcery.mentor.com/sgpp/li...1-188-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
Or choose another version if you like (version 2009q3 seems to be popular): https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription3053
6) Extract Toolchain
Code:
tar xjf arm-2010q1-188-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
7) Download mkbootimg Tools
Download mkbootimg tools from here: http://www.mediafire.com/?w06d1m6n1dgo4op
Extract the file with
Code:
tar xzf mkboottools.tar.gz
There will be three files
Code:
mkbootfs
mkbootimg
mkbootimg-sg2x
"mkbootimg" is the original program to make the boot image but is not used for our phone. Our phone requires an edit to the ramdisk address which is why I also included "mkbootimg-sg2x" which we will use instead.
*Extra Info: the default ramdisk offset is 0x01000000 while our phone needs 0x01400000.
Move the three files to somewhere in your system PATH.
8) Compile Script
Now we are ready to compile the kernel. I have provided a script below to automate the process. You will need to change the paths to work with your environment.
*For I727 users only: change "msm8660_celox_usa_tmo_defconfig" to "msm8660_celox_usa_att_defconfig" in the script below.
*Update: Thanks to InstigatorX for his comment:
Also, for ATT the celox make command should be "make msm8660_celox_usa_att_rev02_defconfig" to make the latest 2.3.6 kernel.
Click to expand...
Click to collapse
Code:
INITRAMFSDIR=~/t989/initramfs
export ARCH=arm
export CROSS_COMPILE=~/arm-2010q1/bin/arm-none-eabi-
cd kernel
make clean
make mrproper
make msm8660_celox_usa_tmo_defconfig
make -j4
# copy the freshly compiled modules to the initramfs.
cp crypto/ansi_cprng.ko $INITRAMFSDIR/lib/modules/
cp drivers/bluetooth/bthid/bthid.ko $INITRAMFSDIR/lib/modules/
cp arch/arm/common/cpaccess.ko $INITRAMFSDIR/lib/modules/
cp arch/arm/mach-msm/dal_remotetest.ko $INITRAMFSDIR/lib/modules/
cp drivers/net/wireless/bcm4330/dhd.ko $INITRAMFSDIR/lib/modules/
cp arch/arm/mach-msm/dma_test.ko $INITRAMFSDIR/lib/modules/
cp drivers/input/evbug.ko $INITRAMFSDIR/lib/modules/
cp drivers/media/video/gspca/gspca_main.ko $INITRAMFSDIR/lib/modules/
cp arch/arm/perfmon/ksapi.ko $INITRAMFSDIR/lib/modules/
cp drivers/video/backlight/lcd.ko $INITRAMFSDIR/lib/modules/
cp drivers/net/wireless/libra/librasdioif.ko $INITRAMFSDIR/lib/modules/
cp drivers/misc/msm_tsif.ko $INITRAMFSDIR/lib/modules/
cp arch/arm/oprofile/oprofile.ko $INITRAMFSDIR/lib/modules/
cp drivers/crypto/msm/qcedev.ko $INITRAMFSDIR/lib/modules/
cp drivers/crypto/msm/qce.ko $INITRAMFSDIR/lib/modules/
cp drivers/crypto/msm/qcrypto.ko $INITRAMFSDIR/lib/modules/
cp drivers/scsi/scsi_wait_scan.ko $INITRAMFSDIR/lib/modules/
cp drivers/spi/spidev.ko $INITRAMFSDIR/lib/modules/
cp drivers/misc/tsif_chrdev.ko $INITRAMFSDIR/lib/modules/
cp drivers/misc/vibetonz/vibrator.ko $INITRAMFSDIR/lib/modules/
9) Get Compiled Kernel
The compiled kernel image is in the kernel source folder under "arch/arm/boot/zImage"
Copy the zImage file to a working area, preferably where you keep your initramfs folder.
Here is an example folder structure:
Code:
work
- zImage
- initramfs
10) Make boot.img File
Next we need to merge the kernel and initramfs directory into a boot.img file.
zip up ramdisk
Code:
mkbootfs initramfs | gzip > ramdisk.gz
make boot image
Code:
mkbootimg-sg2x --kernel zImage --ramdisk ramdisk.gz --cmdline "androidboot.hardware=qcom msm_watchdog.appsbark=0 msm_watchdog.enable=1 loglevel=4" -o boot.img --base 0x40400000 --pagesize 2048
11) tar boot.img
Tar your boot.img file so it can be flashed with Odin.
Code:
tar cvf MyKernel.tar boot.img
md5sum -t MyKernel.tar >> MyKernel.tar
mv MyKernel.tar MyKernel.tar.md5
12) Flash with Odin
Flash MyKernel.tar.md5 with odin under PDA. Please follow the flashing guides found in other posts. They do a better job at explaining.
13) Experiment *
Now try to customize your kernel to add in new features and experiment. I am going to learn how to compile the stock platform also. Once I know how I will post up a guide for that also. If someone already has a guide to build the platform please post. Also it would be great if you can post sources for me to read so I can learn how to build the platform. Thanks.
Optional
You might notice that the modules you compiled are significantly bigger than the original stock modules that came with the phone. That is because the stock modules were stripped of all debug info. To do this you need to run the below command at the end to get the "stripped" modules. Change INSTALL_MOD_PATH to point to any folder you like to hold the modules. You then need to copy these modules instead of the ones in the build script above.
Code:
make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=~/stripped/modules modules_install
What's Next?
Go here to learn how to start making changes to your ROM: http://forum.xda-developers.com/showthread.php?p=23343879
Good heads up. Thanks for putting this out there.
Once edited this needs to get stuckod
Sent from my SGH-T989 using xda premium
Thanks so much for this! I've been trying to figure this out for months. (Learned alot in that time).
Kernel Built!
Daunting....ill stick to this side of the fence
Thanks though. Must be tough explaining all of that...
Sent from my Phablet. The Purple Phone Tablet.
Great info !! Super !
Some questions: 1. How does one allow for SELECTION of custom boot animation? Is that a kernel thing or some thing else?
2. What about adding things like Voodoo Sound or some mod like that?
Thanks for any info !!
chappatti said:
Great info !! Super !
Some questions: 1. How does one allow for SELECTION of custom boot animation? Is that a kernel thing or some thing else?
2. What about adding things like Voodoo Sound or some mod like that?
Thanks for any info !!
Click to expand...
Click to collapse
I am glad you like it. I wanted to post this guide up so that noobs like me have a good starting point to learn this stuff.
I can take a crack at answering your questions, but do note that I am also a noob:
1) I would think a custom boot animation would be part of the ROM but not sure
2) I do not know what Voodoo Sound is but if it is an application then it would be modifying the ROM. If it is an enhancement to the audio drivers then it is kernel. Either way I would not know what to change. Sorrry.
I know I wasn't much help. But I tried
By the way, I am currently trying to learn how to make my own custom ROM. If you know of any guides that would be great if you can post them here. I will definitely post what I find. Currently I am downloading ROMs from this forum and seeing what they did to learn. One thing I am still confused about is if these guys built these ROM from source or used the binaries from the Stock ROM as base.
Thanks.
Nice Guide man...
datzstr8 said:
I am glad you like it. I wanted to post this guide up so that noobs like me have a good starting point to learn this stuff.
I can take a crack at answering your questions, but do note that I am also a noob:
1) I would think a custom boot animation would be part of the ROM but not sure
2) I do not know what Voodoo Sound is but if it is an application then it would be modifying the ROM. If it is an enhancement to the audio drivers then it is kernel. Either way I would not know what to change. Sorrry.
I know I wasn't much help. But I tried
By the way, I am currently trying to learn how to make my own custom ROM. If you know of any guides that would be great if you can post them here. I will definitely post what I find. Currently I am downloading ROMs from this forum and seeing what they did to learn. One thing I am still confused about is if these guys built these ROM from source or used the binaries from the Stock ROM as base.
Thanks.
Click to expand...
Click to collapse
Roms such as AOKP or CM are compiled from source, otherwise known as AOSP. However, the majority of the roms you'll find here are not. To build a non-source rom a good starting point would be a system dump from your own phone, or find a pre-deodexed, stock base rom. From there, the tool of the trade is 7zip. View all the file via 7zip, pull files and modify. Now obviously, this is only a starting point, couldn't possibly go into advanced development with you. It takes time to learn and it's a lot of trial and error. Another helpful tool to learn is ADB commands and functionality. If you know this, it will save you a lot of time. Good luck!
This guide is a life-saver. I have compiled my own kernel for my desktop literally dozens of times, and have built distributions entirely from scratch two or three times (using Linux From Scratch), but was unable to figure this out myself due to the lack of a guide and things being scattered everywhere and people unwilling to help.
THANK YOU!!!!
I am really looking forward to your guide on how to build an Android system from scratch. I have also been trying to do this as well (Cyanogen), but am running into the same lack of information.
sombionix said:
Roms such as AOKP or CM are compiled from source, otherwise known as AOSP. However, the majority of the roms you'll find here are not. To build a non-source rom a good starting point would be a system dump from your own phone, or find a pre-deodexed, stock base rom. From there, the tool of the trade is 7zip. View all the file via 7zip, pull files and modify. Now obviously, this is only a starting point, couldn't possibly go into advanced development with you. It takes time to learn and it's a lot of trial and error. Another helpful tool to learn is ADB commands and functionality. If you know this, it will save you a lot of time. Good luck!
Click to expand...
Click to collapse
So Som,
When are we going to see another nice Bionix build from you. anything in plan or not really.
An automation script would be a juicy treat and i may have just the thing...will need to be modified for this and tested but tomorrow (today, oh look at the time) i can put it together. Also, try building using make gconfig. Load your default config with the gui and you can see what bits of the kernel can be changed.
Sent from my SPH-D710 using xda premium
Very nice guide! Thanks a lot!
I wondering about what is the difference between Hercules and Skyrocket sources? Is it only this "*For I727 users only: change "msm8660_celox_usa_tmo_defconfig" to "msm8660_celox_usa_att_defconfig" in the script below." ?
erickwill said:
Very nice guide! Thanks a lot!
I wondering about what is the difference between Hercules and Skyrocket sources? Is it only this "*For I727 users only: change "msm8660_celox_usa_tmo_defconfig" to "msm8660_celox_usa_att_defconfig" in the script below." ?
Click to expand...
Click to collapse
You will still need the proper source for i727. Config file just tells the compiler what to build.
:: LOVE MY HATERS :: DARKSIDE ::
These instructions assume the user already has the boot.img tools, bubby's initramfs and source code from the OP
1. Create a directory called t989-kernel
2. Download this package of tool chains and unzip it, making sure it is named "toolchains" toolchains
NOTE: There are many toolchains included in this pack and I have used them all to make kernel for the E4GT and they are all
sufficient for this task. However, should you move on to 3.X kernel I suggest using the Mjolnar or Linaro tools as they
are more suitable for that version.
3. Inside the "t989" directory deposit bubby's initramfs, the kernel source (extracted directory), toolchains and boot.img tools.
4. The names of the directories must be "ramdisk", "kernel" (kernel source), "toolchain", and "bin". Change them accordingly.
5. Put the attached "tmo-build.sh" into the "kernel" directory
6. Edit line 9 to reflect you version number and name. It will be what you see when you look at the phone properties
7. Change line 20 of the script to reflect your machine's name
8. cd into "kernel"
9. Type "./tmo-build.sh" and watch the magic as your kernel is made right before your eyes!
10. Go to "kernel_tmp/out" and get your shiny new homemade kernel complete with custom recovery and all the fixins'
NOTE: You can change line 41 to say "make gconfig" if you have GTK2 installed on your system. This will allow you to launch a GUI
through the script to make changes in a visual manner. If you get any "file not found" or "no such file" etc, make sure the
permissions are set to executable for all directories/files.
I'm still working on the error logging output so I will post an updated script as soon as it's ready. For the i727 users I will post a script for you too, but to make this work for you all you need to do is choose the make gconfig route and load your def_config from /arch/arm/configs/
Enjoy the silence!
interloper, thanks for the great script!!! This will help a lot of people.
afawzi said:
So Som,
When are we going to see another nice Bionix build from you. anything in plan or not really.
Click to expand...
Click to collapse
+1
From a galaxy better than yours.
I am starting another GUIDE post on how to modify your ROM here: http://forum.xda-developers.com/showthread.php?p=23343879
Sweet guide. Worked great. Only thing I had issue with was Haptic feedback and WiFi wouldn't work. Any ideas? I'm on the SkyRocket.
Also, for ATT the celox make command should be "make msm8660_celox_usa_att_rev02_defconfig" to make the latest 2.3.6 kernel.
how do you make it cwm flashable?

[Q] How do I go from ICS to CM7?

Hi Guys...
I really can't figure out how I go about installing CM7.2 on my arc again, after upgrading to BaseBand70 + ICS.
I tried a lot of different stuff and what ussually happens, is when I install the CM bootmloader, the phone won't turn on and the screen keeps on being black.
Right now I have the Arconium rom installed and it works fine, but I miss the smootness and the awesome battery life I had on with CM7.2
I've tried to install various tft files flashtool, but the only thing I can get to work is the BB70 one.
Hope you guys can help
You can return to CM7 but you must flash CM7 kernel with flash tool.
view topic : here
fabou said:
You can return to CM7 but you must flash CM7 kernel with flash tool.
view topic : here
Click to expand...
Click to collapse
Thanks...
But I have already tried that and that doesn't work... I thought it was because I needed to flash an older baseband or something similar?
i think the baseband is not linked with the kernel, but you can flash the kernel and you can upgrade baseband.
Did you try the FXP117 kernel? maybe the kernel work, it's a bluid problem.
On CM9 I had the same problem .
adrianom said:
Guys,
The problem of boot image is again in ramdisk, and is only a build problem, I extract the 117 boot.img and only recompress and work.
If someone wants to build for other devices, the command to build the boot.img, is:
Use unpack-bootimg.pl to extract the boot.img:
Code:
unpack-bootimg.pl boot.img
Rebuild the ramdisk:
Code:
cd boot_117.img-ramdisk
find . -name ".DS_Store" -depth -exec rm {} \;
find . | cpio -o -H newc | gzip > ../ramdisk.cpio.gz;
cd ..
Rebuild the boot.img:
Code:
mkbootimg --base 0x00200000 --kernel boot_117.img-kernel --ramdisk ramdisk.cpio.gz -o boot.img
Ps.: the script above is for Mac, but should also work for Linux.
Attached below is the fix boot.img.
Click to expand...
Click to collapse
WARNING : this quote is for CM9!!
follow this thread and maybe it will have a patch

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