[HOWTO][SIMPLER]Compile your own kernel from source

Search This thread

#define

Senior Member
May 1, 2012
2,025
2,180
Hey guys..
With all the awesome development thats been going on for our device, many people have been inspired to start their own versions of android development.. But, most of them do not know where to begin, or how to begin.. Or they may have some questions that remained unanswered..
Hence, I present to you(on a few requests), a simple and newbie friendly guide to compiling your own kernel for the HTC Explorer(Pico)..

Now I understand there is a custom kernel/custom ROM compiling tutorial by sakindia123 right here.. But, it has proven a little too complicated for some of the people starting out in the Android world..

I'll be making it as simple as possible..


-------------------------------------

Alright..
In order to start compiling kernels and/or ROMS, we need a certain prerequisites to be obtained...

1) A Unix based OS..
a) Ubuntu - Preferably latest, which is 12.10 as of right now.. Both 32-bit and 64-bit versions are OK for compiling kernels.. For ROMs you need 32-bit for Froyo and below, and 64-bit for Gingerbread and higher.. Beware that installing a 32-bit version twice will NOT make it a 64-bit version..

b) MacOS - Apple's very own OS.. Not much info about this with me..

2) Some knowledge to move around a Unix based system using the terminal..

3) A few packages, to let the system know we are trying to compile a kernel on it..

4) The source code of the kernel you want to compile.. There are various kernel sources you can compile from.. There's the stock HTC source, for Sense and Sense-based ROMs, there's the 2.6.38 custom kernel source by lirokoa, there's Garuda kernel source by flowish, and the more recent, 3.0.16 kernel source..

5) Some time on our hands, and patience..

-----------------------------------------------------------

Ok.. Now we begin our work..

First, we install the required packages in our Ubuntu setup.. To do that, fire up a terminal window, and type :
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 git

Now, I myself do not know what these packages exactly do.. All I know is that they help us get our work done, ie, kerneling.. :cowboy:

Now, if you're using Ubuntu 12.04, you many need to create links of certain files, in order for them to work properly.. Run :
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Now, it's a good idea to start fresh.. So go ahead and reboot the system.. :good:

---------------------------------------------------------------------

Alright.. So now we have our packages..

Next, we need Java...

Now, in the world of Android, for us Pico users, Java 7 is of no use.. And Java 6 cannot be installed using the "conventional" methods..
So, we'll install Java 6 using the PPA feature..

Fire up a terminal on your newly rebooted system, and type :
Code:
sudo add-apt-repository ppa:ferramroberto/java

Next, run :
Code:
sudo apt-get update

Now that the repository is added and updated in our system, we'll install Java by running :
Code:
sudo apt-get-install sun-java6-jdk

This will install the correct version of Java in our system..

-----------------------------------------------------------------------------

Next up, obtaining the source, boot image tools and toolchain to compile.. You can obtain all the sources I mentioned above using Github.. Except the HTC source, which you'll find at htcdev.com ...

Boot image tools - https://github.com/sakindia123/boot-image-tools

The toolchain, you can get from here - http://www.github.com/sakindia123/android_toolchains

Once you download everything, extract it someplace.. Now, in terminal, do :
Code:
gedit .bashrc

And add(at the end) :
Code:
export PATH=${PATH}:path/to/toolchain/folder/arm-eabi-4.4.3/bin
export PATH=${PATH}:path/to/bootimagetools/folder/tools

Now close and re-open the terminal, and you're all set to compile..

-----------------------------------------------------------------------------

Now comes the fun part... Compiling the kernel...

This part I'm gonna describe in numbered steps... The path(assumed) I'm gonna take, is '~/android/kernel_source'.. And I'm assuming you are in the top of the kernel source directory...

1) You need to pull the kernel config from your phone.. To do that, connect your phone using ADB, and run :
Code:
adb pull proc/config.gz ~/android/kernel_source

2) Next, you need to extract the kernel config from the compressed file..
Code:
zcat config.gz > .config

3) Now, we have the .config file directly, so we can omit the "defconfig" command..

3a) If you wanna run the defconfig, then omit steps 1 and 2, and instead run :
Code:
make ARCH=arm CROSS_COMPILE=arm-eabi- msm7627a_defconfig  ---> For Sense kernel

