|
||||
[HowTo]Compile your own kernel
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. 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 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 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}, }; Code:
/* MPU speeds */ #define S600M 600000000 #define S550M 550000000 #define S500M 500000000 #define S250M 250000000 #define S125M 125000000 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 Part 4 Compiling kernel and wifi driver Ready for this? While still in the omap directory (~/kernel/droid/omap) Code:
make 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 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(lbl),384k@6272k(misc),3584k(boot),4608k(recovery),143744k(system),94848k(cache),268032k(userdata),2m(kpanic)" -o boot.img 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 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 Last edited by Adrynalyne; 03-24-2010 at 02:28 PM. |
This post has been thanked 5 times. |
|
||||
Re: [HowTo]Compile your own kernel
Nice write up.
![]()
__________________
Moto Droid
I make ROMs because I like to. If you want to buy me a Pepsi though: Donate Follow me on mytabletlife.com |
|
||||
Re: [HowTo]Compile your own kernel
This is interesting: how to configure the task killer. I guess the kernel contains the instructions for how the stock task killer works.
__________________
The 'THanKs' button: use it, love it.
|
This post has been thanked 1 times. |
|
||||
Re: [HowTo]Compile your own kernel
Good Gosh I have alot of reading to do!! thanks buddy!
__________________
Im not a Genius, but i would love a Guinness!!
If I Helped you in any way, a simple ![]() Visit Me Over at http://Omniarom.com And say Hello! |
|
||||
Re: [HowTo]Compile your own kernel
I was all up for doing this until I realized that it wouldn't work with Windows. I don't get why Android ROMS are so much more difficult to build than Windows Mobile ROMS
![]()
__________________
Not much of a ppcgeeker but I have a tf3d themes thread on xda http://forum.xda-developers.com/showthread.php?t=541113
|
![]() |
|
|
|