DroidForums.net is the original Verizon Android Forum! Registered Users do not see these ads. Please Register - It's Free!
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 48

Thread: How to compile your own kernel.

  1. Developer
    adrynalyne's Avatar
    Member #
    18036
    Join Date
    Dec 2009
    Posts
    2,896
    Liked
    4 times
    Phone
    Droidzilla
    DroidForums.net Developer
    Premium Member
    #1

    How to compile your own kernel.


    !!! This is only for Advanced Users !!!
    Do not try unless you know what this stuff even means
    and you have all the requirements!!
    And don't expect support questions to be answered immediately.

    !!!! Use this at YOUR OWN RISK !!!!


    Neither the Author or DroidForums can be Held Responsible in how you use this information !!!
    ========================Good Luck and Have Fun==============================

    This is a wip, so...
    Credit to Sticky: How to Compile the Droid kernel for some of the sections I borrowed.

    Part 1
    Installing GNU/Linux


    First, you will need GNU/Linux. Use any distro you like, but for ease, Ubuntu will work fine. Unless you plan on making a dual boot or using it as a main OS, wubi will be one of the easiest ways. It will install Ubuntu onto your Windows partition in a folder of its own. Uninstall is easy as well, you can do it from the control panel. You can also do this under a VM, but wubi is going to be easiest to set up.

    Getting Ubuntu
    Download Ubuntu | Ubuntu

    Then, burn the iso to a CD. To install with Wubi, simply start the setup on the CD from within windows. Follow the directions and you are on your way to installing Ubuntu. When you reboot you will be presented with the choice to boot Windows, or Ubuntu.
  2.  
     
     
     
  3. Developer
    adrynalyne's Avatar
    Member #
    18036
    Join Date
    Dec 2009
    Posts
    2,896
    Liked
    4 times
    Phone
    Droidzilla
    DroidForums.net Developer
    Premium Member
    #2
    Part 2
    Setting up Git and kernel source

    Getting the kernel source will be done by using this code below. You can literally copy and paste it from here into the ubuntu terminal.
    Code:
    mkdir -p ~/kernel/droid
    cd ~/kernel/droid
    git clone git://android.git.kernel.org/kernel/omap.git
    git clone git://android.git.kernel.org/platform/system/wlan/ti.git
    git clone git://android.git.kernel.org/platform/prebuilt.git
    This does take a bit.

    The next part is to set git to the version of kernel we want to use. In this case, we will want the latest Eclair source, as its the only kernel that works on ESE53+.

    Code:
    cd ~/kernel/droid/omap
    git checkout --track -b android-omap-2.6.29-eclair origin/android-omap-2.6.29-eclair
    cd ~/kernel/droid/ti
    git checkout --track -b eclair origin/eclair
    cd ~/kernel/droid/prebuilt
    git checkout --track -b eclair origin/eclair
  4. Developer
    adrynalyne's Avatar
    Member #
    18036
    Join Date
    Dec 2009
    Posts
    2,896
    Liked
    4 times
    Phone
    Droidzilla
    DroidForums.net Developer
    Premium Member
    #3
    Part 3
    Configuring kernel options (like tethering and overclocking)

    First, lets setup the build environment.
    Code:
    cd ~/kernel/droid/omap
    export ARCH=arm
    export CROSS_COMPILE=~/kernel/droid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
    make sholes_defconfig
    Kernel configuration happens a few ways. You can use menuconfig (gotta install ncurses dev tools)
    Code:
    cd ~/kernel/droid/omap
    make menuconfig
    or the more advanced method of modifying the .config file.
    The .config file is a hidden file in the ~/kernel/droid/omap. I wil attach mine. Here is where much of the kernel config takes place.
    Other more advanced things, such as overclocking, take place in the ~/kernel/droid/omap/arch//arm/mach-omap 2 directory.

    To overclock, check out the board.sholes.c file, specifically this part:
    Code:
    static struct omap_opp sholes_mpu_rate_table[] = {
        {0, 0, 0},
        /*OPP1*/
        {S125M, VDD1_OPP1, 0x20},
        /*OPP2*/
        {S250M, VDD1_OPP2, 0x27},
        /*OPP3*/
        {S500M, VDD1_OPP3, 0x32},
        /*OPP4*/
        {S550M, VDD1_OPP4, 0x38},
        /*OPP5*/
        {S600M, VDD1_OPP5, 0x3E},
    };
    Speeds slots are shown here, as well as voltages. I haven't messed with this too much yet. This is also linked to the file omap3-opp.h, where the speed settings are defined.
    Code:
    /* MPU speeds */
    #define S600M   600000000
    #define S550M   550000000
    #define S500M   500000000
    #define S250M   250000000
    #define S125M   125000000
    Enabling the 600mhz mode (and the fifth cpu slot) requires modifcations to the clock34xx.c file. I will upload mine.

    So if you wanted to overclock (for example), you would modify the above:
    Code:
    /* MPU speeds */
    #define S600M   800000000
    #define S550M   600000000
    #define S500M   500000000
    #define S250M   250000000
    #define S125M   125000000
    That would top out at 800mhz, stock voltage. There are a few ways to do this that I have seen, this is the one I have used. USE AT YOUR OWN PERIL!

    To tether, you will need to enable netfilter and iptables stuff in the kernel. Most of this stuff is NOT in .config, but you can add it. It only requires three lines to enable it, but then the questions that come during compilation are annoying, long, and make it easy to make errors. The .config file I loaded has this already, but I will list the sections as well. These get added to .config. Be careful not to duplicate sections.

    Code:
    # Networking options
    #
    CONFIG_COMPAT_NET_DEV_OPS=y
    CONFIG_PACKET=y
    CONFIG_PACKET_MMAP=y
    CONFIG_UNIX=y
    CONFIG_XFRM=y
    CONFIG_XFRM_USER=y
    # CONFIG_XFRM_SUB_POLICY is not set
    CONFIG_XFRM_MIGRATE=y
    # CONFIG_XFRM_STATISTICS is not set
    CONFIG_NET_KEY=y
    CONFIG_NET_KEY_MIGRATE=y
    CONFIG_INET=y
    CONFIG_IP_MULTICAST=y
    # CONFIG_IP_ADVANCED_ROUTER is not set
    CONFIG_IP_FIB_HASH=y
    CONFIG_IP_PNP=y
    CONFIG_IP_PNP_DHCP=y
    CONFIG_IP_PNP_BOOTP=y
    CONFIG_IP_PNP_RARP=y
    # CONFIG_NET_IPIP is not set
    # CONFIG_NET_IPGRE is not set
    # CONFIG_IP_MROUTE is not set
    # CONFIG_ARPD is not set
    # CONFIG_SYN_COOKIES is not set
    # CONFIG_INET_AH is not set
    # CONFIG_INET_ESP is not set
    # CONFIG_INET_IPCOMP is not set
    # CONFIG_INET_XFRM_TUNNEL is not set
    # CONFIG_INET_TUNNEL is not set
    # CONFIG_INET_XFRM_MODE_TRANSPORT is not set
    # CONFIG_INET_XFRM_MODE_TUNNEL is not set
    # CONFIG_INET_XFRM_MODE_BEET is not set
    # CONFIG_INET_LRO is not set
    CONFIG_INET_DIAG=y
    CONFIG_INET_TCP_DIAG=y
    # CONFIG_TCP_CONG_ADVANCED is not set
    CONFIG_TCP_CONG_CUBIC=y
    CONFIG_DEFAULT_TCP_CONG="cubic"
    # CONFIG_TCP_MD5SIG is not set
    # CONFIG_IPV6 is not set
    CONFIG_ANDROID_PARANOID_NETWORK=y
    # CONFIG_NETWORK_SECMARK is not set
    CONFIG_NETFILTER=y
    # CONFIG_NETFILTER_DEBUG is not set
    CONFIG_NETFILTER_ADVANCED=y
    
    #
    # Core Netfilter Configuration
    #
    # CONFIG_NETFILTER_NETLINK_QUEUE is not set
    # CONFIG_NETFILTER_NETLINK_LOG is not set
    CONFIG_NF_CONNTRACK=y
    # CONFIG_NF_CT_ACCT is not set
    # CONFIG_NF_CONNTRACK_MARK is not set
    # CONFIG_NF_CONNTRACK_EVENTS is not set
    # CONFIG_NF_CT_PROTO_DCCP is not set
    CONFIG_NF_CT_PROTO_GRE=y
    # CONFIG_NF_CT_PROTO_SCTP is not set
    # CONFIG_NF_CT_PROTO_UDPLITE is not set
    # CONFIG_NF_CONNTRACK_AMANDA is not set
    CONFIG_NF_CONNTRACK_FTP=y
    # CONFIG_NF_CONNTRACK_H323 is not set
    CONFIG_NF_CONNTRACK_IRC=y
    # CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
    CONFIG_NF_CONNTRACK_PPTP=y
    # CONFIG_NF_CONNTRACK_SANE is not set
    # CONFIG_NF_CONNTRACK_SIP is not set
    # CONFIG_NF_CONNTRACK_TFTP is not set
    # CONFIG_NF_CT_NETLINK is not set
    CONFIG_NETFILTER_XTABLES=y
    # CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
    # CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set
    # CONFIG_NETFILTER_XT_TARGET_MARK is not set
    # CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
    # CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
    # CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
    # CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
    # CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
    # CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
    # CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set
    # CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set
    # CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set
    # CONFIG_NETFILTER_XT_MATCH_DCCP is not set
    # CONFIG_NETFILTER_XT_MATCH_DSCP is not set
    # CONFIG_NETFILTER_XT_MATCH_ESP is not set
    # CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
    # CONFIG_NETFILTER_XT_MATCH_HELPER is not set
    CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
    # CONFIG_NETFILTER_XT_MATCH_LENGTH is not set
    # CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
    CONFIG_NETFILTER_XT_MATCH_MAC=y
    # CONFIG_NETFILTER_XT_MATCH_MARK is not set
    CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
    # CONFIG_NETFILTER_XT_MATCH_OWNER is not set
    # CONFIG_NETFILTER_XT_MATCH_POLICY is not set
    # CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set
    # CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
    # CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
    # CONFIG_NETFILTER_XT_MATCH_REALM is not set
    CONFIG_NETFILTER_XT_MATCH_RECENT=y
    # CONFIG_NETFILTER_XT_MATCH_RECENT_PROC_COMPAT is not set
    # CONFIG_NETFILTER_XT_MATCH_SCTP is not set
    CONFIG_NETFILTER_XT_MATCH_STATE=y
    # CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
    # CONFIG_NETFILTER_XT_MATCH_STRING is not set
    # CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
    # CONFIG_NETFILTER_XT_MATCH_TIME is not set
    # CONFIG_NETFILTER_XT_MATCH_U32 is not set
    # CONFIG_IP_VS is not set
    
    #
    # IP: Netfilter Configuration
    #
    CONFIG_NF_DEFRAG_IPV4=y
    CONFIG_NF_CONNTRACK_IPV4=y
    CONFIG_NF_CONNTRACK_PROC_COMPAT=y
    # CONFIG_IP_NF_QUEUE is not set
    CONFIG_IP_NF_IPTABLES=y
    # CONFIG_IP_NF_MATCH_ADDRTYPE is not set
    # CONFIG_IP_NF_MATCH_AH is not set
    # CONFIG_IP_NF_MATCH_ECN is not set
    # CONFIG_IP_NF_MATCH_TTL is not set
    CONFIG_IP_NF_FILTER=y
    CONFIG_IP_NF_TARGET_REJECT=y
    CONFIG_IP_NF_TARGET_LOG=y
    # CONFIG_IP_NF_TARGET_ULOG is not set
    CONFIG_NF_NAT=y
    CONFIG_NF_NAT_NEEDED=y
    CONFIG_IP_NF_TARGET_MASQUERADE=y
    CONFIG_IP_NF_TARGET_NETMAP=y
    CONFIG_IP_NF_TARGET_REDIRECT=y
    # CONFIG_IP_NF_TARGET_IDLETIMER is not set
    # CONFIG_NF_NAT_SNMP_BASIC is not set
    CONFIG_NF_NAT_PROTO_GRE=y
    CONFIG_NF_NAT_FTP=y
    CONFIG_NF_NAT_IRC=y
    # CONFIG_NF_NAT_TFTP is not set
    # CONFIG_NF_NAT_AMANDA is not set
    CONFIG_NF_NAT_PPTP=y
    # CONFIG_NF_NAT_H323 is not set
    # CONFIG_NF_NAT_SIP is not set
    # CONFIG_IP_NF_MANGLE is not set
    # CONFIG_IP_NF_RAW is not set
    # CONFIG_IP_NF_ARPTABLES is not set
    # CONFIG_IP_DCCP is not set
    # CONFIG_IP_SCTP is not set
    # CONFIG_TIPC is not set
    # CONFIG_ATM is not set
    # CONFIG_BRIDGE is not set
    # CONFIG_NET_DSA is not set
    # CONFIG_VLAN_8021Q is not set
    # CONFIG_DECNET is not set
    # CONFIG_LLC2 is not set
    # CONFIG_IPX is not set
    # CONFIG_ATALK is not set
    # CONFIG_X25 is not set
    # CONFIG_LAPB is not set
    # CONFIG_ECONET is not set
    # CONFIG_WAN_ROUTER is not set
    # CONFIG_NET_SCHED is not set
    # CONFIG_DCB is not set
    When you are done configuring your .config file, BACK IT UP. Each time you setup the build environment, it erases it and makes a default copy. Just watch the prompts and when it does that, replace the new .config file with your own.
    Attached Files
  5. Developer
    adrynalyne's Avatar
    Member #
    18036
    Join Date
    Dec 2009
    Posts
    2,896
    Liked
    4 times
    Phone
    Droidzilla
    DroidForums.net Developer
    Premium Member
    #4
    Part 4
    Compiling kernel and wifi driver

    Ready for this? While still in the omap directory (~/kernel/droid/omap)
    Code:
    make
    Now watch the initial prompts. Sometimes it once again nukes your .config file. I have no idea why. So just hit ctrl-x and cancel the compile, and then put your .config file back and make it again.

    Now for the wifi.

    Code:
    cd ~/kernel/droid/ti/wilink_6_1/platforms/os/linux
    export ARCH=arm
    export CROSS_COMPILE=~/kernel/droid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
    export HOST_PLATFORM=zoom2
    export KERNEL_DIR=~/kernel/droid/omap
    make
    The driver will be located under ~/kernel/droid/ti/wilink_6_1/platforms/os/linux.

    Put it on your sd card for safe keeping. You need to build this driver, every time you recompile the kernel.
  6. Developer
    adrynalyne's Avatar
    Member #
    18036
    Join Date
    Dec 2009
    Posts
    2,896
    Liked
    4 times
    Phone
    Droidzilla
    DroidForums.net Developer
    Premium Member
    #5
    Part 5
    Packaging kernel

    Make a new directory under your home folder called bin. Log out and back in to get it into your path.
    Attached is a zip file of two files you need. Copy mkbootimg into your bin folder, and boot.img-ramdisk.gz into the ~/kernel/droid folder.

    To package the kernel into a boot.img file:

    Code:
    cd ~/kernel/droid
    mkbootimg --kernel omap/arch/arm/boot/zImage --ramdisk boot.img-ramdisk.gz --cmdline "console=ttyS2,115200n8 rw mem=244M@0x80C00000 init=/init ip=off brdrev=P3A_CDMA mtdparts=omap2-nand.0:640k@128k(mbm),384k@1408k(cdt),384k@3328k(lbl),384k@6272k(misc),3584k(boot),4608k(recovery),143744k(system),94848k(cache),268032k(userdata),2m(kpanic)" -o boot.img
    File will be located in ~/kernel/droid folder. Copy this to your sd card.
    Attached Files
  7. Developer
    adrynalyne's Avatar
    Member #
    18036
    Join Date
    Dec 2009
    Posts
    2,896
    Liked
    4 times
    Phone
    Droidzilla
    DroidForums.net Developer
    Premium Member
    #6
    Part 6
    Flashing kernel and hosing your phone


    You cannot do this from within Android, so reboot to recovery mode.
    You will also need adb setup for this. In SPRecovery, go to mount options and mount the sd card.

    Code:
    adb shell
    flash_image boot /sdcard/boot.img
    Reboot.

    Once back up (assuming you booted), install the wifi driver.
    Code:
    adb shell
    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
    busybox cp /sdcard/tiwlan.ko /system/lib/modules/tiwlan.ko
    sync
    reboot
    Thats the main meat of it. Many things can be added and modified that go beyond this tutorial. The sky is the limit.

    Here is a sample kernel I made. Its not meant for regular use, just an example
    Attached Files
  8. Droid Sensei
    natediddy1120's Avatar
    Member #
    23380
    Join Date
    Jan 2010
    Location
    ???
    Posts
    3,183
    Phone
    CyanogenMod :-)
    #7


    !!! This is only for Advanced Users !!!
    Do not try unless you know what this stuff even means
    and you have all the requirements!!
    And don't expect support questions to be answered immediately.

    !!!! Use this at YOUR OWN RISK !!!!

  9. Master Droid
    kevdog's Avatar
    Member #
    4295
    Join Date
    Nov 2009
    Posts
    722
    Phone
    moto droid
    #8
    Where did you get the ramdisk images? I used to download mine from the now defunct sholes site, however Im interested in getting both the koush and sholes ramdisk boot loaders.
  10. Developer
    jamezelle's Avatar
    Member #
    57783
    Join Date
    Apr 2010
    Posts
    620
    Phone
    Motorola Droid
    DroidForums.net Developer
    Premium Member
    #9
    Quote Originally Posted by kevdog View Post
    Where did you get the ramdisk images? I used to download mine from the now defunct sholes site, however Im interested in getting both the koush and sholes ramdisk boot loaders.
    just download there kernel and use the split_bootimg.pl script

    to extract the boot.img

    i attached it for you below
    Attached Files
  11. n00b.
    raidzero's Avatar
    Member #
    59181
    Join Date
    Apr 2010
    Location
    Denver, CO
    Posts
    1,054
    Liked
    4 times
    Twitter
    raidzero_
    Phone
    Samsung Nexus S 4G
    DroidForums.net Developer
    DroidForums.net Theme Developer
    Premium Member
    #10
    Quote Originally Posted by adrynalyne View Post
    Flashing kernel and hosing your phone
    I love it. Thanks for this guide! You make it so easy to understand :-D
Page 1 of 5 123 ... LastLast

Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Tun kernel module for BB.9 w/Adamz kernel
    By tkcrabtree in forum Android Roms
    Replies: 1
    Last Post: 03-20-2010, 11:27 PM
  2. OC kernel
    By alm0614 in forum Android Hacks and Help
    Replies: 11
    Last Post: 03-15-2010, 09:31 AM
  3. Which OC kernel should i use??
    By meishkov in forum Android Roms
    Replies: 4
    Last Post: 03-13-2010, 06:20 PM

Search tags for this page

android build mkbootimg
,

build android kernel

,
decompile android kernel windows
,
how to compile a kernel for android
,
how to make an overclock kernel android
,
how to make oc kernel
,
how to make overclock kernel android
,
make: arm-eabi-gcc: command not found make: *** [cpu/omap3/s
,

mkbootimg

,
mkbootimg ubuntu
Click on a term to search our site for related topics.
Find us on Google+