make ARCH=arm CROSS_COMPILE=arm-eabi- htc_pico_defconfig ----> For lirokoa's and flowish's kernel source

make ARCH=arm CROSS_COMPILE=arm-eabi- pico_defconfig -----> For 3.0.16 kernel..

4) Now, we run the main compiling command :
Code:
make ARCH=arm CROSS_COMPILE=arm-eabi- -jX

The X can be replaced by the maximum number of jobs your computer can handle simultaneously.. The higher this number, the faster the compiling will get.. But do not enter a number too high, your computer may explode due to overheating.. Wouldnt want that, would we??

5) If all goes well, at the end of 15-mins to 1 hour(depending on your PC hardware), you'll have a zImage...

6) Now, we create a working directory :
Code:
mkdir workspace

7) Next, we copy our zImage to the working directory :
Code:
cp arch/arm/boot/zImage workspace

8) Next up, modules..
Code:
find . -name '*ko' -exec cp '{}' workspace \;

9) Now, we take a working boot.img from a ROM zip.. We do this for the ramdisk.. But keep in mind that different ROMs have different ramdisks.. For eg, a kernel made with CM9 ramdisk will not work on CM10.. So take the boot.img from the ROM you wanna use the kernel on..

10) We unpack the boot.img :
Code:
unpackbootimg -i boot.img

When we do this, we'll get a lot of files.. We only need the file named 'boot.img-ramdisk.gz'..

11) Finally, we make a new boot.img file, which will incorporate our compiled zImage, and the ramdisk we just extracted..
Code:
mkbootimg --kernel zImage --ramdisk boot.img-ramdisk.gz --cmdline no_console_suspend=1-console=null --base 12c00000 --output boot-new.img

And Voila!! We have a freshly compiled kernel, 'boot-new.img'..

12) To use it, put your phone in fastboot mode, and run :
Code:
fastboot flash boot boot-new.img

13) Now do not reboot the phone... Boot the phone in recovery mode, mount system from the recovery, connect the phone to PC, and then run :
Code:
$ adb remount

$ adb push '*ko' system/lib/modules ----> run this from the directory where you copied all the modules

$ adb reboot

And there you have it, your very own kernel..

----------------------------------------------------------------

Ok.. Sometimes you may get weird errors when trying to connect your phone to your computer via ADB... Its mostly a permission problem.. Fortunately, instead of running ADB as root, we have another solution..

Fire up a terminal, and type :
Code:
$ sudo gedit /etc/udev/rules.d/51-android.rules

A file will open up.. Add the following content into that file and save it :
Code:
###################################################### 
#  Project:  http://code.google.com/p/51-android/    #
#  File:     /etc/udev/rules.d/51-android.rules      #
#  Author:   snowdream     #
#  Date:     2010.06.07                              #
######################################################

#Acer
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0660", OWNER="snowdream"


#ASUS
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0660", OWNER="snowdream"


#Dell
SUBSYSTEM=="usb", ATTRS{idVendor}=="413", MODE="0660", OWNER="snowdream"


#Foxconn
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0660", OWNER="snowdream"


#Fujitsu/Fujitsu Toshiba
SUBSYSTEM=="usb", ATTRS{idVendor}=="04c5", MODE="0660", OWNER="snowdream"


#Garmin-Asus
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0660", OWNER="snowdream"


#Google
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0660", OWNER="snowdream"


#Hisense
SUBSYSTEM=="usb", ATTRS{idVendor}=="109b", MODE="0660", OWNER="snowdream"

#HTC
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0660", OWNER="snowdream"

#HTC HERO


#Huawei
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0660", OWNER="snowdream"


#K-Touch
SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0660", OWNER="snowdream"


#KT Tech
SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0660", OWNER="snowdream"


#Kyocera
SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0660", OWNER="snowdream"


#Lenovo
SUBSYSTEM=="usb", ATTRS{idVendor}=="2006", MODE="0660", OWNER="snowdream"


#LG
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0660", OWNER="snowdream"


#Motorola
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0660", OWNER="snowdream"


