Join Today













Site Sponsor
Results 1 to 3 of 3

Threaded View

  1. #1
    Premium Member Pac3comm1's Avatar
    Join Date
    May 2010
    Location
    Atlanta Ga
    Posts
    748
    Rep Power
    732

    Default Compile your own kernel with this guide

    BIIIIIIIIIIIIIIIG THANKS to Adrynalyne over at PPCGEEKS for compiling this guide! Sorry I forgot to post my gratitude where it is due.

    Part 1
    Installing GNU/Linux
    Not sure why my first post was deleted as it does pertain to the Droid, But its all good.



    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
    [hide-thanks]
    [Only registered and activated users can see links. ]
    [/hide-thanks]

    mkbootimg
    [hide-thanks]
    [Only registered and activated users can see links. ]
    [/hide-thanks]

    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.

    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

    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 are shown/set 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. I believe most must be editted.
    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.

    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.


    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.


    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(l bl),384k@6272k(misc),3584k(boot),4608k(recovery),1 43744k(system),94848k(cache),268032k(userdata),2m( kpanic)" -o boot.img
    File will be located in ~/kernel/droid folder. Copy this to your sd card.

    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.
    Last edited by Pac3comm1; 09-10-2010 at 12:08 AM.


 

Similar Threads

  1. Replies: 8
    Last Post: 12-11-2012, 10:22 PM
  2. Blackberry SPC/MSL PRL Guide Updated
    By Dex in forum RIM General Disscusion
    Replies: 38
    Last Post: 04-25-2012, 10:21 PM
  3. The Nerds Guide to Root
    By leadnerd in forum Misc
    Replies: 4
    Last Post: 03-03-2011, 06:02 PM
  4. Replies: 0
    Last Post: 09-05-2010, 04:29 PM

Tags for this Thread

Posting Permissions

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