How to Build Your Own HTC Evo 4G Android Kernel!

For those of you who want to hack the HTC Evo 4G, HTC has officially released the Evo 4G kernel, meaning you can compile it yourself and do whatever the heck you want to it.

Today, I will show you how to build your own HTC Evo 4G kernel using Ubuntu linux, which is the easiest way. For those of you who have Windows, you can try running Ubuntu linux under VMWare or VirtualBox, which works just fine. Mac should be very similar to Ubuntu linux.

Download evo_4g-2.6.29-e1cabff5.tar.gz from HTC’s website.

1. Let’s get into “root” mode since you won’t have to do so many “sudo”:

sudo /bin/bash

1. Untar your evo_4g-2.6.29-e1cabff5.tar.gz file:

tar xvf evo_4g-2.6.29-e1cabff5.tar.gz

Next, you can move the directory to /kernel for easy naming.

mv evo_4g-2.6.29-e1cabff5 /kernel

2. Next, let’s go to your SDK Tools directory /sdk/tools

cd /sdk/tools

3. Next, connect your HTC Evo 4G to your computer and make sure it’s in USB Debugging Mode under Settings->Applications->Development.

4. Next, we will pull the current configuration from your existing kernel on the HTC Evo 4G, so we don’t break anything

./adb pull /proc/config.gz .

5. Let’s gunzip the config.gz:
gunzip config.gz

6. Which will give us file called config.

7. Let’s move this config file into our kernel directory as .config:
cp config /kernel/.config

8. Go into your kernel directory:
cd /kernel