#NEC
SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0660", OWNER="snowdream"


#Nook
SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0660", OWNER="snowdream"


#Nvidia
SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0660", OWNER="snowdream"


#OTGV
SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0660", OWNER="snowdream"


#Pantech
SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0660", OWNER="snowdream"


#Pegatron
SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0660", OWNER="snowdream"


#Philips
SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0660", OWNER="snowdream"


#PMC-Sierra
SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0660", OWNER="snowdream"


#Qualcomm
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0660", OWNER="snowdream"


#SK Telesys
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0660", OWNER="snowdream"


#Samsung
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0660", OWNER="snowdream"


#Sharp
SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0660", OWNER="snowdream"


#Sony
SUBSYSTEM=="usb", ATTRS{idVendor}=="054c", MODE="0660", OWNER="snowdream"


#Sony Ericsson
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0660", OWNER="snowdream"


#Teleepoch
SUBSYSTEM=="usb", ATTRS{idVendor}=="2340", MODE="0660", OWNER="snowdream"


#Toshiba
SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0660", OWNER="snowdream"


#ZTE
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0660", OWNER="snowdream"

Note : Replace "snowdream" with your username.. Keep the double quotes..

Now, we need to give executing permissions to this file.. So :
Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

$ sudo service udev restart

And this will solve the permission problem when connecting through ADB or FASTBOOT...
 
Last edited:

Neel.Aryan

Senior Member
Oct 31, 2012
159
33
29
Kolkata
OnePlus 6T
In ubuntu 12.10, folks might face problem (as i faced) while typing adb commands. It might say, "No permission for this device."
Or, when someone types, adb devices, it might say...
List of attached devices
???????? No Permissions

Required to add rules to get past this issue.

Sent from my HTC Explorer A310e using xda app-developers app
 
  • Like
Reactions: #define

#define

Senior Member
May 1, 2012
2,025
2,180
Thanks .. sorry limited to 8 thanks . Lol wtf. Good guide bro.

Sent from my HTC Explorer A310e using xda app-developers app

Thank you.. thanks meter aint important bro... dont worry...
PS : The xda mobile app isnt limited to 8 thanks... :D:p

Sent from my HTC Explorer A310e using Tapatalk 2
 

#define

Senior Member
May 1, 2012
2,025
2,180
In ubuntu 12.10, folks might face problem (as i faced) while typing adb commands. It might say, "No permission for this device."
Or, when someone types, adb devices, it might say...


Required to add rules to get past this issue.

Sent from my HTC Explorer A310e using xda app-developers app

Damn.. How did i miss that?? Updating... Thanks...
 

Red Devil

Senior Member
Oct 25, 2012
1,355
2,494
Mumbai
Oh really ?It comes action failed contact forum administrator...
Oops sorry for spam..
BTW 12.10 Ubuntu .. and other platforms ? What some other examples?

Oh crap my bad had already thanked . :silly:
Sent from my HTC Explorer A310e using xda app-developers app
 
Last edited:

#define

Senior Member
May 1, 2012
2,025
2,180
Oh really ?It comes action failed contact forum administrator...
Oops sorry for spam..
BTW 12.10 Ubuntu .. and other platforms ? What some other examples?

Oh crap my bad had already thanked . :silly:
Sent from my HTC Explorer A310e using xda app-developers app

Lots... arch linux, bbq linux, mint, fedora, older versions of ubuntu, such as 10.04, 11.10, 12.04, etc...
Mac os can compile upto lion... i havent found anything for mountain lion...

Sent from my HTC Explorer A310e
 
  • Like
Reactions: Red Devil

chikanchilly

Senior Member
Jul 21, 2012
504
180
Mumbai
Lots... arch linux, bbq linux, mint, fedora, older versions of ubuntu, such as 10.04, 11.10, 12.04, etc...
Mac os can compile upto lion... i havent found anything for mountain lion...

Sent from my HTC Explorer A310e

For no permission...
Type
sudo -s

Then
adb kill-server
adb start-server
adb devices

Sent from my potato with a microchip
 

#define

Senior Member
May 1, 2012
2,025
2,180
i have pc wid windows 8 pro
can u guide me to make it work on my pc??