9. Let’s download the compiler for ARM on linux. (Select the latest version and download the one that says “A32 GNU/Linux TAR”. e.g. http://www.codesourcery.com/sgpp/lite/arm/portal/package6488/public/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2)

Just do:

wget http://www.codesourcery.com/sgpp/lite/arm/portal/package6488/public/arm-none-linux-gnueabi/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

to download it to the /kernel directory.

10. Untar the compiler

tar xvf arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

11. Let’s edit the Makefile to use the downloaded ARM compiler:
(I like vi editor but you can use your favorite text editor.)

vi Makefile

Next, change the CROSS_COMPILE= line to:

CROSS_COMPILE=arm-2010q1/bin/arm-none-linux-gnueabi-

12. (Optional) You can now edit .config file to add your hacks such as enabling loop devices for mounting. (this one required for the Ubuntu install on your Evo 4G)

Uncomment the CONFIG_DEV_BLK_LOOP and write:

CONFIG_DEV_BLK_LOOP=y

to enable loop devices.

13. Let’s compile it by doing:

make

Once that’s done, you need to copy over the “compiled” wifi/4G drivers to your Evo 4G to make it along with your new kernel.

Let’s copy over the new kernel and drivers to your /sdk/tools directory for easy installation.

cp /kernel/drivers/net/wireless/bcm4329_204/bcm4329.ko /sdk/tools/.

cp drivers/net/wimax/SQN/sequans_sdio.ko /sdk/tools/.

cp /kernel/arch/arm/boot/zImage /sdk/tools/.

14. Go to your SDK tools directory again and push the new files!

cd /sdk/tools

./adb push bcm4329.ko /system/lib/modules/bcm4329.ko
./adb push sequans_sdio.ko /system/lib/modules/sequans_sdio.ko

15. You will need fastboot to flash the new kernel image so do:

wget http://android-dls.com/files/linux/fastboot

chmod 755 fastboot

(For Windows, download this file and put into your SDK tools directory!)

Next let’s flash the new kernel image, zImage by doing:

./fastboot flash zimage zImage

It should actually be waiting, now you need to turn your phone off, then boot it back up into bootloader mode by pressing the Power button WHILE holding down the volume button.  Wait 3 seconds and hit the Power button to enter the fastboot mode.

16. Now you should see fastboot flashing the image and you can reboot it to try out your new HTC Evo 4G kernel you built yourself!

Enjoy~

If you like this post, don't forget to Like us on our Facebook page!

Want to stay updated on latest HTC Evo hacks and tips?
Sign up for our HTC Evo Hacks Newsletter here so you don't miss a single tip!
Categories: HTC Evo Hacks.

Recent Android News from HighOnAndroid.com



17 Responses to How to Build Your Own HTC Evo 4G Android Kernel!

  1. Pingback: Android Hacks – How to Compile Your Own Android Kernel!

  2. Pingback: How to Install Ubuntu on HTC Evo 4G! | HTC Evo 4G Hacks!

  3. alecaldi says:

    Is it possible to do this on a milestone? Since i want to install it Ubuntu in it… needs a diferent kernel to start with?
    It’s the same if I compile it in a Suse distro?

    Is there life on mars? :-)

  4. zaid says:

    i am new at this and let me know if you can do in an mac. As a start, if not too much trouble thanks in advance.

  5. zaid says:

    hi I’m just starting with programming, I wonder if you can do in an imac, and if I could help, thank you very much in advance. see you soon.

  6. FMac says:

    Hello, Zedomax, could you help me to build a kernel?
    My phone is HTC Desire, and I need a kernel with loop device support. I started to follow you for a long time. And, if you can help me, just thanx a lot really!

    When you have built the kernel, could you email me to my email?
    fmachine.is.here@gmail.com

    thx!!

  7. Pingback: [download] Latest Android for M8 releases - Page 7 - Meizu Me

  8. Pingback: [project]Port android to meizu M8 - Page 112 - Meizu Me

  9. Amon Darthir says:

    When I’m doing this for my HTC Eris, i get all the way to the last step and i get a FAILED (remote: not allow) code. Any idea what I have done wrong?

  10. Jack says:

    Hey guys, sorry for the newbie question but what is a kernal? And what are benefits of building your own?

  11. David Fisher says:

    Hello guys,I have two questions to ask:
    1.Is the sdk/tools under the Froyo source? Or is it the independent android sdk tools ?
    2.How can I get the /kernel directory in this article?

    Could anyone help me?
    Thanx a lot!

  12. MatthewJ says:

    Damn, your instructions go to shit from step 11 on.
    I have been at this for a while and am completely stuck, what makefile am I editing(what folder, where), after that what config file am I editing(what folder, where), and after that where do I need to cd/ to before running my make command? Sorry, everything before that was self explanatory yet still explained, but as soon as you get to the section that needs explaining you dont explain it, please help me out.

  13. Elmer Romero says:

    I came across an android iso image which runs wonderful in my new laptop, I tried to run it on an older laptop but stops at not finding something of cmov.
    checking the web I found the problem is that the machine is too old and needs an older kernel (or for the gurus out there you need to recompile). so
    question is how to put older kernel in the iso image to make old machine to boot.

    you can make lots of people happy by doing this because like me many people would give new life to older laptops that could be given to kids or people with not much money to buy a new one.

    with android you can surf the net

    Thank you for your attention.

  14. waldo says:

    these instructions suck like if everyone has liunx dude its great and all but think about it MORE USERS HAVE WINDOWS and so you should of done it on windows and you just went the easy way of just telling them to replace the forward slash with a backward one? wtf not all commands are the same for windows and linux for example did you tell them about “sudo”

    • Anurag Wazalwar says:

      “Today, I will show you how to build your own HTC Evo 4G kernel using Ubuntu linux, which is the easiest way. For those of you who have Windows, you can try running Ubuntu linux under VMWare or VirtualBox, which works just fine. Mac should be very similar to Ubuntu linux.”

      Mentioned right at the beginning, you sucker…

      If you’re not used to Linux, then you should have stopped reading right there and moved on. Least you could do is respect the effort that went into the article but you’re too shallow to do that. And as if that wasn’t all, you have the audacity to tell the author that he/she should’ve “done it on windows”? The author’s not working for you, you stupid arrogant prick! Learn some etiquette first!

  15. Pingback: How to Build Your Own HTC Evo 4G Android Kernel! - Android Forums

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Related News and Resources