Sorry bro... any compilation related work of android needs to be done on Ubuntu only... cant be done on windows... you'll have to figure out how to install ubuntu on your pc... its not really that difficult..

Sent from my HTC Explorer A310e
 
  • Like
Reactions: Rishik999

KiranP23

Senior Member
Jul 28, 2012
244
46
Sir , when i try to sync gith i get following error

Code:
root@HomePC:~# cd ..
root@HomePC:/home# mkdir Toolchains
root@HomePC:/home# git init
Initialized empty Git repository in /home/.git/
root@HomePC:/home# git remote add origin git@github.com:AdiPat/Android_Toolchains.git
root@HomePC:/home# git clone git@github.com:AdiPat/Android_Toolchains.git
Cloning into 'Android_Toolchains'...

Permission denied (publickey).
fatal: The remote end hung up unexpectedly
root@HomePC:/home# 
root@HomePC:/home#
 

Top Liked Posts

  • There are no posts matching your filters.
  • 55
    Hey guys..
    With all the awesome development thats been going on for our device, many people have been inspired to start their own versions of android development.. But, most of them do not know where to begin, or how to begin.. Or they may have some questions that remained unanswered..
    Hence, I present to you(on a few requests), a simple and newbie friendly guide to compiling your own kernel for the HTC Explorer(Pico)..

    Now I understand there is a custom kernel/custom ROM compiling tutorial by sakindia123 right here.. But, it has proven a little too complicated for some of the people starting out in the Android world..

    I'll be making it as simple as possible..


    -------------------------------------

    Alright..
    In order to start compiling kernels and/or ROMS, we need a certain prerequisites to be obtained...

    1) A Unix based OS..
    a) Ubuntu - Preferably latest, which is 12.10 as of right now.. Both 32-bit and 64-bit versions are OK for compiling kernels.. For ROMs you need 32-bit for Froyo and below, and 64-bit for Gingerbread and higher.. Beware that installing a 32-bit version twice will NOT make it a 64-bit version..

    b) MacOS - Apple's very own OS.. Not much info about this with me..

    2) Some knowledge to move around a Unix based system using the terminal..

    3) A few packages, to let the system know we are trying to compile a kernel on it..

    4) The source code of the kernel you want to compile.. There are various kernel sources you can compile from.. There's the stock HTC source, for Sense and Sense-based ROMs, there's the 2.6.38 custom kernel source by lirokoa, there's Garuda kernel source by flowish, and the more recent, 3.0.16 kernel source..

    5) Some time on our hands, and patience..

    -----------------------------------------------------------

    Ok.. Now we begin our work..

    First, we install the required packages in our Ubuntu setup.. To do that, fire up a terminal window, and type :
    Code:
    sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 git

    Now, I myself do not know what these packages exactly do.. All I know is that they help us get our work done, ie, kerneling.. :cowboy:

    Now, if you're using Ubuntu 12.04, you many need to create links of certain files, in order for them to work properly.. Run :
    Code:
    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

    Now, it's a good idea to start fresh.. So go ahead and reboot the system.. :good:

    ---------------------------------------------------------------------

    Alright.. So now we have our packages..

    Next, we need Java...

    Now, in the world of Android, for us Pico users, Java 7 is of no use.. And Java 6 cannot be installed using the "conventional" methods..
    So, we'll install Java 6 using the PPA feature..

    Fire up a terminal on your newly rebooted system, and type :
    Code:
    sudo add-apt-repository ppa:ferramroberto/java

    Next, run :
    Code:
    sudo apt-get update

    Now that the repository is added and updated in our system, we'll install Java by running :
    Code:
    sudo apt-get-install sun-java6-jdk

    This will install the correct version of Java in our system..

    -----------------------------------------------------------------------------

    Next up, obtaining the source, boot image tools and toolchain to compile.. You can obtain all the sources I mentioned above using Github.. Except the HTC source, which you'll find at htcdev.com ...

    Boot image tools - https://github.com/sakindia123/boot-image-tools

    The toolchain, you can get from here - http://www.github.com/sakindia123/android_toolchains

    Once you download everything, extract it someplace.. Now, in terminal, do :
    Code:
    gedit .bashrc

    And add(at the end) :
    Code:
    export PATH=${PATH}:path/to/toolchain/folder/arm-eabi-4.4.3/bin
    export PATH=${PATH}:path/to/bootimagetools/folder/tools

    Now close and re-open the terminal, and you're all set to compile..

    -----------------------------------------------------------------------------

    Now comes the fun part... Compiling the kernel...

    This part I'm gonna describe in numbered steps... The path(assumed) I'm gonna take, is '~/android/kernel_source'.. And I'm assuming you are in the top of the kernel source directory...

    1) You need to pull the kernel config from your phone.. To do that, connect your phone using ADB, and run :
    Code:
    adb pull proc/config.gz ~/android/kernel_source

    2) Next, you need to extract the kernel config from the compressed file..
    Code:
    zcat config.gz > .config

    3) Now, we have the .config file directly, so we can omit the "defconfig" command..

    3a) If you wanna run the defconfig, then omit steps 1 and 2, and instead run :
    Code:
    make ARCH=arm CROSS_COMPILE=arm-eabi- msm7627a_defconfig  ---> For Sense kernel
    
    make ARCH=arm CROSS_COMPILE=arm-eabi- htc_pico_defconfig ----> For lirokoa's and flowish's kernel source
    
    make ARCH=arm CROSS_COMPILE=arm-eabi- pico_defconfig -----> For 3.0.16 kernel..

    4) Now, we run the main compiling command :
    Code:
    make ARCH=arm CROSS_COMPILE=arm-eabi- -jX

    The X can be replaced by the maximum number of jobs your computer can handle simultaneously.. The higher this number, the faster the compiling will get.. But do not enter a number too high, your computer may explode due to overheating.. Wouldnt want that, would we??

    5) If all goes well, at the end of 15-mins to 1 hour(depending on your PC hardware), you'll have a zImage...

    6) Now, we create a working directory :
    Code:
    mkdir workspace

    7) Next, we copy our zImage to the working directory :
    Code:
    cp arch/arm/boot/zImage workspace

    8) Next up, modules..
    Code:
    find . -name '*ko' -exec cp '{}' workspace \;

    9) Now, we take a working boot.img from a ROM zip.. We do this for the ramdisk.. But keep in mind that different ROMs have different ramdisks.. For eg, a kernel made with CM9 ramdisk will not work on CM10.. So take the boot.img from the ROM you wanna use the kernel on..

    10) We unpack the boot.img :
    Code:
    unpackbootimg -i boot.img

    When we do this, we'll get a lot of files.. We only need the file named 'boot.img-ramdisk.gz'..

    11) Finally, we make a new boot.img file, which will incorporate our compiled zImage, and the ramdisk we just extracted..
    Code:
    mkbootimg --kernel zImage --ramdisk boot.img-ramdisk.gz --cmdline no_console_suspend=1-console=null --base 12c00000 --output boot-new.img

    And Voila!! We have a freshly compiled kernel, 'boot-new.img'..

    12) To use it, put your phone in fastboot mode, and run :
    Code:
    fastboot flash boot boot-new.img

    13) Now do not reboot the phone... Boot the phone in recovery mode, mount system from the recovery, connect the phone to PC, and then run :
    Code:
    $ adb remount
    
    $ adb push '*ko' system/lib/modules ----> run this from the directory where you copied all the modules
    
    $ adb reboot

    And there you have it, your very own kernel..

    ----------------------------------------------------------------

    Ok.. Sometimes you may get weird errors when trying to connect your phone to your computer via ADB... Its mostly a permission problem.. Fortunately, instead of running ADB as root, we have another solution..

    Fire up a terminal, and type :
    Code:
    $ sudo gedit /etc/udev/rules.d/51-android.rules

    A file will open up.. Add the following content into that file and save it :
    Code:
    ###################################################### 
    #  Project:  http://code.google.com/p/51-android/    #
    #  File:     /etc/udev/rules.d/51-android.rules      #
    #  Author:   snowdream     #
    #  Date:     2010.06.07                              #
    ######################################################
    
    #Acer
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0660", OWNER="snowdream"
    
    
    #ASUS
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0660", OWNER="snowdream"
    
    
    #Dell
    SUBSYSTEM=="usb", ATTRS{idVendor}=="413", MODE="0660", OWNER="snowdream"
    
    
    #Foxconn
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0660", OWNER="snowdream"
    
    
    #Fujitsu/Fujitsu Toshiba
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04c5", MODE="0660", OWNER="snowdream"
    
    
    #Garmin-Asus
    SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0660", OWNER="snowdream"
    
    
    #Google
    SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0660", OWNER="snowdream"
    
    
    #Hisense
    SUBSYSTEM=="usb", ATTRS{idVendor}=="109b", MODE="0660", OWNER="snowdream"
    
    #HTC
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0660", OWNER="snowdream"
    
    #HTC HERO
    
    
    #Huawei
    SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0660", OWNER="snowdream"
    
    
    #K-Touch
    SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0660", OWNER="snowdream"
    
    
    #KT Tech
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0660", OWNER="snowdream"
    
    
    #Kyocera
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0660", OWNER="snowdream"
    
    
    #Lenovo
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2006", MODE="0660", OWNER="snowdream"
    
    
    #LG
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0660", OWNER="snowdream"
    
    
    #Motorola
    SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0660", OWNER="snowdream"
    
    
    #NEC
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0660", OWNER="snowdream"
    
    
    #Nook
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0660", OWNER="snowdream"
    
    
    #Nvidia
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0660", OWNER="snowdream"
    
    
    #OTGV
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0660", OWNER="snowdream"
    
    
    #Pantech
    SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0660", OWNER="snowdream"
    
    
    #Pegatron
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0660", OWNER="snowdream"
    
    
    #Philips
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0660", OWNER="snowdream"
    
    
    #PMC-Sierra
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0660", OWNER="snowdream"
    
    
    #Qualcomm
    SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0660", OWNER="snowdream"
    
    
    #SK Telesys
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0660", OWNER="snowdream"
    
    
    #Samsung
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0660", OWNER="snowdream"
    
    
    #Sharp
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0660", OWNER="snowdream"
    
    
    #Sony
    SUBSYSTEM=="usb", ATTRS{idVendor}=="054c", MODE="0660", OWNER="snowdream"
    
    
    #Sony Ericsson
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0660", OWNER="snowdream"
    
    
    #Teleepoch
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2340", MODE="0660", OWNER="snowdream"
    
    
    #Toshiba
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0660", OWNER="snowdream"
    
    
    #ZTE
    SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0660", OWNER="snowdream"

    Note : Replace "snowdream" with your username.. Keep the double quotes..

    Now, we need to give executing permissions to this file.. So :
    Code:
    $ sudo chmod a+r /etc/udev/rules.d/51-android.rules
    
    $ sudo service udev restart

    And this will solve the permission problem when connecting through ADB or FASTBOOT...
    22
    Compile kernel in WINDOWS 7

    First my PC config.. dont know related to compiling or not but still i mention it..
    Windows 7 32-bit
    4GB RAM
    i3 3rd gen. 3.3 GHz


    Ok now with compiling.

    1) Some Tools and Source:

    i. Cygwin http://cygwin.com/install.html
    ii. Toolchain for windows. http://android-git.devnull.name/gh/toolchain-4.6.3.cygwin.tar.bz2
    iii. Kernel source. get it on your own. I used https://github.com/sakindia123/htc_pico_kernel_3.x. Download as zip.
    iv. Notepad++

    2)Environment Setup:

    i) install cygwin by running setup.exe(duh!!) select install from internet with any mirror. Now for package selection, select install rather than default.
    1.jpg

    Now for extra must needed package for compiling checklist is below:

    Code:
    lzop
    gcc
    gcc-core
    gcc-g++
    wget
    vim
    vim-common
    git
    git-compleation 
    libncurses-devel
    make
    cmake
    python
    I think this much is enough. In cygwin there is a search bar to find that package is going to install or not so check it. And get familiar with cygwin.

    ii. Most important. Our windows doesn't understand difference between heLLwindow.txt and hellwindow.txt so we need to configure that. open regedit.exe select computer. Now click on File and hit Export and take registry backup. so if mess something u can restore it.
    Now go to
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\kernel
    You will find on right side obcaseinsensitive registry. set its value to 0 in Hexadesimal. And reboot your system. This how u get case sensitive in windows still u can't able to make heLLwindow.txt and hellwindow.txt at same place. it need different method..:D
    2.jpg



    3) Compiling:

    i. create some directory: Open cygwin and run below command to
    Code:
    mkdir -p ~/a
    cd ~/a
    so go to C:\cygwin\home\home\a and here paste all your source ZIP and toolchain tar.bz2 file. do not try to unzip with other software plz..

    ii. Extracting files: Note right now you are in "a" directory. Run below command in cygwin after copying files.
    3.jpg

    Code:
    tar -xjvf toolchain-4.6.3.cygwin.tar.bz2
    unzip *.zip
    Note:For easiness rename kernel source zip file into 3.zip
    By doing this u get two separate folder in C:\cygwin\home\home\a one is 3 and other is toolchain-4.6.3

    iii. Config file:
    Code:
    cd 3
    connect you phone to pc and get gonfig.gz. If you have configure adb correctly then you can it inside cygwin or by other metod get config.gz inside 3 directory.
    Code:
    adb pull /proc/config.gz
    gzip -dc config.gz > .config 
    Note: I use inside cygwin in "3" directory. But ask some questions. which will confuse you. go for different method below.
    
    [B]OR[/B]
    
    
    make pico_defconfig
    
    Tip: which command you use in different kernel source? confuse?  so check [B]C:\cygwin\home\home\a\3\arch\arm\configs[/B] 
    as per my kernel situated path. check which configs are provided. in my example u will find pico_defconfig. so i used "make pico_defconfig"
    on other source u may find differnet config so use this check. for example "[B]make pico_cm_defconfi[/B]g" or "[B]pico_sense_defconfig[/B]" 
    as in cute_prince source.

    iv. Cross Compiling:
    goto folder 3 and open "Makefile" with notepad++ and goto line 198 stating CROSS_COMPILING.
    Replace whole line with this one and save.
    CROSS_COMPILE ?= C:/cygwin/home/home/a/toolchain-4.6.3/bin/arm-linux-androideabi-
    5.jpg



    V. Compiling:
    Enter command
    Code:
    make -jX 
    WHERE "X" IS NUMBER ACCORDING TO YOUR PC CONFIGURATION. MY PROCESSOR IS QUAD CORE SO I PUT 4.
    SO FOR THAT MY COMMAND IS [B]make -j4[/B]



    Here is one pic that shows windows can be case sensitive:
    4.jpg



    vi. Party time:
    6.jpg

    go to C:\cygwin\home\home\a\3\arch\arm\boot you will find zImage. Add appropriate ramdisk and your boot.img is ready to rock. :laugh:


    vii. Modules:
    Enter below code to get moduels.

    Code:
    make modules
    mkdir modules
    cp `find ./ | grep .ko$` modules.order modules/



    Reference:http://xdaforums.com/showthread.php?t=1686310

    Want to appreciate my work "thank you" button is on bottom left. :)
    4
    I recommend android ndk for toolchain. Its better

    Sent from my potato with a microchip

    Whatever works for you bro... :)

    Sent from my HTC Explorer A310e using Tapatalk 2
    2
    Thanks .. sorry limited to 8 thanks . Lol wtf. Good guide bro.

    Sent from my HTC Explorer A310e using xda app-developers app
    2
    No.

    Is Cygwin a replacement to compile on windows rather on Ubuntu?

    Cygwin is what you call an "emulator". It allows you to run linux programs by emulating a linux environment. Cygwin cannot be used to "compile a ROM".

    The cygwin website explains it best.

    What Cygwin is?
    • a collection of tools which provide a Linux look and feel environment for Windows.
    • a DLL (cygwin1.dll) which acts as a Linux API layer providing substantial Linux API functionality.

    What Cygwin isn't?

    • a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
    • a way to magically make native Windows apps aware of UNIX® functionality like signals, ptys, etc. Again, you need to build your apps from source if you want to take advantage of Cygwin functionality.